Bug 1295352 - Update mediaElementCapture tests to stop all tracks before finishing. r=jib
authorAndreas Pehrson <pehrsons@gmail.com>
Mon, 29 Aug 2016 16:37:16 +0200
changeset 318930 907d83f3649296a187ab5e8b98475ad3b8b88bc2
parent 318929 f3dae14842ecbc89f405095c20faa6834ed10a04
child 318931 57f7b75e5a6210ba05e58cb6a117151e1d25f29e
push id30854
push userryanvm@gmail.com
push dateFri, 21 Oct 2016 21:08:02 +0000
treeherdermozilla-central@806054dd12bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1295352
milestone52.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 1295352 - Update mediaElementCapture tests to stop all tracks before finishing. r=jib MozReview-Commit-ID: GnfFt1vIbig
dom/media/tests/mochitest/test_getUserMedia_mediaElementCapture_audio.html
dom/media/tests/mochitest/test_getUserMedia_mediaElementCapture_video.html
--- a/dom/media/tests/mochitest/test_getUserMedia_mediaElementCapture_audio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_mediaElementCapture_audio.html
@@ -99,17 +99,19 @@ runTest(() => getUserMedia({audio: true}
     is(gUMAudioElement.srcObject.getTracks().length, 1,
        "A track should have been removed");
 
     return analyser.waitForAnalysisSuccess(array =>
       array[analyser.binIndexForFrequency(50)]              < 50 &&
       array[analyser.binIndexForFrequency(TEST_AUDIO_FREQ)] < 50 &&
       array[analyser.binIndexForFrequency(1500)]            < 50 &&
       array[analyser.binIndexForFrequency(2000)]            > 200 &&
-      array[analyser.binIndexForFrequency(2500)]            < 50);
+      array[analyser.binIndexForFrequency(2500)]            < 50)
+        .then(() => [gUMTrack, ...gUMAudioElement.srcObject.getTracks()]
+            .forEach(t => t.stop()));
   })
   .then(() => ok(true, "Test passed."))
   .catch(e => ok(false, "Test failed: " + e + (e.stack ? "\n" + e.stack : ""))));
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_mediaElementCapture_video.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_mediaElementCapture_video.html
@@ -105,15 +105,18 @@ runTest(() => getUserMedia({video: true,
     return checkVideoPaused(captureStreamElement).then(() => track);
   })
   .then(track => {
     info("Video paused. Changing source by track manipulation. Add first.");
     gUMVideoElement.srcObject.addTrack(track);
     gUMVideoElement.play();
     return checkVideoPlaying(captureStreamElement);
   })
-  .then(() => ok(true, "Test passed."))
+  .then(() => {
+    gUMVideoElement.srcObject.getTracks().forEach(t => t.stop());
+    ok(true, "Test passed.");
+  })
   .catch(e => ok(false, "Test failed: " + e + (e.stack ? "\n" + e.stack : ""))));
 
 </script>
 </pre>
 </body>
 </html>