Bug 1635086 [wpt PR 23383] - Add test that datachannel events are not fired after DC close., a=testonly
authorHarald Alvestrand <hta@chromium.org>
Wed, 13 May 2020 04:00:39 +0000
changeset 529994 3886f4322f2b7c0a784726145feb896019148fa7
parent 529993 2c391b283120abab44979714e1811b4479491b5d
child 529995 d6c45563fc0a2cd29b2d3c47be8e4cf7170429e6
push id116003
push userwptsync@mozilla.com
push dateThu, 14 May 2020 19:04:08 +0000
treeherderautoland@7baa72e0d62c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1635086, 23383, 1069811, 2179006, 765038
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1635086 [wpt PR 23383] - Add test that datachannel events are not fired after DC close., a=testonly Automatic update from web-platform-tests Add test that datachannel events are not fired after DC close. Addresses spec update: https://github.com/w3c/webrtc-pc/pull/2521 Code was already fixed. Bug: chromium:1069811 Change-Id: I6547c56a7ea11c2a024a57dd001f740cd9a1f681 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2179006 Reviewed-by: Guido Urdaneta <guidou@chromium.org> Commit-Queue: Harald Alvestrand <hta@chromium.org> Cr-Commit-Position: refs/heads/master@{#765038} -- wpt-commits: 7221e2603d23124fc180d087cb3623d24c3ea02e wpt-pr: 23383
testing/web-platform/tests/webrtc/RTCDataChannel-close.html
--- a/testing/web-platform/tests/webrtc/RTCDataChannel-close.html
+++ b/testing/web-platform/tests/webrtc/RTCDataChannel-close.html
@@ -64,9 +64,38 @@ promise_test(async t => {
   pc1.close();
   await haveClosed;
   // Error should fire before close.
   assert_array_equals(events, ['error', 'close']);
   assert_true(error instanceof RTCError);
   assert_equals(error.name, 'OperationError');
 }, 'Close peerconnection causes close event and error to be called');
 
+promise_test(async t => {
+  let pc1 = new RTCPeerConnection();
+  t.add_cleanup(() => pc1.close());
+  let [channel1, channel2] = await createDataChannelPair(pc1);
+  // The expected sequence of events when closing a DC is that
+  // channel1 goes to closing, channel2 fires onclose, and when
+  // the close is confirmed, channel1 fires onclose.
+  // After that, no more events should fire.
+  channel1.onerror = t.unreached_func();
+  let close2Handler = new Promise(resolve => {
+    channel2.onclose = event => {
+      resolve();
+    };
+  });
+  let close1Handler = new Promise(resolve => {
+    channel1.onclose = event => {
+      resolve();
+    };
+  });
+  channel1.close();
+  await close2Handler;
+  await close1Handler;
+  channel1.onclose = t.unreached_func();
+  channel2.onclose = t.unreached_func();
+  channel2.onerror = t.unreached_func();
+  pc1.close();
+  await new Promise(resolve => t.step_timeout(resolve, 10));
+}, 'Close peerconnection after DC close causes no events');
+
 </script>