OLD | NEW |
1 <html> | 1 <html> |
2 <body> | 2 <body> |
3 | 3 |
4 <video controls></video> | 4 <video controls></video> |
5 | 5 |
6 <p> | 6 <p> |
7 Test 'timeupdate' events are posted while playing but not while paused. | 7 Test 'timeupdate' events are posted while playing but not while paused. |
8 </p> | 8 </p> |
9 <script src=media-file.js></script> | 9 <script src=media-file.js></script> |
| 10 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
| 11 (Please avoid writing new tests using video-test.js) --> |
10 <script src=video-test.js></script> | 12 <script src=video-test.js></script> |
11 <script> | 13 <script> |
12 setSrcByTagName("video", findMediaFile("video", "content/test")); | 14 setSrcByTagName("video", findMediaFile("video", "content/test")); |
13 | 15 |
14 var timeupdateEventCount = 0; | 16 var timeupdateEventCount = 0; |
15 var countWhilePlaying = 0; | 17 var countWhilePlaying = 0; |
16 | 18 |
17 function someTimeLater() | 19 function someTimeLater() |
18 { | 20 { |
19 if (countWhilePlaying != timeupdateEventCount) | 21 if (countWhilePlaying != timeupdateEventCount) |
20 failTest("'timeupdate' events posted after pausing"); | 22 failTest("'timeupdate' events posted after pausing"); |
21 endTest(); | 23 endTest(); |
22 } | 24 } |
23 | 25 |
24 function pause() | 26 function pause() |
25 { | 27 { |
26 countWhilePlaying = timeupdateEventCount; | 28 countWhilePlaying = timeupdateEventCount; |
27 setTimeout(someTimeLater, 400) ; | 29 setTimeout(someTimeLater, 400) ; |
28 consoleWrite(""); | 30 consoleWrite(""); |
29 } | 31 } |
30 | 32 |
31 function playing() | 33 function playing() |
32 { | 34 { |
33 setTimeout(function () { run("video.pause()"); }, 500) ; | 35 setTimeout(function () { run("video.pause()"); }, 500) ; |
34 consoleWrite(""); | 36 consoleWrite(""); |
35 } | 37 } |
36 | 38 |
37 mediaElement.addEventListener("timeupdate", function () { ++timeupdateEv
entCount; }); | 39 mediaElement.addEventListener("timeupdate", function () { ++timeupdateEv
entCount; }); |
38 | 40 |
39 waitForEvent('error'); | 41 waitForEvent('error'); |
40 waitForEvent("loadstart"); | 42 waitForEvent("loadstart"); |
41 waitForEvent("waiting"); | 43 waitForEvent("waiting"); |
42 waitForEvent("ratechange"); | 44 waitForEvent("ratechange"); |
43 waitForEvent("durationchange"); | 45 waitForEvent("durationchange"); |
44 waitForEvent("loadedmetadata"); | 46 waitForEvent("loadedmetadata"); |
45 waitForEvent("loadeddata"); | 47 waitForEvent("loadeddata"); |
46 waitForEvent("canplay"); | 48 waitForEvent("canplay"); |
47 waitForEvent("pause", pause); | 49 waitForEvent("pause", pause); |
48 waitForEvent("play"); | 50 waitForEvent("play"); |
49 waitForEvent("playing", playing); | 51 waitForEvent("playing", playing); |
50 | 52 |
51 run("video.play()"); | 53 run("video.play()"); |
52 consoleWrite(""); | 54 consoleWrite(""); |
53 </script> | 55 </script> |
54 | 56 |
55 </body> | 57 </body> |
56 </html> | 58 </html> |
OLD | NEW |