Bug 1172394 - Update test_streams_element_capture_reset.html per new seeking behavior. r=jib
☠☠ backed out by 7272d77d4e80 ☠ ☠
authorAndreas Pehrson <apehrson@mozilla.com>
Wed, 13 Nov 2019 08:56:22 +0000
changeset 501790 7e7baa73e1efeacd1d19dc95e3f79133d796daf4
parent 501789 c3bd415507e8bd658b1fe760da997015b098af3e
child 501791 94bd21d9b396a1d0ec3232a1afc0ea154879c491
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1172394
milestone72.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 1172394 - Update test_streams_element_capture_reset.html per new seeking behavior. r=jib Differential Revision: https://phabricator.services.mozilla.com/D52045
dom/media/test/test_streams_element_capture_reset.html
--- a/dom/media/test/test_streams_element_capture_reset.html
+++ b/dom/media/test/test_streams_element_capture_reset.html
@@ -1,12 +1,12 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <title>Test that reloading and seeking in a media element that's being captured doesn't crash</title>
+  <title>Test that reloading and seeking in a media element that's being captured behaves as expected</title>
   <script src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
   <script src="manifest.js"></script>
 </head>
 <body>
 <video id="v"></video>
 <video id="vout"></video>
 <video id="vout_untilended"></video>
@@ -44,71 +44,78 @@ function isWithinEps(a, b, msg) {
 function isGreaterThanOrEqualEps(a, b, msg) {
   ok(a >= b - 0.01,
      "Got " + a + ", expected at least " + b + "; " + msg);
 }
 
 async function startTest(test) {
   const seekTime = test.duration/2;
 
-  vout.onended = unexpected;
-
   v.src = test.name;
   v.name = test.name;
   vout.name = test.name;
   vout_untilended.name = test.name;
   v.preload = "metadata";
   await new Promise(r => v.onloadedmetadata = r);
 
   vout.srcObject = v.mozCaptureStream();
   vout.play();
 
   vout_untilended.srcObject = v.mozCaptureStreamUntilEnded();
   vout_untilended.play();
 
   v.play();
 
+  await new Promise(r => v.onended = r);
+  isGreaterThanOrEqualEps(v.currentTime, test.duration,
+    "checking v.currentTime at first 'ended' event");
+
   await Promise.all([
-    new Promise(r => v.onended = r),
+    new Promise(r => vout.onended = r),
     new Promise(r => vout_untilended.onended = r),
   ]);
 
   isGreaterThanOrEqualEps(vout.currentTime, test.duration,
     "checking vout.currentTime at first 'ended' event");
-  isGreaterThanOrEqualEps(v.currentTime, test.duration,
-    "checking v.currentTime at first 'ended' event");
-  ok(!vout.ended, "checking vout has not ended");
+  ok(vout.ended, "checking vout has actually ended");
   ok(vout_untilended.ended, "checking vout_untilended has actually ended");
 
-  v.pause();
+  vout_untilended.srcObject.onaddtrack = unexpected;
+  vout_untilended.onplaying = unexpected;
+  vout_untilended.onended = unexpected;
+
+  const voutPreSeekCurrentTime = vout.currentTime;
   v.currentTime = seekTime;
   await new Promise(r => v.onseeked = r);
 
-  isGreaterThanOrEqualEps(v.currentTime, seekTime, "Finished seeking");
-  isGreaterThanOrEqualEps(vout.currentTime, test.duration,
+  is(v.currentTime, seekTime, "Finished seeking");
+  is(vout.currentTime, voutPreSeekCurrentTime,
     "checking vout.currentTime has not changed after seeking");
 
-  vout_untilended.onplaying = unexpected;
-  vout_untilended.onended = unexpected;
   v.play();
+  vout.play();
 
   await new Promise(r => v.onended = r);
-
   isGreaterThanOrEqualEps(v.currentTime, test.duration,
     "checking v.currentTime at second 'ended' event");
+
+  await new Promise(r => vout.onended = r);
   isGreaterThanOrEqualEps(vout.currentTime,
     (test.duration - seekTime) + test.duration,
     "checking vout.currentTime after seeking and playing through again");
+
   v.src = test.name + "?1";
   v.play();
+  vout.play();
 
   await new Promise(r => v.onended = r);
-
   isGreaterThanOrEqualEps(v.currentTime, test.duration,
     "checking v.currentTime at third 'ended' event");
+
+  await new Promise(r => vout.onended = r);
   isGreaterThanOrEqualEps(vout.currentTime,
     (test.duration - seekTime) + test.duration*2,
     "checking vout.currentTime after seeking, playing through and reloading");
 }
 
 (async () => {
   SimpleTest.waitForExplicitFinish();
   try {