OLD | NEW |
1 <video controls></video> | 1 <!DOCTYPE html> |
2 <p>Test that seeking attribute is true immediately after a seek, | 2 <title>Test that seeking attribute is true immediately after a seek, goes back t
o false when seeking completes, and that a "seeked" event is fired for each seek
.</title> |
3 goes back to false when seeking completes, and that a 'seeked' event | 3 <script src="../resources/testharness.js"></script> |
4 is fired for each seek | 4 <script src="../resources/testharnessreport.js"></script> |
5 </p> | 5 <script src="media-file.js"></script> |
6 <script src=media-file.js></script> | 6 <video></video> |
7 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | |
8 (Please avoid writing new tests using video-test.js) --> | |
9 <script src=video-test.js></script> | |
10 <script> | 7 <script> |
| 8 async_test(function(t) { |
| 9 var seekedCount = 0; |
| 10 var video = document.querySelector("video"); |
| 11 video.onwaiting = t.step_func(function() {}); |
| 12 video.onseeked = t.step_func(function() { |
| 13 ++seekedCount; |
11 | 14 |
12 var seekedCount = 0; | 15 assert_false(video.seeking); |
13 | 16 assert_equals(video.currentTime, seekedCount * 0.5); |
14 function seeked() | |
15 { | |
16 ++seekedCount; | |
17 consoleWrite(""); | |
18 | |
19 testExpected("video.seeking", false); | |
20 testExpected("video.currentTime", seekedCount * 0.5); | |
21 | 17 |
22 if (seekedCount == 3) { | 18 if (seekedCount == 3) { |
23 endTest(); | 19 t.done(); |
24 return; | 20 return; |
25 } | 21 } |
26 | 22 |
27 run("video.currentTime = " + (seekedCount + 1) * 0.5); | 23 video.currentTime = (seekedCount + 1) * 0.5; |
28 testExpected("video.seeking", true); | 24 assert_true(video.seeking); |
29 | 25 }); |
30 consoleWrite(""); | |
31 | |
32 } | |
33 | |
34 function canplaythrough() | |
35 { | |
36 if (seekedCount > 0) | |
37 return; | |
38 | |
39 run("video.currentTime = 0.5"); | |
40 consoleWrite(""); | |
41 } | |
42 | |
43 waitForEvent('waiting' ); | |
44 waitForEvent('seeked', seeked ); | |
45 waitForEventOnce('canplaythrough', canplaythrough); | |
46 | 26 |
47 video.src = findMediaFile("video", "content/test"); | 27 video.src = findMediaFile("video", "content/test"); |
48 </script> | 28 video.currentTime = 0.5; |
| 29 }); |
| 30 </script> |
OLD | NEW |