Bug 1294605 - Add explicit test case. r=jib
☠☠ backed out by 439f4fa25eed ☠ ☠
authorAndreas Pehrson <pehrsons@gmail.com>
Tue, 30 Aug 2016 14:24:33 +0200
changeset 337846 2e6134a7093b791ee01de9bb9bc3b0228493f86c
parent 337845 a8c6adebc4ea62e369c40a0f562f65b33c81792a
child 337847 8a1756ac95395f9f3505fdde5305accce92b6a00
push id10033
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:50:26 +0000
treeherdermozilla-aurora@5dddbefdf759 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1294605
milestone51.0a1
Bug 1294605 - Add explicit test case. r=jib MozReview-Commit-ID: 9MJn7QQ9siZ
dom/media/tests/mochitest/mochitest.ini
dom/media/tests/mochitest/test_getUserMedia_trackCloneCleanup.html
--- a/dom/media/tests/mochitest/mochitest.ini
+++ b/dom/media/tests/mochitest/mochitest.ini
@@ -83,16 +83,17 @@ skip-if = toolkit == 'gonk' || buildapp 
 [test_getUserMedia_spinEventLoop.html]
 skip-if = (toolkit == 'gonk' || buildapp == 'mulet' && debug) # copied from basicAudio
 [test_getUserMedia_stopAudioStream.html]
 [test_getUserMedia_stopAudioStreamWithFollowupAudio.html]
 [test_getUserMedia_stopVideoAudioStream.html]
 [test_getUserMedia_stopVideoAudioStreamWithFollowupVideoAudio.html]
 [test_getUserMedia_stopVideoStream.html]
 [test_getUserMedia_stopVideoStreamWithFollowupVideo.html]
+[test_getUserMedia_trackCloneCleanup.html]
 [test_getUserMedia_trackEnded.html]
 [test_getUserMedia_peerIdentity.html]
 skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 1021776, too --ing slow on b2g)
 [test_peerConnection_addIceCandidate.html]
 [test_peerConnection_addtrack_removetrack_events.html]
 skip-if = toolkit == 'gonk' || buildapp == 'mulet' || android_version == '18' # b2g(Bug 960442, video support for WebRTC is disabled on b2g), android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_basicAudio.html]
 skip-if = toolkit == 'gonk' # B2G emulator is too slow to handle a two-way audio call reliably
new file mode 100644
--- /dev/null
+++ b/dom/media/tests/mochitest/test_getUserMedia_trackCloneCleanup.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <script type="application/javascript" src="mediaStreamPlayback.js"></script>
+</head>
+<body>
+<pre id="test">
+<script type="application/javascript">
+  "use strict";
+
+  createHTML({
+    title: "Stopping a MediaStreamTrack and its clones should deallocate the device",
+    bug: "1294605"
+  });
+
+  runTest(() => getUserMedia({audio: true, video: true}).then(stream => {
+    let clone = stream.clone();
+    stream.getTracks().forEach(t => t.stop());
+    stream.clone().getTracks().forEach(t => stream.addTrack(t));
+    is(stream.getTracks().filter(t => t.readyState == "live").length, 0,
+       "Cloning ended tracks should make them ended");
+    [...stream.getTracks(), ...clone.getTracks()].forEach(t => t.stop());
+
+    // Bug 1295352: better to be explicit about noGum here wrt future refactoring.
+    return noGum();
+  }));
+</script>
+</pre>
+</body>
+</html>