summaryrefslogtreecommitdiffstats
path: root/dom/media/mediasource/test/test_OnEvents.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/mediasource/test/test_OnEvents.html')
-rw-r--r--dom/media/mediasource/test/test_OnEvents.html42
1 files changed, 42 insertions, 0 deletions
diff --git a/dom/media/mediasource/test/test_OnEvents.html b/dom/media/mediasource/test/test_OnEvents.html
new file mode 100644
index 0000000000..ae0f348ebe
--- /dev/null
+++ b/dom/media/mediasource/test/test_OnEvents.html
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>MSE: live seekable range</title>
+ <script 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(async (ms, v) => {
+ const receiveEvent = e => v["got" + e] = true;
+
+ const msevents = ["onsourceopen", "onsourceended"];
+ msevents.forEach(e => ms[e] = () => receiveEvent(e));
+
+ const sblistevents = ["onaddsourcebuffer", "onremovesourcebuffer"];
+ sblistevents.forEach(e => ms.sourceBuffers[e] = () => receiveEvent(e));
+
+ await once(ms, "sourceopen");
+ const sb = ms.addSourceBuffer("video/webm");
+
+ const sbevents = ["onupdatestart", "onupdate", "onupdateend", "onabort"];
+ sbevents.forEach(e => sb[e] = () => receiveEvent(e));
+
+ await fetchAndLoad(sb, "seek", [""], ".webm");
+ sb.appendBuffer(await fetchWithXHR("seek.webm"));
+ ms.removeSourceBuffer(sb); // will fire abort and removesourcebuffer
+ ms.endOfStream(); // will fire sourceended
+ await once(ms, "sourceended");
+ [...msevents, ...sbevents, ...sblistevents].forEach(e => ok(v["got" + e], "got " + e));
+ SimpleTest.finish();
+});
+
+</script>
+</pre>
+</body>
+</html>