Bug 1103188 - Always check tracks on getUserMedia(). r=jib
☠☠ backed out by 5ab984256b2d ☠ ☠
authorAndreas Pehrson <pehrsons@gmail.com>
Fri, 25 Sep 2015 23:23:31 +0800
changeset 297938 f0f33a8ef14cf0ad8fe8c5c2b7c89c7d284f24c0
parent 297937 dbe0ebdebad5449de2426e2c9407ef27c6e33ff2
child 297939 067d9325416abe5740fa5149e69344b02c41d69f
push id5392
push userraliiev@mozilla.com
push dateMon, 14 Dec 2015 20:08:23 +0000
treeherdermozilla-beta@16ce8562a975 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1103188
milestone44.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 1103188 - Always check tracks on getUserMedia(). r=jib
dom/media/tests/mochitest/head.js
dom/media/tests/mochitest/test_getUserMedia_audioCapture.html
dom/media/tests/mochitest/test_getUserMedia_basicAudio.html
dom/media/tests/mochitest/test_getUserMedia_basicScreenshare.html
dom/media/tests/mochitest/test_getUserMedia_basicVideo.html
dom/media/tests/mochitest/test_getUserMedia_basicVideoAudio.html
dom/media/tests/mochitest/test_getUserMedia_basicVideo_playAfterLoadedmetadata.html
dom/media/tests/mochitest/test_getUserMedia_basicWindowshare.html
--- a/dom/media/tests/mochitest/head.js
+++ b/dom/media/tests/mochitest/head.js
@@ -210,17 +210,18 @@ function createMediaElement(type, label)
  * Wrapper function for mediaDevices.getUserMedia used by some tests. Whether
  * to use fake devices or not is now determined in pref further below instead.
  *
  * @param {Dictionary} constraints
  *        The constraints for this mozGetUserMedia callback
  */
 function getUserMedia(constraints) {
   info("Call getUserMedia for " + JSON.stringify(constraints));
-  return navigator.mediaDevices.getUserMedia(constraints);
+  return navigator.mediaDevices.getUserMedia(constraints)
+    .then(stream => (checkMediaStreamTracks(constraints, stream), stream));
 }
 
 // These are the promises we use to track that the prerequisites for the test
 // are in place before running it.
 var setTestOptions;
 var testConfigured = new Promise(r => setTestOptions = r);
 
 function setupEnvironment() {
--- a/dom/media/tests/mochitest/test_getUserMedia_audioCapture.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_audioCapture.html
@@ -78,17 +78,16 @@ scriptsReady
       wavtone.loop = true;
       wavtone.play();
       acTone.play();
     });
 
     var constraints = {audio: {mediaSource: "audioCapture"}};
 
     return getUserMedia(constraints).then((stream) => {
-      checkMediaStreamTracks(constraints, stream);
       window.grip = stream;
       var analyser = new AudioStreamAnalyser(ac, stream);
       analyser.enableDebugCanvas();
       return analyser.waitForAnalysisSuccess(function(array) {
         // We want to find three frequency components here, around 1000, 5000
         // and 10000Hz. Frequency are logarithmic. Also make sure we have low
         // energy in between, not just a flat white noise.
         return (array[analyser.binIndexForFrequency(50)]    < 50 &&
--- a/dom/media/tests/mochitest/test_getUserMedia_basicAudio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicAudio.html
@@ -11,18 +11,16 @@
    * 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 = createMediaElement('audio', 'testAudio');
     var constraints = {audio: true};
 
     return getUserMedia(constraints).then(stream => {
-      checkMediaStreamTracks(constraints, stream);
-
       var playback = new LocalMediaStreamPlayback(testAudio, stream);
       return playback.playMedia(false);
     });
   });
 
 </script>
 </pre>
 </body>
--- a/dom/media/tests/mochitest/test_getUserMedia_basicScreenshare.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicScreenshare.html
@@ -25,18 +25,16 @@
       video: {
          mozMediaSource: "screen",
          mediaSource: "screen"
       },
       fake: false
     };
 
     return getUserMedia(constraints).then(stream => {
-      checkMediaStreamTracks(constraints, stream);
-
       var playback = new LocalMediaStreamPlayback(testVideo, stream);
       return playback.playMediaWithDeprecatedStreamStop(false);
     });
 
   });
 
 </script>
 </pre>
--- a/dom/media/tests/mochitest/test_getUserMedia_basicVideo.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicVideo.html
@@ -14,18 +14,16 @@
    * 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 = createMediaElement('video', 'testVideo');
     var constraints = {video: true};
 
     return getUserMedia(constraints).then(stream => {
-      checkMediaStreamTracks(constraints, stream);
-
       var playback = new LocalMediaStreamPlayback(testVideo, stream);
       return playback.playMedia(false);
     });
   });
 
 </script>
 </pre>
 </body>
--- a/dom/media/tests/mochitest/test_getUserMedia_basicVideoAudio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicVideoAudio.html
@@ -14,18 +14,16 @@
    * 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 = createMediaElement('video', 'testVideoAudio');
     var constraints = {video: true, audio: true};
 
     return getUserMedia(constraints).then(stream => {
-      checkMediaStreamTracks(constraints, stream);
-
       var playback = new LocalMediaStreamPlayback(testVideoAudio, stream);
       return playback.playMedia(false);
     });
   });
 
 </script>
 </pre>
 </body>
--- a/dom/media/tests/mochitest/test_getUserMedia_basicVideo_playAfterLoadedmetadata.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicVideo_playAfterLoadedmetadata.html
@@ -14,18 +14,16 @@
    * Run a test to verify that we will always get 'loadedmetadata' from a video
    * HTMLMediaElement playing a gUM MediaStream.
    */
   runTest(() => {
     var testVideo = createMediaElement('video', 'testVideo');
     var constraints = {video: true};
 
     return getUserMedia(constraints).then(stream => {
-      checkMediaStreamTracks(constraints, stream);
-
       var playback = new LocalMediaStreamPlayback(testVideo, stream);
       var video = playback.mediaElement;
 
       video.srcObject = stream;
       return new Promise(resolve => {
         ok(playback.mediaElement.paused,
            "Media element should be paused before play()ing");
         video.addEventListener('loadedmetadata', function() {
--- a/dom/media/tests/mochitest/test_getUserMedia_basicWindowshare.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicWindowshare.html
@@ -25,18 +25,16 @@
       video: {
          mozMediaSource: "window",
          mediaSource: "window"
       },
       fake: false
     };
 
     return getUserMedia(constraints).then(stream => {
-      checkMediaStreamTracks(constraints, stream);
-
       var playback = new LocalMediaStreamPlayback(testVideo, stream);
       return playback.playMediaWithDeprecatedStreamStop(false);
     });
 
   });
 
 </script>
 </pre>