<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Testing closing peer connection</title>
        <script src="../resources/testharness.js"></script>
        <script src="../resources/testharnessreport.js"></script>
    </head>
    <body>
        <script>
promise_test((test) => {
  return new Promise((resolve, reject) => {
    var pc = new RTCPeerConnection();
    pc.onicegatheringstatechange = (event) => {
        if (pc.iceGatheringState == "gathering") {
            pc.close();
            if (window.internals)
                internals.stopPeerConnection(pc);
            resolve();
        }
    }
    pc.createDataChannel("test");
    pc.createOffer().then((desc) => pc.setLocalDescription(desc));
  });
}, "closing and stopping peer connection in the middle of gathering candidates");
        </script>
    </body>
</html>
