Bug 1513504 [wpt PR 14476] - Switch to new ICE state implementation, a=testonly
authorJonas Olsson <jonasolsson@chromium.org>
Thu, 31 Jan 2019 12:12:16 +0000
changeset 457738 63d67bf3cc854bca78feba72297c47d2c0a8262e
parent 457737 f11dfd60fc19fab41a4eecf4d1140c76e661e680
child 457739 14f2ce14928cc458f34bb709c2d3f66e96d7f60c
push id35518
push useropoprus@mozilla.com
push dateFri, 08 Feb 2019 09:55:14 +0000
treeherdermozilla-central@3a3e393396f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1513504, 14476, 1371392, 617476
milestone67.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 1513504 [wpt PR 14476] - Switch to new ICE state implementation, a=testonly Automatic update from web-platform-tests Switch to new ICE state implementation With this change the ice/dtls connection states should finally be compliant to the spec. Bug: webrtc:6145 Change-Id: I1e7c13f22e40b534e732ecd3fc103f617306f00a Reviewed-on: https://chromium-review.googlesource.com/c/1371392 Commit-Queue: Jonas Olsson <jonasolsson@chromium.org> Reviewed-by: Henrik Boström <hbos@chromium.org> Cr-Commit-Position: refs/heads/master@{#617476} -- wpt-commits: d6a89e2a29de93528b534c5dbd3a6fea2ae9c03c wpt-pr: 14476
testing/web-platform/tests/webrtc/RTCPeerConnection-iceConnectionState.html
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-iceConnectionState.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-iceConnectionState.html
@@ -59,16 +59,22 @@
         are in the checking, failed or disconnected state, or all
         RTCIceTransport s are in the closed state.
    */
   test(t => {
     const pc = new RTCPeerConnection();
     assert_equals(pc.iceConnectionState, 'new');
   }, 'Initial iceConnectionState should be new');
 
+  test(t => {
+    const pc = new RTCPeerConnection();
+    pc.close();
+    assert_equals(pc.iceConnectionState, 'closed');
+  }, 'Closing the connection should set iceConnectionState to closed');
+
   /*
     4.4.4 RTCIceConnectionState Enum
       checking
         Any of the RTCIceTransport s are in the checking state and none of
         them are in the failed or disconnected state.
 
       connected
         All RTCIceTransport s are in the connected, completed or closed state
@@ -101,52 +107,85 @@
         there are no more remote candidates, finished checking all candidate
         pairs and found a connection. If consent checks [RFC7675] subsequently
         fail on all successful candidate pairs, the state transitions to "failed".
    */
   async_test(t => {
     const pc1 = new RTCPeerConnection();
     t.add_cleanup(() => pc1.close());
     const pc2 = new RTCPeerConnection();
+    t.add_cleanup(() => pc2.close());
+
+    let had_checking = false;
+
+    const onIceConnectionStateChange = t.step_func(() => {
+      const {iceConnectionState} = pc1;
+      if (iceConnectionState === 'checking') {
+        had_checking = true;
+      } else if (iceConnectionState === 'connected' ||
+                 iceConnectionState === 'completed') {
+        assert_true(had_checking, 'state should pass checking before' +
+                                  ' reaching connected or completed');
+        t.done();
+      }
+    });
+
+    pc1.createDataChannel('test');
+
+    pc1.addEventListener('iceconnectionstatechange', onIceConnectionStateChange);
+
+    exchangeIceCandidates(pc1, pc2);
+    doSignalingHandshake(pc1, pc2);
+  }, 'connection with one data channel should eventually have connected or ' +
+     'completed connection state');
+
+async_test(t => {
+    const pc1 = new RTCPeerConnection();
+    t.add_cleanup(() => pc1.close());
+    const pc2 = new RTCPeerConnection();
 
     t.add_cleanup(() => pc2.close());
 
     const onIceConnectionStateChange = t.step_func(() => {
       const { iceConnectionState } = pc1;
 
       if(iceConnectionState === 'checking') {
         const iceTransport = pc1.sctp.transport.transport;
 
         assert_equals(iceTransport.state, 'checking',
-          'Expect ICE transport to be in checking state when iceConnectionState is checking');
+          'Expect ICE transport to be in checking state when' +
+          ' iceConnectionState is checking');
 
       } else if(iceConnectionState === 'connected') {
         const iceTransport = pc1.sctp.transport.transport;
 
         assert_equals(iceTransport.state, 'connected',
-          'Expect ICE transport to be in connected state when iceConnectionState is connected');
+          'Expect ICE transport to be in connected state when' +
+          ' iceConnectionState is connected');
 
       } else if(iceConnectionState === 'completed') {
         const iceTransport = pc1.sctp.transport.transport;
 
         assert_equals(iceTransport.state, 'completed',
-          'Expect ICE transport to be in connected state when iceConnectionState is completed');
+          'Expect ICE transport to be in connected state when' +
+          ' iceConnectionState is completed');
       }
     });
 
     pc1.createDataChannel('test');
 
     assert_equals(pc1.oniceconnectionstatechange, null,
       'Expect connection to have iceconnectionstatechange event');
 
     pc1.addEventListener('iceconnectionstatechange', onIceConnectionStateChange);
 
     exchangeIceCandidates(pc1, pc2);
     doSignalingHandshake(pc1, pc2);
-  }, 'connection with one data channel should eventually have connected connection state');
+  }, 'connection with one data channel should eventually ' +
+     'have connected connection state');
 
   /*
     TODO
     4.4.4 RTCIceConnectionState Enum
       failed
         Any of the RTCIceTransport s are in the failed state.
 
       disconnected