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> |