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_seek_out_of_range.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_seek_out_of_range.html')
-rw-r--r-- | dom/media/test/test_seek_out_of_range.html | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/dom/media/test/test_seek_out_of_range.html b/dom/media/test/test_seek_out_of_range.html new file mode 100644 index 000000000..210f6c3df --- /dev/null +++ b/dom/media/test/test_seek_out_of_range.html @@ -0,0 +1,82 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Media test: seeking off the end of a file</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> +<pre id="test"> +<script class="testbody" type="text/javascript"> + +if (navigator.platform.startsWith("Win")) { + SimpleTest.expectAssertions(0, 10); +} + +var manager = new MediaTestManager; + +// Test if the ended event works correctly. + +function startTest(e) { + var v = e.target; + checkMetadata(v._name, v, v._test); + is(v._loadedMetadata, false, "Should only receive one loadedmetadata event for " + v._name); + v._loadedMetadata = true; + v.currentTime = 3.0 * v.duration; +} + +function playbackEnded(e) { + var v = e.target; + // We should have dispatched an ended event when we seeked to the end of + // media, but we want the ended event which dispatches once playback has + // completed after the seek to the beginning. + if (!v._played) + return; + ok(v.ended, "Checking ended set after seeking to EOF and playing for " + v._name); + ok(!v._finished, "Should only hit the end once for " + v._name); + v._finished = true; + removeNodeAndSource(v); + manager.finished(v.token); +} + +function endSeek(e) { + var v = e.target; + if (v._seeked) + return; + v._seeked = true; + ok(Math.abs(v.duration - v.currentTime) < 0.1, + "Should be at end of media for " + v._name + " t=" + v.currentTime + " d=" + v.duration); + v.play(); +} + +function playing(e) { + e.target._played = true; +} + +function initTest(test, token) { + var type = getMajorMimeType(test.type); + var v = document.createElement(type); + v.preload = "auto"; + v.token = token; + manager.started(token); + v.src = test.name; + v._name = test.name; + v._finished = false; + v._test = test; + v._loadedMetadata = false; + v._seeked = false; + v._played = false; + v.addEventListener("loadedmetadata", startTest, false); + v.addEventListener("playing", playing, false); + v.addEventListener("seeked", endSeek, false); + v.addEventListener("ended", playbackEnded, false); + document.body.appendChild(v); +} + +manager.runTests(gSmallTests, initTest); + +</script> +</pre> +</body> +</html> |