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

Unified Diff: third_party/WebKit/LayoutTests/media/video-double-seek-currentTime.html

Issue 2124223002: Convert video-[loop, double]* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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-double-seek-currentTime-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-double-seek-currentTime.html
diff --git a/third_party/WebKit/LayoutTests/media/video-double-seek-currentTime.html b/third_party/WebKit/LayoutTests/media/video-double-seek-currentTime.html
index b125afdcd304f71431b1d4859888a3d6c91f4af8..fe5e5336776aee135e0b07c6036c7e546248dbf2 100644
--- a/third_party/WebKit/LayoutTests/media/video-double-seek-currentTime.html
+++ b/third_party/WebKit/LayoutTests/media/video-double-seek-currentTime.html
@@ -1,84 +1,32 @@
<!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>
- <script>
- var seekCount = 0;
- var expectedSeek = 0;
- var video;
-
- function seeking(e)
- {
- consoleWrite("seeking " + e.target.currentTime.toFixed(2));
-
- doNextSeek(e.target);
- }
-
- function seeked(e)
- {
- consoleWrite("seeked " + e.target.currentTime.toFixed(2));
-
- video = e.target;
- var now = e.target.currentTime.toFixed(2);
- var expected = expectedSeek.toFixed(2);
- if (now != expected) {
- failTest("Expected " + expectedSeek + " got " + now);
- return;
- }
- endTest();
- }
-
- function doNextSeek(video)
- {
- consoleWrite("doNextSeek() " + seekCount);
-
- var newSeekPoint = -1;
- switch (seekCount) {
- case 0:
- newSeekPoint = 1;
- break;
- case 1:
- newSeekPoint = 1.5;
- break;
- case 2:
- newSeekPoint = 1.5;
- break;
- };
-
- if (newSeekPoint >= 0) {
- consoleWrite('doNextSeek() seeking to ' + newSeekPoint.toFixed(2));
- expectedSeek = newSeekPoint;
- video.currentTime = newSeekPoint;
- }
- seekCount++;
- }
-
- function loadedmetadata(e)
- {
- consoleWrite("loadedmetadata()");
- doNextSeek(e.target);
- }
-
- function onWindowLoad(e)
- {
- video = document.getElementById('video');
-
- video.src = findMediaFile("video", "content/test");
- video.addEventListener('seeking', seeking);
- video.addEventListener('seeked', seeked);
- video.addEventListener('loadedmetadata', loadedmetadata);
- video.load();
- }
-
- window.addEventListener('load', onWindowLoad, false);
- </script>
- </head>
- <body>
- <video controls id="video"></video>
- <p>Test currentTime values when setting from seeking event.</p>
- <br/>
- </body>
-</html>
+<title>Test double seek currentTime.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="media-file.js"></script>
+<video></video>
+<script>
+// Seek to same time twice and make sure "seeking" is fired twice and that
+// "seeked" is fired only once with the "currentTime" being the time set.
+async_test(function(t) {
+ var timeToTest = 1.5;
+ var video = document.querySelector("video");
+
+ var watcher = new EventWatcher(t, video, ["loadedmetadata", "seeking", "seeked"]);
+ watcher.wait_for("loadedmetadata").then(t.step_func(function() {
+ video.currentTime = 1.0;
+ return watcher.wait_for("seeking");
+ })).then(t.step_func(function() {
+ video.currentTime = timeToTest;
+ return watcher.wait_for("seeking");
+ })).then(t.step_func(function() {
+ video.currentTime = timeToTest;
+ return watcher.wait_for("seeking");
+ })).then(t.step_func(function() {
+ return watcher.wait_for("seeked");
+ })).then(t.step_func_done(function() {
+ assert_equals(video.currentTime, timeToTest);
+ }));
+
+ video.src = findMediaFile("video", "content/test");
+});
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/video-double-seek-currentTime-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698