summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_seek_negative.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_seek_negative.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_seek_negative.html')
-rw-r--r--dom/media/test/test_seek_negative.html77
1 files changed, 77 insertions, 0 deletions
diff --git a/dom/media/test/test_seek_negative.html b/dom/media/test/test_seek_negative.html
new file mode 100644
index 000000000..e87d1ae4b
--- /dev/null
+++ b/dom/media/test/test_seek_negative.html
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Media test: seeking to a negative time with readyState HAVE_NOTHING</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">
+
+var manager = new MediaTestManager;
+
+function startTest(test, token) {
+ var type = getMajorMimeType(test.type);
+ var v = document.createElement(type);
+ v.token = token;
+ manager.started(token);
+
+ // Seek to negative start time.
+ v.currentTime = -123;
+ is(v.readyState, v.HAVE_NOTHING, "readyState is HAVE_NOTHING");
+ ok(!v.seeking, "can't be seeking prior src defined");
+ is(v.currentTime, -123, "currentTime is original seek time");
+
+ v.src = test.name;
+
+ // Initialize running variables.
+ v._name = test.name;
+ v._seekStarted = false;
+ v._seekCompleted = false;
+ v._metadata = false;
+
+ var events = [ "suspend", "play", "canplay", "canplaythrough", "loadstart",
+ "loadedmetadata", "loadeddata", "playing", "ended", "error",
+ "stalled", "emptied", "abort", "waiting", "pause" ];
+ function logEvent(e) {
+ var v = e.target;
+ Log(e.target.token, "got " + e.type + " with currentTime = " + v.currentTime);
+ }
+ events.forEach(function(e) {
+ v.addEventListener(e, logEvent, false);
+ });
+
+ once(v, "seeking", function() {
+ v._seekStarted = true;
+ ok(v.currentTime >= 0, "currentTime should be positive");
+ });
+ once(v, "seeked", function() {
+ v._seekCompleted = true;
+ ok(v.currentTime >= 0, "currentTime should be positive");
+ });
+ once(v, "loadedmetadata", function() {
+ v._metadata = true;
+ ok(v.seeking, "element is seeking once readyState is HAVE_METADATA");
+ ok(v.currentTime >= 0, "currentTime should be positive");
+ });
+ once(v, "ended", function() {
+ ok(v._seekStarted, "seek should have started");
+ ok(v._seekCompleted, "seek should have completed");
+ ok(v._metadata, "loadedmetadata fired");
+ ok(v.currentTime >= 0, "currentTime should be positive");
+ removeNodeAndSource(v);
+ manager.finished(v.token);
+ });
+
+ v.play();
+}
+
+
+manager.runTests(gSmallTests, startTest);
+
+</script>
+</pre>
+</body>
+</html>