Bug 1345756: P1. Add mochitest. r?gerald draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 08 Mar 2017 23:09:52 +0100
changeset 495894 98651098cf932a7bbcfb22634b16ccc73d379c16
parent 495893 2ebc7b5d3f4b41b581efc45ef2be5df76d4fe01a
child 495895 f5d8938bd1553942d0c84326668159048a59acbd
push id48463
push userbmo:jyavenard@mozilla.com
push dateThu, 09 Mar 2017 13:06:11 +0000
reviewersgerald
bugs1345756
milestone55.0a1
Bug 1345756: P1. Add mochitest. r?gerald testing seeking to last audio frame buffered. MozReview-Commit-ID: A4Cr4OHs8qP
dom/media/mediasource/test/mochitest.ini
dom/media/mediasource/test/test_SeekToLastFrame_mp4.html
--- a/dom/media/mediasource/test/mochitest.ini
+++ b/dom/media/mediasource/test/mochitest.ini
@@ -104,16 +104,18 @@ skip-if = ((os == "win" && os_version ==
 [test_SeekableBeforeEndOfStreamSplit_mp4.html]
 skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
 [test_SeekNoData_mp4.html]
 skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
 [test_SeekedEvent_mp4.html]
 skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
 [test_SeekToEnd_mp4.html]
 skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
+[test_SeekToLastFrame_mp4.html]
+skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
 [test_SeekTwice_mp4.html]
 skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
 [test_Sequence_mp4.html]
 skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
 [test_SetModeThrows.html]
 [test_SplitAppendDelay.html]
 [test_SplitAppendDelay_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_SeekToLastFrame_mp4.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=windows-1252">
+  <title>MSE: Can seek to last frame</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");
+    var sb = ms.addSourceBuffer("video/mp4");
+    fetchAndLoad(sb, 'bipbop/bipbop_480_624kbps-video', ['init'], '.mp4')
+    .then(fetchAndLoad.bind(null, sb, 'bipbop/bipbop_480_624kbps-video', range(1, 3), '.m4s'))
+    .then(function() {
+      el.play();
+      // let seek to the last audio frame.
+      el.currentTime = 1.532517;
+      return once(el, 'seeked');
+    })
+    .then(function() {
+      ok(true, "seek completed");
+      ms.endOfStream();
+      return once(el, 'ended');
+    }).then(function() {
+      SimpleTest.finish();
+    });
+  });
+});
+
+</script>
+</pre>
+</body>
+</html>