Bug 1017321 - add ICE connectivity verification steps to data channel tests. r=jib
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Tue, 03 Jun 2014 10:36:00 +0200
changeset 207127 1df422fe3b578740e2f873716493588969834acd
parent 207126 6ea33c3c5d669d3f5e12ceb3d20567c54fe1fcac
child 207128 e106cac7c217f80ff3fd83e0cf53a642e01a59aa
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1017321
milestone32.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 1017321 - add ICE connectivity verification steps to data channel tests. r=jib
dom/media/tests/mochitest/templates.js
--- a/dom/media/tests/mochitest/templates.js
+++ b/dom/media/tests/mochitest/templates.js
@@ -417,16 +417,72 @@ var commandsDataChannel = [
         function () {
         is(test.pcLocal.signalingState, STABLE,
            "signalingState after local setRemoteDescription is 'stable'");
         test.next();
       });
     }
   ],
   [
+    'PC_LOCAL_WAIT_FOR_ICE_CONNECTED',
+    function (test) {
+      var myTest = test;
+      var myPc = myTest.pcLocal;
+
+      function onIceConnectedSuccess () {
+        ok(true, "pc_local: ICE switched to 'connected' state");
+        myTest.next();
+      };
+      function onIceConnectedFailed () {
+        dumpSdp(myTest);
+        ok(false, "pc_local: ICE failed to switch to 'connected' state: " + myPc.iceConnectionState);
+        myTest.next();
+      };
+
+      if (myPc.isIceConnected()) {
+        ok(true, "pc_local: ICE is in connected state");
+        myTest.next();
+      } else if (myPc.isIceConnectionPending()) {
+        myPc.waitForIceConnected(onIceConnectedSuccess, onIceConnectedFailed);
+      } else {
+        dumpSdp(myTest);
+        ok(false, "pc_local: ICE is already in bad state: " + myPc.iceConnectionState);
+        myTest.next();
+      }
+    }
+  ],
+  [
+    'PC_REMOTE_WAIT_FOR_ICE_CONNECTED',
+    function (test) {
+      var myTest = test;
+      var myPc = myTest.pcRemote;
+
+      function onIceConnectedSuccess () {
+        ok(true, "pc_remote: ICE switched to 'connected' state");
+        myTest.next();
+      };
+      function onIceConnectedFailed () {
+        dumpSdp(myTest);
+        ok(false, "pc_remote: ICE failed to switch to 'connected' state: " + myPc.iceConnectionState);
+        myTest.next();
+      };
+
+      if (myPc.isIceConnected()) {
+        ok(true, "pc_remote: ICE is in connected state");
+        myTest.next();
+      } else if (myPc.isIceConnectionPending()) {
+        myPc.waitForIceConnected(onIceConnectedSuccess, onIceConnectedFailed);
+      } else {
+        dumpSdp(myTest);
+        ok(false, "pc_remote: ICE is already in bad state: " + myPc.iceConnectionState);
+        myTest.next();
+      }
+    }
+  ],
+  [
     'PC_LOCAL_VERIFY_DATA_CHANNEL_STATE',
     function (test) {
       test.waitForInitialDataChannel(test.pcLocal, function() {
         test.next();
       }, function() {
         ok(false, test.pcLocal + " initial dataChannels[0] failed to switch to 'open'");
         unexpectedEventAndFinish(this, 'timeout')
       });