Commit 4792386b authored by Philipp Hancke's avatar Philipp Hancke Committed by Commit Bot

wpt: dont fire RTCPeerConnection.onconnectionstatechange on close

adds a test to assert that RTCPeerConnection.onconnectionstatechange
is not fired when RTCPeerConnection.close() is called.

BUG=699036,1023736

Change-Id: I623deeb4f0948cf213ff8913c33610ef0e7315e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1959969Reviewed-by: default avatarHarald Alvestrand <hta@chromium.org>
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Cr-Commit-Position: refs/heads/master@{#727996}
parent f26adce4
...@@ -270,4 +270,22 @@ ...@@ -270,4 +270,22 @@
assert_array_equals(states, ['connecting', 'connected']); assert_array_equals(states, ['connecting', 'connected']);
}, 'connectionState transitions to connected via connecting'); }, 'connectionState transitions to connected via connecting');
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));
exchangeIceCandidates(pc1, pc2);
doSignalingHandshake(pc1, pc2);
await listenToIceConnected(pc2);
pc2.onconnectionstatechange = t.unreached_func();
pc2.close();
assert_true(pc2.connectionState === 'closed');
await new Promise(r => t.step_timeout(r, 100));
}, 'Closing a PeerConnection should not fire connectionstatechange event');
</script> </script>
...@@ -5,5 +5,6 @@ PASS connection with one data channel should eventually have connected connectio ...@@ -5,5 +5,6 @@ PASS connection with one data channel should eventually have connected connectio
FAIL connection with one data channel should eventually have transports in connected state Cannot read property 'transport' of null FAIL connection with one data channel should eventually have transports in connected state Cannot read property 'transport' of null
PASS connectionState remains new when not adding remote ice candidates PASS connectionState remains new when not adding remote ice candidates
PASS connectionState transitions to connected via connecting PASS connectionState transitions to connected via connecting
PASS Closing a PeerConnection should not fire connectionstatechange event
Harness: the test ran to completion. Harness: the test ran to completion.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment