diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/media/test/test_bug495145.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/test/test_bug495145.html')
-rw-r--r-- | dom/media/test/test_bug495145.html | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/dom/media/test/test_bug495145.html b/dom/media/test/test_bug495145.html new file mode 100644 index 000000000..ea7007ce8 --- /dev/null +++ b/dom/media/test/test_bug495145.html @@ -0,0 +1,99 @@ +<!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 type="text/javascript" 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"> +//longer timeout for slow platforms +if (isSlowPlatform()) { + SimpleTest.requestLongerTimeout(1.5); +} + +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, false); + v.removeEventListener("ended", ended1, false); + 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, false); + v.removeEventListener("ended", ended2, false); + v.removeEventListener("seeked", seeked2, false); + 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, false); + v.addEventListener("ended", x == 1 ? ended1 : ended2, false); + if (x == 2) + v.addEventListener("seeked", seeked2, false); + 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> |