Skip to content

Commit

Permalink
Closing a PeerConnection should not fire iceconnectionstatechange event.
Browse files Browse the repository at this point in the history
This is a test case for w3c/webrtc-pc#2335 and w3c/webrtc-pc#2336.
  • Loading branch information
jianjunz committed Oct 24, 2019
1 parent 5af91f7 commit 8316bd0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions webrtc/RTCPeerConnection-iceConnectionState.https.html
Expand Up @@ -371,4 +371,29 @@
assert_array_equals(pc2.iceStates, ['new', 'checking', 'connected']);
}, 'Responder ICE connection state behaves as expected');

/*
Test case for step 11 of PeerConnection.close().
...
11. Set connection's ICE connection state to "closed". This does not invoke
the "update the ICE connection state" procedure, and does not fire any
event.
...
*/
promise_test(async t => {
const pc1 = new RTCPeerConnection();
t.add_cleanup(() => pc1.close());
const pc2 = new RTCPeerConnection();
const stream = await getNoiseStream({ audio: true });
t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));

stream.getTracks().forEach(track => pc1.addTrack(track, stream));
coupleIceCandidates(pc1, pc2);
doSignalingHandshake(pc1, pc2);
await listenToIceConnected(pc2);

pc2.oniceconnectionstatechange = t.unreached_func();
pc2.close();
assert_true(pc2.iceConnectionState === 'closed');
}, 'Closing a PeerConnection should not fire iceconnectionstatechange event');

</script>

0 comments on commit 8316bd0

Please sign in to comment.