diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /dom/media/test/test_bug495145.html | |
parent | Initial commit. (diff) | |
download | firefox-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/test/test_bug495145.html')
-rw-r--r-- | dom/media/test/test_bug495145.html | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/dom/media/test/test_bug495145.html b/dom/media/test/test_bug495145.html new file mode 100644 index 0000000000..3686e10270 --- /dev/null +++ b/dom/media/test/test_bug495145.html @@ -0,0 +1,95 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=495145 +--> + +<head> + <title>Bug 495145 - pausing while ended shouldn't cause problems</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> + <script type="text/javascript" src="manifest.js"></script> + +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=495145">Mozilla Bug 495145</a> +<pre id="test"> +<script class="testbody" type="text/javascript"> + +var manager = new MediaTestManager; + +function start(e) { + e.target.play(); +} + +function ended1(e) { + var v = e.target; + if (v._finished) + return; + + ++v._endCount; + if (v._endCount == 2) { + ok(true, "Playing after pause while ended works for " + v._name); + v._finished = true; + v.removeEventListener("loadedmetadata", start); + v.removeEventListener("ended", ended1); + removeNodeAndSource(v); + manager.finished(v.token); + return; + } + + v.pause(); + v.play(); +} + +function ended2(e) { + var v = e.target; + if (v._finished) + return; + + v.pause(); + v.currentTime = 0; +} + +function seeked2(e) { + var v = e.target; + if (v._finished) + return; + + ok(v.paused, "Paused after seek after pause while ended for " + v._name); + v._finished = true; + v.removeEventListener("loadedmetadata", start); + v.removeEventListener("ended", ended2); + v.removeEventListener("seeked", seeked2); + removeNodeAndSource(v); + manager.finished(v.token); +} + +function createVideo(test, x, token) { + var v = document.createElement('video'); + v.preload = "metadata"; + v.token = token; + manager.started(token); + v.src = test.name; + v._name = test.name + "#" + x; + v._endCount = 0; + v._finished = false; + v.addEventListener("loadedmetadata", start); + v.addEventListener("ended", x == 1 ? ended1 : ended2); + if (x == 2) + v.addEventListener("seeked", seeked2); + document.body.appendChild(v); +} + +function startTest(test, token) { + createVideo(test, 1, token + "a"); + createVideo(test, 2, token + "b"); +} + +manager.runTests(gSmallTests, startTest); + + +</script> +</pre> +</body> +</html> |