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

Unified Diff: third_party/WebKit/LayoutTests/media/controls-timeline.html

Issue 2021693002: Convert controls-* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nits Created 4 years, 7 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
Index: third_party/WebKit/LayoutTests/media/controls-timeline.html
diff --git a/third_party/WebKit/LayoutTests/media/controls-timeline.html b/third_party/WebKit/LayoutTests/media/controls-timeline.html
index f214c5d740ec1c2fbafaa0ed13356e2cdee49b28..85bdc6171bd4d30774e9d32cee02cc33cfb274c1 100644
--- a/third_party/WebKit/LayoutTests/media/controls-timeline.html
+++ b/third_party/WebKit/LayoutTests/media/controls-timeline.html
@@ -1,35 +1,29 @@
-<!doctype html>
-<html>
- <head>
- <title>media controls timeline</title>
- <script src="media-file.js"></script>
- <script src="media-controls.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>
- </head>
- <body>
- <video controls></video>
- <script>
- findMediaElement();
- video.src = findMediaFile("video", "content/test");
- waitForEvent("loadedmetadata", function()
- {
- testExpected("video.currentTime", 0);
- testExpected("video.seeking", false);
+<!DOCTYPE html>
+<title>Test seeking on the media controls timeline</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="media-file.js"></script>
+<script src="media-controls.js"></script>
+<video controls></video>
+<script>
+async_test(function(t) {
+ var video = document.querySelector("video");
+ video.src = findMediaFile("video", "content/test");
- // click the middle of the timeline
- var coords = mediaControlsButtonCoordinates(video, "timeline");
- eventSender.mouseMoveTo(coords[0], coords[1]);
- eventSender.mouseDown();
- eventSender.mouseUp();
+ video.onloadedmetadata = t.step_func_done(function() {
+ assert_equals(video.currentTime, 0);
+ assert_equals(video.seeking, false);
- testExpected("video.currentTime / video.duration", 0.4, '>');
- testExpected("video.currentTime / video.duration", 0.6, '<');
- testExpected("video.seeking", true);
+ // click the middle of the timeline
+ var coords = mediaControlsButtonCoordinates(video, "timeline");
+ eventSender.mouseMoveTo(coords[0], coords[1]);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
- endTest();
- });
- </script>
- </body>
-</html>
+ var normalizedTime = video.currentTime / video.duration;
+ assert_greater_than(normalizedTime, 0.4);
+ assert_less_than(normalizedTime, 0.6);
+ assert_equals(video.seeking, true);
+ });
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698