Bug 1172394 - Update test_streams_element_capture_reset.html per new seeking behavior. r=jib
authorAndreas Pehrson <apehrson@mozilla.com>
Wed, 13 Nov 2019 22:40:00 +0000
changeset 501957 9d3f254944454ae286c3b8c02cc65ebfc1fd35b8
parent 501956 bff56fd97a88ed14df3dda90e57e2bda23b5275e
child 501958 4f27806289e24d59e576305d93dbf1305c0e4ba3
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 {