Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: third_party/WebKit/LayoutTests/media/video-seek-by-small-increment.html

Issue 2091973003: Convert video-seek* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/video-seek-by-small-increment-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/media/video-seek-by-small-increment.html
diff --git a/third_party/WebKit/LayoutTests/media/video-seek-by-small-increment.html b/third_party/WebKit/LayoutTests/media/video-seek-by-small-increment.html
index e10ff675b448cb1102617f2e014b5aa35f23c45b..ecd3e797a87d86c6330641285efecb7d968416d1 100644
--- a/third_party/WebKit/LayoutTests/media/video-seek-by-small-increment.html
+++ b/third_party/WebKit/LayoutTests/media/video-seek-by-small-increment.html
@@ -1,60 +1,39 @@
<!DOCTYPE HTML>
-<html>
- <head>
- <script src=media-file.js></script>
- <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
- (Please avoid writing new tests using video-test.js) -->
- <script src=video-test.js></script>
+<title>Test seeking by very small increments.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="media-file.js"></script>
+<video></video>
+<script>
+async_test(function(t) {
+ var seekedEventCount = 0;
+ var increment = 0;
+ var video = document.querySelector("video");
- <script>
- var seekedEventCount = 0;
- var increment = 0;
+ video.currentTime = seekIncrement();
- function seekIncrement()
- {
- // We want to verify that seeking by an increment smaller than the test movie's time scale
- // (the smallest unit of time in that file) succeeds. test.mp4 has a time scale of 2500,
- // 0.0004 seconds, so start with that and decrease by half each time.
- if (!increment)
- increment = 0.0004;
- else
- increment /= 2;
- return increment;
- }
+ video.onseeked = t.step_func(function() {
+ if (++seekedEventCount == 8) {
+ t.done();
+ return;
+ }
+ video.currentTime += seekIncrement();
+ });
- function seeked()
- {
- if (++seekedEventCount == 8) {
- consoleWrite("");
- endTest();
- return;
- }
- attemptSeek();
- }
+ function seekIncrement() {
+ // We want to verify that seeking by an increment smaller than the test movie's
+ // time scale(the smallest unit of time in that file) succeeds. test.mp4 has a time // scale of 2500, 0.0004 seconds, so start with that and decrease by half each time.
+ if (!increment)
+ increment = 0.0004;
+ else
+ increment /= 2;
+ return increment;
+ }
- function attemptSeek()
- {
- var increment = seekIncrement();
- consoleWrite("<br>** Seeking by " + increment);
- video.currentTime += increment;
- }
+ video.onseeking = t.step_func(function() {});
+ video.onplay = t.step_func(function() {});
+ video.onpause = t.step_func(function() {});
- function start()
- {
- findMediaElement();
- video.src = findMediaFile("video", "content/test");
-
- waitForEventOnce('canplaythrough', attemptSeek);
- waitForEvent('seeked', seeked);
- waitForEvent('seeking');
- waitForEvent('play');
- waitForEvent('pause');
- }
- </script>
- </head>
- <body>
- <video controls></video>
- <p>Test seeking by very small increments.</p>
- <script>start()</script>
- </body>
-</html>
+ video.src = findMediaFile("video", "content/test");
+});
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/video-seek-by-small-increment-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698