add test_seek_intensive.html. draft
authorJW Wang <jwwang@mozilla.com>
Mon, 16 Jan 2017 12:07:38 +0800
changeset 462366 7335925ca999f421e3699d28435906c02d6ce127
parent 462365 fdfbee5da5378ee79343191cd5fa8165ece921c9
child 462367 ec68e23b75cc3e4ffcc1304a8f74b8b7348bd8f6
push id41718
push userjwwang@mozilla.com
push dateTue, 17 Jan 2017 06:24:55 +0000
milestone53.0a1
add test_seek_intensive.html. MozReview-Commit-ID: EBTDqc5fX3e
dom/media/test/mochitest.ini
dom/media/test/test_seek_intensive.html
--- a/dom/media/test/mochitest.ini
+++ b/dom/media/test/mochitest.ini
@@ -855,16 +855,17 @@ skip-if = true # see bug 1319725
 [test_replay_metadata.html]
 [test_reset_events_async.html]
 [test_reset_src.html]
 [test_video_dimensions.html]
 [test_resolution_change.html]
 tags=capturestream
 [test_resume.html]
 skip-if = true # bug 1021673
+[test_seek_intensive.html]
 [test_seek_negative.html]
 [test_seek_nosrc.html]
 [test_seek_out_of_range.html]
 [test_seek-1.html]
 [test_seek-2.html]
 [test_seek-3.html]
 [test_seek-4.html]
 [test_seek-5.html]
new file mode 100644
--- /dev/null
+++ b/dom/media/test/test_seek_intensive.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test intensive seek in a short time</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<video id="v" src="gizmo.mp4" preload="metadata"></video>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+var seekCount = 0;
+const totalSeekCount = 10000;
+
+function startTest() {
+  v.currentTime = v.duration / 2;
+}
+
+function seekStarted() {
+  if (++seekCount == totalSeekCount) {
+    ok(true, `seeked ${totalSeekCount} times successfully!`);
+    SimpleTest.finish();
+  }
+  v.currentTime = v.duration * seekCount / totalSeekCount;
+}
+
+v.addEventListener("loadedmetadata", startTest);
+v.addEventListener("seeking", seekStarted);
+
+</script>
+</pre>
+</body>
+</html>