Bug 1119593 - Adding test for legacy navigator.mozGetUserMedia, r=drno
☠☠ backed out by a2984f1964f6 ☠ ☠
authorMartin Thomson <martin.thomson@gmail.com>
Tue, 27 Jan 2015 12:35:58 -0800
changeset 239509 e97ee52f78033c147d9e832a0f857d8e63b7552c
parent 239508 f7f0adc1879df19224511d9fbdb9f77a76aaf297
child 239510 46b5bb0665e9ef6331cc45ac3044e6bd86b28968
push id500
push userjoshua.m.grant@gmail.com
push dateThu, 29 Jan 2015 01:48:36 +0000
reviewersdrno
bugs1119593
milestone38.0a1
Bug 1119593 - Adding test for legacy navigator.mozGetUserMedia, r=drno Conflicts: dom/media/tests/mochitest/mochitest.ini
dom/media/tests/mochitest/mochitest.ini
dom/media/tests/mochitest/test_getUserMedia_callbacks.html
--- a/dom/media/tests/mochitest/mochitest.ini
+++ b/dom/media/tests/mochitest/mochitest.ini
@@ -38,16 +38,17 @@ skip-if = buildapp == 'b2g' || toolkit =
 [test_getUserMedia_basicWindowshare.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' # no windowshare on b2g/android
 [test_getUserMedia_basicVideoAudio.html]
 skip-if = (toolkit == 'gonk' && debug) # debug-only failure, turned an intermittent (bug 962579) into a permanant orange
 [test_getUserMedia_constraints.html]
 skip-if = toolkit == 'gonk' || toolkit == 'android' # Bug 907352, backwards-compatible behavior on mobile only
 [test_getUserMedia_constraints_mobile.html]
 skip-if = toolkit != 'gonk' && toolkit != 'android' # Bug 907352, backwards-compatible behavior on mobile only
+[test_getUserMedia_callbacks.html]
 [test_getUserMedia_gumWithinGum.html]
 [test_getUserMedia_playAudioTwice.html]
 [test_getUserMedia_playVideoAudioTwice.html]
 skip-if = (toolkit == 'gonk' && debug) # debug-only failure; bug 926558
 [test_getUserMedia_playVideoTwice.html]
 [test_getUserMedia_stopAudioStream.html]
 [test_getUserMedia_stopAudioStreamWithFollowupAudio.html]
 [test_getUserMedia_stopVideoAudioStream.html]
new file mode 100644
--- /dev/null
+++ b/dom/media/tests/mochitest/test_getUserMedia_callbacks.html
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=781534
+-->
+<head>
+  <meta charset="utf-8">
+  <title>navigator.mozGetUserMedia Callback 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>
+<a target="_blank">navigator.mozGetUserMedia Callback Test</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  <audio id="testAudio"></audio>
+</div>
+<pre id="test">
+<script type="application/javascript">
+  /**
+   * Check that the old fashioned callback-based function works.
+   */
+  runTest(function () {
+    var testAudio = document.getElementById('testAudio');
+    var constraints = {audio: true};
+
+    SimpleTest.waitForExplicitFinish();
+    navigator.mozGetUserMedia(constraints, aStream => {
+      checkMediaStreamTracks(constraints, aStream);
+
+      var playback = new LocalMediaStreamPlayback(testAudio, aStream);
+      return playback.playMedia(false)
+        .then(() => SimpleTest.finish(), generateErrorCallback());
+    }, generateErrorCallback());
+  });
+
+</script>
+</pre>
+</body>
+</html>