diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /dom/media/mediasource/test/test_OnEvents.html | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/mediasource/test/test_OnEvents.html')
-rw-r--r-- | dom/media/mediasource/test/test_OnEvents.html | 42 |
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> |