Bug 831782 - Small fixes for WebRTC mochitests. r=jesup
authorHenrik Skupin <hskupin@mozilla.com>
Thu, 17 Jan 2013 22:33:02 +0100
changeset 119186 f8bd1beec0f30ae5a25828d406fca7a9535b9a6b
parent 119185 f1ed018dd540ab88349fa798443043736af208f0
child 119187 bfc3b3ad287557f532bd565c354611b92fa4718c
push id21517
push userhskupin@mozilla.com
push dateThu, 17 Jan 2013 21:33:19 +0000
treeherdermozilla-inbound@f8bd1beec0f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs831782
milestone21.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 831782 - Small fixes for WebRTC mochitests. r=jesup
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
--- a/dom/media/tests/mochitest/head.js
+++ b/dom/media/tests/mochitest/head.js
@@ -34,14 +34,14 @@ function runTest(aCallback, desktopSuppo
     });
   }
 }
 
 /**
  * A callback function fired only under unexpected circumstances while
  * running the tests. Kills off the test as well gracefully.
  *
- * @param {String} obj the object fired back from the callback
+ * @param {object} aObj The object fired back from the callback
  */
-function unexpectedCallbackAndFinish(obj) {
-  ok(false, "Unexpected error callback with " + obj);
+function unexpectedCallbackAndFinish(aObj) {
+  ok(false, "Unexpected error callback with " + aObj);
   SimpleTest.finish();
 }
--- a/dom/media/tests/mochitest/test_getUserMedia_basicAudio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicAudio.html
@@ -7,40 +7,36 @@ https://bugzilla.mozilla.org/show_bug.cg
   <meta charset="utf-8">
   <title>mozGetUserMedia Basic Audio Test</title>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="head.js"></script>
   <script type="application/javascript" src="mediaStreamPlayback.js"></script>
 </head>
 <body>
-<audio id="testAudio"></audio>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=781534">mozGetUserMedia Basic Audio Test</a>
 <p id="display"></p>
 <div id="content" style="display: none">
-
+  <audio id="testAudio"></audio>
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-/**
- * Run a test to verify that we can complete a start and stop media playback
- * cycle for an audio LocalMediaStream on an audio HTMLMediaElement.
- */
-runTest(function () {
-  try {
-    navigator.mozGetUserMedia({audio: true, fake: true}, function(stream) {
-      var testAudio = document.getElementById('testAudio');
-      var audioStreamPlayback = new MediaStreamPlayback(testAudio, stream);
-      audioStreamPlayback.playMedia(10000, function() {
-				stream.stop();
-				SimpleTest.finish();
-			}, unexpectedCallbackAndFinish);
+  /**
+   * Run a test to verify that we can complete a start and stop media playback
+   * cycle for an audio LocalMediaStream on an audio HTMLMediaElement.
+   */
+  runTest(function () {
+    var testAudio = document.getElementById('testAudio');
+
+    navigator.mozGetUserMedia({audio: true, fake: true}, function (aStream) {
+      var playback = new MediaStreamPlayback(testAudio, aStream);
+      playback.playMedia(10000, function () {
+        aStream.stop();
+        SimpleTest.finish();
+      }, unexpectedCallbackAndFinish);
     }, unexpectedCallbackAndFinish);
-  } catch (err) {
-    unexpectedCallbackAndFinish(err);
-  }
-}, true);
+  }, true);
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_basicVideo.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicVideo.html
@@ -7,40 +7,36 @@ https://bugzilla.mozilla.org/show_bug.cg
   <meta charset="utf-8">
   <title>mozGetUserMedia Basic Video Test</title>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="head.js"></script>
   <script type="application/javascript" src="mediaStreamPlayback.js"></script>
 </head>
 <body>
-<video id="testVideo"></video>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=781534">mozGetUserMedia Basic Video Test</a>
 <p id="display"></p>
 <div id="content" style="display: none">
-
+  <video id="testVideo"></video>
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-/**
- * Run a test to verify that we can complete a start and stop media playback
- * cycle for an video LocalMediaStream on a video HTMLMediaElement.
- */
-runTest(function () {
-  try {
-    navigator.mozGetUserMedia({video: true, fake: true}, function(stream) {
-      var testVideo = document.getElementById('testVideo');
-      var videoStreamPlayback = new MediaStreamPlayback(testVideo, stream);
-      videoStreamPlayback.playMedia(10000, function() {
-				stream.stop();
-				SimpleTest.finish();
-			}, unexpectedCallbackAndFinish);
+  /**
+   * Run a test to verify that we can complete a start and stop media playback
+   * cycle for an video LocalMediaStream on a video HTMLMediaElement.
+   */
+  runTest(function () {
+    var testVideo = document.getElementById('testVideo');
+
+    navigator.mozGetUserMedia({video: true, fake: true}, function (aStream) {
+      var playback = new MediaStreamPlayback(testVideo, aStream);
+      playback.playMedia(10000, function () {
+        aStream.stop();
+        SimpleTest.finish();
+      }, unexpectedCallbackAndFinish);
     }, unexpectedCallbackAndFinish);
-  } catch (err) {
-    unexpectedCallbackAndFinish(err);
-  }
-}, true);
+  }, true);
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_basicVideoAudio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicVideoAudio.html
@@ -7,42 +7,37 @@ https://bugzilla.mozilla.org/show_bug.cg
   <meta charset="utf-8">
   <title>mozGetUserMedia Basic Video & Audio Test</title>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="head.js"></script>
   <script type="application/javascript" src="mediaStreamPlayback.js"></script>
 </head>
 <body>
-<video id="testVideoAudio"></video>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=781534">mozGetUserMedia Basic Video & Audio Test</a>
 <p id="display"></p>
 <div id="content" style="display: none">
-
+  <video id="testVideoAudio"></video>
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-/**
- * Run a test to verify that we can complete a start and stop media playback
- * cycle for a video and audio LocalMediaStream on a video HTMLMediaElement.
- */
-runTest(function () {
-  try {
+  /**
+   * Run a test to verify that we can complete a start and stop media playback
+   * cycle for a video and audio LocalMediaStream on a video HTMLMediaElement.
+   */
+  runTest(function () {
+    var testVideoAudio = document.getElementById('testVideoAudio');
+
     navigator.mozGetUserMedia({video: true, audio: true, fake: true},
-      function(stream) {
-      var testVideoAudio = document.getElementById('testVideoAudio');
-      var videoAudioStreamPlayback = new MediaStreamPlayback(testVideoAudio,
-        stream);
-      videoAudioStreamPlayback.playMedia(10000, function() {
-				stream.stop();
-				SimpleTest.finish();
-			}, unexpectedCallbackAndFinish);
+      function (aStream) {
+        var playback = new MediaStreamPlayback(testVideoAudio, aStream);
+        playback.playMedia(10000, function () {
+          aStream.stop();
+          SimpleTest.finish();
+        }, unexpectedCallbackAndFinish);
     }, unexpectedCallbackAndFinish);
-  } catch (err) {
-    unexpectedCallbackAndFinish(err);
-  }
-}, true);
+  }, true);
 
 </script>
 </pre>
 </body>
 </html>