Bug 1320258. Part 1 - add a test case to test 'ended' is fired when seeking to the end of media. r?jya
MozReview-Commit-ID: 4cS9GiTYB7l
--- a/dom/media/mediasource/test/mochitest.ini
+++ b/dom/media/mediasource/test/mochitest.ini
@@ -55,16 +55,17 @@ skip-if = toolkit == 'android' #timeout
[test_BufferingWait_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_DrainOnMissingData_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_DurationChange.html]
[test_DurationUpdated.html]
[test_DurationUpdated_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
+[test_EndedEvent.html]
[test_EndOfStream.html]
[test_EndOfStream_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (toolkit == 'android')) # Not supported on xp and android 2.3
[test_Eviction_mp4.html]
skip-if = (os == "win" && os_version == "5.1") # Not supported on xp.
[test_FrameSelection.html]
[test_FrameSelection_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_EndedEvent.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>MSE: basic functionality</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) {
+ once(ms, 'sourceopen').then(function() {
+ var sb = ms.addSourceBuffer("video/webm");
+ fetchWithXHR("seek.webm", (buf) => sb.appendBuffer(new Uint8Array(buf)));
+ sb.addEventListener("updateend", () => ms.endOfStream());
+
+ // Test 'ended' is fired when seeking to the end of the media
+ // once the duration is known.
+ el.onloadedmetadata = () => {
+ el.currentTime = el.duration;
+ };
+ el.addEventListener("ended", SimpleTest.finish.bind(null));
+ });
+});
+
+</script>
+</pre>
+</body>
+</html>