summaryrefslogtreecommitdiffstats
path: root/dom/media/mediasource/test/test_RemoveSourceBuffer.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /dom/media/mediasource/test/test_RemoveSourceBuffer.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/mediasource/test/test_RemoveSourceBuffer.html')
-rw-r--r--dom/media/mediasource/test/test_RemoveSourceBuffer.html52
1 files changed, 52 insertions, 0 deletions
diff --git a/dom/media/mediasource/test/test_RemoveSourceBuffer.html b/dom/media/mediasource/test/test_RemoveSourceBuffer.html
new file mode 100644
index 0000000000..11c6a51deb
--- /dev/null
+++ b/dom/media/mediasource/test/test_RemoveSourceBuffer.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=windows-1252">
+ <title>MSE: check buffered status after removed all source buffer</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">
+
+const videoURL = "seek.webm";
+
+SimpleTest.waitForExplicitFinish();
+
+runWithMSE(async function(ms, el) {
+ info("- wait for sourceopen -");
+ await once(ms, "sourceopen");
+
+ info("- wait for fetching data -");
+ const arrayBuffer = await fetchWithXHR(videoURL);
+
+ info("- create source buffer and append data -");
+ const sourceBuffer = ms.addSourceBuffer("video/webm");
+ sourceBuffer.appendBuffer(arrayBuffer);
+ await once(sourceBuffer, "updateend");
+ is(ms.sourceBuffers.length, 1,
+ "the length of source buffers list is 1.");
+ is(ms.activeSourceBuffers.length, 1,
+ "the length of active source buffers list is 1.");
+ ok(ms.duration != 0, "duration is not 0.");
+ is(el.buffered.length, 1, "buffered range is 1.");
+
+ info("- remove source buffer from media source -");
+ ms.removeSourceBuffer(sourceBuffer);
+ await once(ms.sourceBuffers, "removesourcebuffer");
+ is(ms.sourceBuffers.length, 0, "source buffers list is empty.");
+ is(ms.activeSourceBuffers.length, 0, "active source buffers list is empty.");
+ ok(ms.duration != 0, "duration is not 0.");
+ is(el.buffered.length, 0,
+ "buffered range is empty since we don't have any source buffer.");
+
+ info("- call endOfStream -");
+ ms.endOfStream();
+ is(ms.duration, 0, "duraton is 0 since we don't have any source buffer.");
+ SimpleTest.finish();
+});
+
+</script>
+</pre>
+</body>
+</html>