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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!DOCTYPE html>
2 <html> 2 <title>Test seeking on the media controls timeline</title>
3 <head> 3 <script src="../resources/testharness.js"></script>
4 <title>media controls timeline</title> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src="media-file.js"></script> 5 <script src="media-file.js"></script>
6 <script src="media-controls.js"></script> 6 <script src="media-controls.js"></script>
7 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 7 <video controls></video>
8 (Please avoid writing new tests using video-test.js) --> 8 <script>
9 <script src="video-test.js"></script> 9 async_test(function(t) {
10 </head> 10 var video = document.querySelector("video");
11 <body> 11 video.src = findMediaFile("video", "content/test");
12 <video controls></video>
13 <script>
14 findMediaElement();
15 video.src = findMediaFile("video", "content/test");
16 waitForEvent("loadedmetadata", function()
17 {
18 testExpected("video.currentTime", 0);
19 testExpected("video.seeking", false);
20 12
21 // click the middle of the timeline 13 video.onloadedmetadata = t.step_func_done(function() {
22 var coords = mediaControlsButtonCoordinates(video, "timeline"); 14 assert_equals(video.currentTime, 0);
23 eventSender.mouseMoveTo(coords[0], coords[1]); 15 assert_equals(video.seeking, false);
24 eventSender.mouseDown();
25 eventSender.mouseUp();
26 16
27 testExpected("video.currentTime / video.duration", 0.4, '>'); 17 // click the middle of the timeline
28 testExpected("video.currentTime / video.duration", 0.6, '<'); 18 var coords = mediaControlsButtonCoordinates(video, "timeline");
29 testExpected("video.seeking", true); 19 eventSender.mouseMoveTo(coords[0], coords[1]);
20 eventSender.mouseDown();
21 eventSender.mouseUp();
30 22
31 endTest(); 23 var normalizedTime = video.currentTime / video.duration;
32 }); 24 assert_greater_than(normalizedTime, 0.4);
33 </script> 25 assert_less_than(normalizedTime, 0.6);
34 </body> 26 assert_equals(video.seeking, true);
35 </html> 27 });
28 });
29 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698