bug 862883 - Enable webrtc mochitests on FxAndroid. r=gcp
authorJason Smith <jsmith@mozilla.com>
Thu, 02 May 2013 10:33:15 -0700
changeset 130957 987686854a2129fa01faf1eba6b27d42664a178c
parent 130956 dbe30ba57be1d187553b6a8452831f7293c1af6a
child 130958 1bb461d484b22486bdbffe6c2b6a0f7c7b2515c1
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-esr52@d7ce90899997 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgcp
bugs862883
milestone23.0a1
bug 862883 - Enable webrtc mochitests on FxAndroid. r=gcp
dom/media/tests/mochitest/head.js
dom/media/tests/mochitest/test_getUserMedia_basicAudio.html
dom/media/tests/mochitest/test_getUserMedia_basicVideo.html
dom/media/tests/mochitest/test_getUserMedia_basicVideoAudio.html
dom/media/tests/mochitest/test_getUserMedia_exceptions.html
dom/media/tests/mochitest/test_getUserMedia_gumWithinGum.html
dom/media/tests/mochitest/test_getUserMedia_playAudioTwice.html
dom/media/tests/mochitest/test_getUserMedia_playVideoAudioTwice.html
dom/media/tests/mochitest/test_getUserMedia_playVideoTwice.html
dom/media/tests/mochitest/test_getUserMedia_stopAudioStream.html
dom/media/tests/mochitest/test_getUserMedia_stopAudioStreamWithFollowupAudio.html
dom/media/tests/mochitest/test_getUserMedia_stopVideoAudioStream.html
dom/media/tests/mochitest/test_getUserMedia_stopVideoAudioStreamWithFollowupVideoAudio.html
dom/media/tests/mochitest/test_getUserMedia_stopVideoStream.html
dom/media/tests/mochitest/test_getUserMedia_stopVideoStreamWithFollowupVideo.html
dom/media/tests/mochitest/test_peerConnection_basicAudio.html
dom/media/tests/mochitest/test_peerConnection_basicAudioVideo.html
dom/media/tests/mochitest/test_peerConnection_basicAudioVideoCombined.html
dom/media/tests/mochitest/test_peerConnection_basicVideo.html
dom/media/tests/mochitest/test_peerConnection_bug822674.html
dom/media/tests/mochitest/test_peerConnection_bug825703.html
dom/media/tests/mochitest/test_peerConnection_bug827843.html
dom/media/tests/mochitest/test_peerConnection_bug834153.html
dom/media/tests/mochitest/test_peerConnection_bug835370.html
dom/media/tests/mochitest/test_peerConnection_bug840344.html
dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html
dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html
dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html
dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html
dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html
testing/mochitest/b2g.json
--- a/dom/media/tests/mochitest/head.js
+++ b/dom/media/tests/mochitest/head.js
@@ -106,41 +106,30 @@ function getUserMedia(constraints, onSuc
 
 /**
  * Setup any Mochitest for WebRTC by enabling the preference for
  * peer connections. As by bug 797979 it will also enable mozGetUserMedia()
  * and disable the mozGetUserMedia() permission checking.
  *
  * @param {Function} aCallback
  *        Test method to execute after initialization
- * @param {Boolean} desktopSupportedOnly
- *        Specifies if the test currently is known to work on desktop only
  */
-function runTest(aCallback, desktopSupportedOnly) {
+function runTest(aCallback) {
   SimpleTest.waitForExplicitFinish();
-
-  // If this is a desktop supported test and we're on android or b2g,
-  // indicate that the test is not supported and skip the test
-  if(desktopSupportedOnly && (navigator.userAgent.indexOf('Android') > -1 ||
-     navigator.platform === '')) {
-    ok(true, navigator.userAgent + ' currently not supported');
-    SimpleTest.finish();
-  } else {
-    SpecialPowers.pushPrefEnv({'set': [
-        ['media.peerconnection.enabled', true],
-        ['media.navigator.permission.denied', true]]
-      }, function () {
-      try {
-        aCallback();
-      }
-      catch (err) {
-        unexpectedCallbackAndFinish(new Error)(err);
-      }
-    });
-  }
+  SpecialPowers.pushPrefEnv({'set': [
+    ['media.peerconnection.enabled', true],
+    ['media.navigator.permission.disabled', true]]
+  }, function () {
+    try {
+      aCallback();
+    }
+    catch (err) {
+      unexpectedCallbackAndFinish(new Error)(err);
+    }
+  });
 }
 
 /**
  * Generates a callback function fired only under unexpected circumstances
  * while running the tests. The generated function kills off the test as well
  * gracefully.
  *
  * @param {Error} error
--- a/dom/media/tests/mochitest/test_getUserMedia_basicAudio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicAudio.html
@@ -31,14 +31,14 @@ https://bugzilla.mozilla.org/show_bug.cg
 
       playback.playMedia(false, function () {
         aStream.stop();
         SimpleTest.finish();
       }, unexpectedCallbackAndFinish(new Error));
 
     }, unexpectedCallbackAndFinish(new Error));
 
-  }, true);
+  });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_basicVideo.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicVideo.html
@@ -31,14 +31,14 @@ https://bugzilla.mozilla.org/show_bug.cg
 
       playback.playMedia(false, function () {
         aStream.stop();
         SimpleTest.finish();
       }, unexpectedCallbackAndFinish(new Error));
 
     }, unexpectedCallbackAndFinish(new Error));
 
-  }, true);
+  });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_basicVideoAudio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicVideoAudio.html
@@ -30,14 +30,14 @@ https://bugzilla.mozilla.org/show_bug.cg
       var playback = new LocalMediaStreamPlayback(testVideoAudio, aStream);
 
       playback.playMedia(false, function () {
         aStream.stop();
         SimpleTest.finish();
       }, unexpectedCallbackAndFinish(new Error));
 
     }, unexpectedCallbackAndFinish(new Error));
-  }, true);
+  });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_exceptions.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_exceptions.html
@@ -72,14 +72,14 @@ runTest(function () {
       navigator.mozGetUserMedia.apply(navigator, test.params);
     } catch (e) {
       exception = (e.result === test.error);
     }
     ok(exception, "Exception for " + test.message);
   });
 
   SimpleTest.finish();
-}, false);
+});
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_gumWithinGum.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_gumWithinGum.html
@@ -44,14 +44,14 @@ https://bugzilla.mozilla.org/show_bug.cg
             SimpleTest.finish();
           }, unexpectedCallbackAndFinish(new Error));
 
         }, unexpectedCallbackAndFinish(new Error));
 
       }, unexpectedCallbackAndFinish(new Error));
 
     }, unexpectedCallbackAndFinish(new Error));
-  }, true);
+  });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_playAudioTwice.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_playAudioTwice.html
@@ -34,14 +34,14 @@ https://bugzilla.mozilla.org/show_bug.cg
         audioStreamPlayback.playMedia(true, function() {
           audioStream.stop();
           SimpleTest.finish();
         }, unexpectedCallbackAndFinish(new Error));
 
       }, unexpectedCallbackAndFinish(new Error));
 
     }, unexpectedCallbackAndFinish(new Error));
-  }, true);
+  });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_playVideoAudioTwice.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_playVideoAudioTwice.html
@@ -33,14 +33,14 @@ https://bugzilla.mozilla.org/show_bug.cg
         streamPlayback.playMedia(true, function() {
           stream.stop();
           SimpleTest.finish();
         }, unexpectedCallbackAndFinish(new Error));
 
       }, unexpectedCallbackAndFinish(new Error));
 
     }, unexpectedCallbackAndFinish(new Error));
-  }, true);
+  });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_playVideoTwice.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_playVideoTwice.html
@@ -34,14 +34,14 @@ https://bugzilla.mozilla.org/show_bug.cg
         videoStreamPlayback.playMedia(true, function() {
           videoStream.stop();
           SimpleTest.finish();
         }, unexpectedCallbackAndFinish(new Error));
 
       }, unexpectedCallbackAndFinish(new Error));
 
     }, unexpectedCallbackAndFinish(new Error));
-  }, true);
+  });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_stopAudioStream.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_stopAudioStream.html
@@ -27,14 +27,14 @@ https://bugzilla.mozilla.org/show_bug.cg
   runTest(function () {
     getUserMedia({audio: true}, function(stream) {
       var testAudio = document.getElementById('testAudio');
       var audioStreamPlayback = new LocalMediaStreamPlayback(testAudio, stream);
 
       audioStreamPlayback.playMediaWithStreamStop(false, SimpleTest.finish,
         unexpectedCallbackAndFinish(new Error));
     }, unexpectedCallbackAndFinish(new Error));
-  }, true);
+  });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_stopAudioStreamWithFollowupAudio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_stopAudioStreamWithFollowupAudio.html
@@ -39,14 +39,14 @@ https://bugzilla.mozilla.org/show_bug.cg
             SimpleTest.finish();
           }, unexpectedCallbackAndFinish(new Error));
 
         }, unexpectedCallbackAndFinish(new Error));
 
       }, unexpectedCallbackAndFinish(new Error));
 
     }, unexpectedCallbackAndFinish(new Error));
-  }, true);
+  });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_stopVideoAudioStream.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_stopVideoAudioStream.html
@@ -27,14 +27,14 @@ https://bugzilla.mozilla.org/show_bug.cg
   runTest(function () {
     getUserMedia({video: true, audio: true}, function(stream) {
       var testVideo = document.getElementById('testVideo');
       var streamPlayback = new LocalMediaStreamPlayback(testVideo, stream);
 
       streamPlayback.playMediaWithStreamStop(false, SimpleTest.finish,
         unexpectedCallbackAndFinish(new Error));
     }, unexpectedCallbackAndFinish(new Error));
-  }, true);
+  });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_stopVideoAudioStreamWithFollowupVideoAudio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_stopVideoAudioStreamWithFollowupVideoAudio.html
@@ -39,14 +39,14 @@ https://bugzilla.mozilla.org/show_bug.cg
             SimpleTest.finish();
           }, unexpectedCallbackAndFinish(new Error));
 
         }, unexpectedCallbackAndFinish(new Error));
 
       }, unexpectedCallbackAndFinish(new Error));
 
     }, unexpectedCallbackAndFinish(new Error));
-  }, true);
+  });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_stopVideoStream.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_stopVideoStream.html
@@ -27,14 +27,14 @@ https://bugzilla.mozilla.org/show_bug.cg
   runTest(function () {
     getUserMedia({video: true}, function(stream) {
       var testVideo = document.getElementById('testVideo');
       var videoStreamPlayback = new LocalMediaStreamPlayback(testVideo, stream);
 
       videoStreamPlayback.playMediaWithStreamStop(false, SimpleTest.finish,
         unexpectedCallbackAndFinish(new Error));
     }, unexpectedCallbackAndFinish(new Error));
-  }, true);
+  });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_stopVideoStreamWithFollowupVideo.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_stopVideoStreamWithFollowupVideo.html
@@ -40,14 +40,14 @@ https://bugzilla.mozilla.org/show_bug.cg
             SimpleTest.finish();
           }, unexpectedCallbackAndFinish(new Error));
 
         }, unexpectedCallbackAndFinish(new Error));
 
       }, unexpectedCallbackAndFinish(new Error));
 
     }, unexpectedCallbackAndFinish(new Error));
-  }, true);
+  });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudio.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudio.html
@@ -15,13 +15,13 @@
     title: "Basic audio-only peer connection"
   });
 
   var test;
   runTest(function () {
     test = new PeerConnectionTest();
     test.setMediaConstraints([{audio: true}], [{audio: true}]);
     test.run();
-  }, true);
+  });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioVideo.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioVideo.html
@@ -17,13 +17,13 @@
   });
 
   var test;
   runTest(function () {
     test = new PeerConnectionTest();
     test.setMediaConstraints([{audio: true}, {video: true}],
                              [{audio: true}, {video: true}]);
     test.run();
-  }, true);
+  });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoCombined.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoCombined.html
@@ -17,13 +17,13 @@
   });
 
   var test;
   runTest(function () {
     test = new PeerConnectionTest();
     test.setMediaConstraints([{audio: true}, {video: true}],
                              [{audio: true}, {video: true}]);
     test.run();
-  }, true);
+  });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_basicVideo.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicVideo.html
@@ -15,13 +15,13 @@
     title: "Basic video-only peer connection"
   });
 
   var test;
   runTest(function () {
     test = new PeerConnectionTest();
     test.setMediaConstraints([{video: true}], [{video: true}]);
     test.run();
-  }, true);
+  });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_bug822674.html
+++ b/dom/media/tests/mochitest/test_peerConnection_bug822674.html
@@ -17,13 +17,13 @@
     var pc = new mozRTCPeerConnection();
 
     pc.thereIsNeverGoingToBeAPropertyWithThisNameOnThisInterface = 1;
     is(pc.thereIsNeverGoingToBeAPropertyWithThisNameOnThisInterface, 1,
        "Can set expandos on an RTCPeerConnection");
 
     pc = null;
     SimpleTest.finish();
-  }, true);
+  });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_bug825703.html
+++ b/dom/media/tests/mochitest/test_peerConnection_bug825703.html
@@ -60,13 +60,13 @@
                 { url:"turn:[::192.9.5.5]:42", username:"p", credential:"p" },
                 { url:"turns:x.org:42", username:"p", credential:"p" }
                 ]}, true);
 
     makePC({ iceServers: [{ url:"stun:0.0.0.0", credential:{}}] }, false);
 
     pcs = null;
     SimpleTest.finish();
-  }, true);
+  });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_bug827843.html
+++ b/dom/media/tests/mochitest/test_peerConnection_bug827843.html
@@ -80,13 +80,13 @@
   ];
 
   var test;
   runTest(function () {
     test = new PeerConnectionTest();
     test.setMediaConstraints([{audio: true}], [{audio: true}]);
     test.chain.append(steps);
     test.run();
-  }, true);
+  });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_bug834153.html
+++ b/dom/media/tests/mochitest/test_peerConnection_bug834153.html
@@ -32,13 +32,13 @@
         is(d.type,"answer","CreateAnswer created an answer");
         SimpleTest.finish();
       }, function (err) {
         croak("createAnswer failed: " + err);
       });
     }, function (err) {
         croak("createOffer failed: " + err);
     },  { mandatory: { OfferToReceiveAudio: true} });
-  }, true);
+  });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_bug835370.html
+++ b/dom/media/tests/mochitest/test_peerConnection_bug835370.html
@@ -51,13 +51,13 @@
     try { pconnect.createOffer(step1, failed, { optional: [{ OfferToReceiveVideo: false, OfferToReceiveAudio: true, }] }); } catch (e) { exception = e; }
     ok(exception, "createOffer(step1, failed, { optional: [{ OfferToReceiveVideo: false, OfferToReceiveAudio: true, }] }) throws");
     exception = null;
     try { pconnects.createOffer(step1, failed, { mandatory: { OfferToReceiveVideo: false, OfferToReceiveAudio: true, MozDontOfferDataChannel: true}, optional: [{ VoiceActivityDetection: true }, { FooBar: "42"  }] }); } catch (e) { exception = e; }
     ok(!exception, "createOffer(step1, failed, { mandatory: { OfferToReceiveVideo: false, OfferToReceiveAudio: true, MozDontOfferDataChannel: true}, optional: [{ VoiceActivityDetection: true }, { FooBar: \"42\"  }] }) succeeds");
     pconnect = null;
     pconnects = null;
     SimpleTest.finish();
-  }, true);
+  });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_bug840344.html
+++ b/dom/media/tests/mochitest/test_peerConnection_bug840344.html
@@ -107,13 +107,13 @@
   ];
 
   var test;
   runTest(function () {
     test = new PeerConnectionTest();
     test.setMediaConstraints([{audio: true, video: true}], [ ]);
     test.chain.replaceAfter("PC_LOCAL_GUM", steps);
     test.run();
-  }, true);
+  });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html
+++ b/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html
@@ -63,13 +63,13 @@
       errorCallback(SimpleTest.finish));
   };
 
   // No test for createOffer errors -- there's nothing we can do at this
   // level to evoke an error in createOffer.
 
   runTest(function () {
     testCreateAnswerError();
-  }, true);
+  });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html
+++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html
@@ -13,13 +13,13 @@
     bug: "850275",
     title: "Simple offer media constraint test with audio"
   });
 
   runTest(function() {
     var test = new PeerConnectionTest();
     test.setOfferConstraints({ mandatory: { OfferToReceiveAudio: true } });
     test.run();
-  }, true);
+  });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html
+++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html
@@ -13,13 +13,13 @@
     bug: "850275",
     title: "Simple offer media constraint test with video"
   });
 
   runTest(function() {
     var test = new PeerConnectionTest();
     test.setOfferConstraints({ mandatory: { OfferToReceiveVideo: true } });
     test.run();
-  }, true);
+  });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html
+++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html
@@ -16,13 +16,13 @@
 
   runTest(function() {
     var test = new PeerConnectionTest();
     test.setOfferConstraints({ mandatory: {
       OfferToReceiveVideo: true,
       OfferToReceiveAudio: true
     }});
     test.run();
-  }, true);
+  });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html
+++ b/dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html
@@ -59,17 +59,17 @@
             }, getFail(new Error));
             throw new Error("Expected");
           }, getFail(new Error));
           throw new Error("Expected");
         });
       }, getFail(new Error));
       throw new Error("Expected");
     });
-  }, 1);
+  });
 
   function finish() {
     window.onerror = oldOnError;
     is(error_count, 7, "Seven expected errors verified.");
     SimpleTest.finish();
   }
 
   function getFail(where) {
--- a/testing/mochitest/b2g.json
+++ b/testing/mochitest/b2g.json
@@ -200,16 +200,17 @@
     "dom/file/test/test_overlapping_lockedfiles.html":"",
     "dom/file/test/test_readonly_lockedfiles.html":"",
     "dom/file/test/test_success_events_after_abort.html":"",
     "dom/file/test/test_truncate.html":"",
     "dom/file/test/test_workers.html":"",
     "dom/file/test/test_write_read_data.html":"",
     "dom/imptests/editing/conformancetest/test_event.html":"",
     "dom/imptests/editing/conformancetest/test_runtest.html":"",
+    "dom/media/tests/mochitest":"",
     "dom/mobilemessage/tests/test_sms_basics.html":"",
     "dom/network/tests/test_networkstats_basics.html":"",
     "dom/permission/tests/test_permission_basics.html":"",
  
     "dom/tests/mochitest/ajax/offline/test_badManifestMagic.html":"",
     "dom/tests/mochitest/ajax/offline/test_badManifestMime.html":"",
     "dom/tests/mochitest/ajax/offline/test_bug445544.html":"",
     "dom/tests/mochitest/ajax/offline/test_bug460353.html":"",