OLD | NEW |
1 <html> | 1 <!DOCTYPE html> |
2 <body> | 2 <title>Test that setting currentTime changes the time, and that "ended" event is
fired in a reasonable amount of time.</title> |
| 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="media-file.js"></script> |
| 6 <video></video> |
| 7 <script> |
| 8 async_test(function(t) { |
| 9 var video = document.querySelector("video"); |
3 | 10 |
4 <video controls></video> | 11 video.oncanplaythrough = t.step_func(function () { |
5 | 12 video.oncanplaythrough = null; |
6 <p>Test that setting currentTime changes the time, and that 'ended' event is
fired in a reasonable amount of time</p> | 13 video.onended = t.step_func_done(); |
7 | 14 assert_equals(video.currentTime, 0); |
8 <script src=media-file.js></script> | 15 video.currentTime = video.duration - 0.2; |
9 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | |
10 (Please avoid writing new tests using video-test.js) --> | |
11 <script src=video-test.js></script> | |
12 <script> | |
13 waitForEventOnce('canplaythrough', | |
14 function () { | |
15 waitForEventAndEnd('ended'); | |
16 | |
17 testExpected("video.currentTime", 0); | |
18 run("video.currentTime = video.duration - 0.2"); | |
19 }); | 16 }); |
20 | 17 |
21 waitForEvent('seeked', | 18 video.onseeked = t.step_func(function () { |
22 function () { | 19 assert_equals(video.currentTime.toFixed(2), (video.duration - 0.2).toFix
ed(2)); |
23 testExpected("video.currentTime.toFixed(2)", (video.duration - 0.2).toFi
xed(2)); | 20 video.play(); |
24 run("video.play()"); | |
25 consoleWrite(""); | |
26 }); | 21 }); |
27 | 22 |
28 video.src = findMediaFile("video", "content/test"); | 23 video.src = findMediaFile("video", "content/test"); |
29 </script> | 24 }); |
30 | 25 </script> |
31 </body> | |
32 </html> | |
OLD | NEW |