summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_fastSeek-forwards.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/media/test/test_fastSeek-forwards.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-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_fastSeek-forwards.html')
-rw-r--r--dom/media/test/test_fastSeek-forwards.html77
1 files changed, 77 insertions, 0 deletions
diff --git a/dom/media/test/test_fastSeek-forwards.html b/dom/media/test/test_fastSeek-forwards.html
new file mode 100644
index 000000000..7c16e5151
--- /dev/null
+++ b/dom/media/test/test_fastSeek-forwards.html
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1022913
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1022913</title>
+ <script type="application/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=1022913">Mozilla Bug 1022913</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+ <script type="application/javascript">
+
+ // Test that if we're doing a fastSeek() forwards that we don't end up
+ // seeking backwards. This can happen if the keyframe before the seek
+ // target is before the current playback position. We'd prefer to seek to
+ // the keyframe after the seek target in this case, but we don't implement
+ // this yet (bug 1026330).
+ var manager = new MediaTestManager;
+
+ var onSecondSeekComplete = function(event) {
+ var v = event.target;
+ v.removeEventListener("seeked", onSecondSeekComplete);
+ ok(v.currentTime >= v.firstSeekTarget, v.name + " seek never go backwards. time=" + v.currentTime + " firstSeekTarget=" + v.firstSeekTarget + " secondSeekTarget=" + v.secondSeekTarget);
+ manager.finished(v.token);
+ removeNodeAndSource(v);
+ };
+
+ var onFirstSeekComplete = function(event) {
+ var v = event.target;
+ v.removeEventListener("seeked", onFirstSeekComplete);
+ // Seek to 75% of the way between the start and the first keyframe
+ // using fastSeek. We then test that the currentTime doesn't drop back
+ // to the previous keyframe, currentTime should go forwards.
+ v.addEventListener("seeked", onSecondSeekComplete);
+ v.secondSeekTarget = v.keyframes[1] * 0.75;
+ v.fastSeek(v.secondSeekTarget);
+ }
+
+ var onLoadedMetadata = function(event) {
+ // Seek to the mid-point between the start and the first keyframe.
+ var v = event.target;
+ v.removeEventListener("loadedmetadata", onLoadedMetadata);
+ v.addEventListener("seeked", onFirstSeekComplete);
+ v.firstSeekTarget = v.keyframes[1] * 0.5;
+ v.currentTime = v.firstSeekTarget;
+ }
+
+ function startTest(test, token) {
+ manager.started(token);
+ v = document.createElement("video");
+ v.src = test.name;
+ v.name = test.name;
+ v.preload = "metadata";
+ v.token = token;
+ v.target = 0;
+ v.keyframes = test.keyframes;
+ v.keyframeIndex = 0;
+ ok(v.keyframes.length >= 2, v.name + " - video should have at least two sync points");
+ v.addEventListener("loadedmetadata", onLoadedMetadata);
+ document.body.appendChild(v);
+ }
+
+ manager.runTests(gFastSeekTests, startTest);
+
+ </script>
+</body>
+</html>