Bug 1298594 - [MSE] P1. Add mochitest to verify correct behavior. r=gerald, a=ritu
☠☠ backed out by 236385abdffc ☠ ☠
authorJean-Yves Avenard <jyavenard@mozilla.com>
Sat, 27 Aug 2016 00:08:38 +1200
changeset 350147 5a2f2368796f2a4f2ff0d48b588eb6a2d25dbdf6
parent 350146 800fc65da8d3f7fc4f4f0a9a559e8747891a56a4
child 350148 824368e159571df8e5eedee4d07652e9f7dcd17e
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald, ritu
bugs1298594, 1297036
milestone50.0a2
Bug 1298594 - [MSE] P1. Add mochitest to verify correct behavior. r=gerald, a=ritu 1- We shouldn't reach ended if we have a gap in the buffered range prior the end of the file (see bug 1297036) 2- Waiting should be fired when readyState goes below HAVE_FUTURE_DATA MozReview-Commit-ID: 18bEnkNpYvO
dom/media/mediasource/test/mochitest.ini
dom/media/mediasource/test/test_WaitingOnMissingDataEnded_mp4.html
--- a/dom/media/mediasource/test/mochitest.ini
+++ b/dom/media/mediasource/test/mochitest.ini
@@ -119,11 +119,13 @@ skip-if = ((os == "win" && os_version ==
 skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
 [test_TruncatedDuration.html]
 [test_TruncatedDuration_mp4.html]
 skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
 [test_WaitingOnMissingData.html]
 skip-if = true # Disabled due to bug 1124493 and friends. WebM MSE is deprioritized.
 [test_WaitingOnMissingData_mp4.html]
 skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
+[test_WaitingOnMissingDataEnded_mp4.html]
+skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
 [test_WaitingToEndedTransition_mp4.html]
 skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
 
new file mode 100644
--- /dev/null
+++ b/dom/media/mediasource/test/test_WaitingOnMissingDataEnded_mp4.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=windows-1252">
+  <title>MSE: |waiting| event when source data is missing</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="mediasource.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<pre id="test"><script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+runWithMSE(function(ms, el) {
+  el.controls = true;
+  once(ms, 'sourceopen').then(function() {
+    ok(true, "Receive a sourceopen event");
+    el.addEventListener("ended", function () {
+      ok(false, "ended should never fire");
+      SimpleTest.finish();
+    });
+    var videosb = ms.addSourceBuffer("video/mp4");
+    fetchAndLoad(videosb, 'bipbop/bipbop_video', ['init'], '.mp4')
+    .then(fetchAndLoad.bind(null, videosb, 'bipbop/bipbop_video', range(1, 5), '.m4s'))
+    .then(fetchAndLoad.bind(null, videosb, 'bipbop/bipbop_video', range(6, 8), '.m4s'))
+    .then(function() {
+      is(el.buffered.length, 2, "discontinuous buffered range");
+      ms.endOfStream();
+      return Promise.all([once(el, "durationchange"), once(ms, "sourceended")]);
+    }).then(function() {
+      // HTMLMediaElement fires 'waiting' if somebody invokes |play()| before the MDSM
+      // has notified it of available data. Make sure that we get 'playing' before
+      // we starting waiting for 'waiting'.
+      info("Invoking play()");
+      el.play();
+      return once(el, 'playing');
+    }).then(function() {
+      ok(true, "Video playing. It should play for a bit, then fire 'waiting'");
+      return once(el, 'waiting');
+    }).then(function() {
+      // waiting is fired when we start to play the last frame.
+      // 0.033334 is the duration of the last frame, + 0.000001 of fuzz.
+      // the next video frame, currentTime can be up to 1 frame's worth earlier than end of video.
+      isfuzzy(el.currentTime, videosb.buffered.end(0), 0.033334, "waiting was fired on gap");
+      SimpleTest.finish();
+    });
+  });
+});
+
+</script>
+</pre>
+</body>
+</html>