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