Bug 1561268 - Make MST-end-manual.https.html spec compliant. r=jib
authorAndreas Pehrson <apehrson@mozilla.com>
Thu, 27 Jun 2019 01:28:49 +0000
changeset 480332 ed8e702696abc098b3770711990bb08a1c25da1f
parent 480331 55bdeb5e17ea3d6d8e3c5aef231e70c8d1c374d0
child 480333 f7b92e4c05a9bec3565fb39245f695daaa631e7f
push id36210
push userccoroiu@mozilla.com
push dateThu, 27 Jun 2019 16:27:01 +0000
treeherdermozilla-central@58f1d879059c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1561268
milestone69.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 1561268 - Make MST-end-manual.https.html spec compliant. r=jib Depends on D35784 Differential Revision: https://phabricator.services.mozilla.com/D35785
testing/web-platform/tests/mediacapture-streams/MediaStreamTrack-end-manual.https.html
--- a/testing/web-platform/tests/mediacapture-streams/MediaStreamTrack-end-manual.https.html
+++ b/testing/web-platform/tests/mediacapture-streams/MediaStreamTrack-end-manual.https.html
@@ -22,20 +22,29 @@ promise_test(async t => {
   const stream = await navigator.mediaDevices.getUserMedia({
     audio: true,
     video: true,
   });
 
   const vidTrack = stream.getVideoTracks()[0];
   assert_equals(vidTrack.readyState, "live",
     "The video track object is in live state");
+  const vidEnded = new Promise(r => vidTrack.onended = r);
   const audTrack = stream.getAudioTracks()[0];
   assert_equals(audTrack.readyState, "live",
     "The audio track object is in live state");
+  const audEnded = new Promise(r => audTrack.onended = r);
 
-  await new Promise(r => vidTrack.onended = r);
+  await Promise.race([vidEnded, audEnded]);
+  assert_equals(stream.getTracks().filter(t => t.readyState == "ended").length,
+    1, "Only one track is ended after first track's ended event");
+  assert_equals(stream.getTracks().filter(t => t.readyState == "live").length,
+    1, "One track is still live after first track's ended event");
+  assert_true(stream.active, "MediaStream is still active");
+
+  await Promise.all([vidEnded, audEnded]);
   assert_equals(vidTrack.readyState, "ended", "Video track ended as expected");
   assert_equals(audTrack.readyState, "ended", "Audio track ended as expected");
   assert_false(stream.active, "MediaStream has become inactive as expected");
 }, "Tests that MediaStreamTracks end properly on permission revocation");
 </script>
 </body>
 </html>