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 531043 3bad7b1c8552ba528bf5a406926edae5416b34a4
parent 531042 44b819d83fc8d23ef6521e7f9dcd7e0197faed23
child 531044 36a2a1085d90464177fe6ba34b43cdd14bb8c9a3
push id37435
push userapavel@mozilla.com
push dateWed, 20 May 2020 15:28:23 +0000
treeherdermozilla-central@5415da14ec9a [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>