OLD | NEW |
1 <video controls></video> | 1 <!DOCTYPE html> |
2 <p>Test that calling play() and pause() triggers async play, timeupdate and paus
e events.</p> | 2 <title>Test that calling play() and pause() triggers async play, timeupdate and
pause events.</title> |
3 <script src=media-file.js></script> | 3 <script src="../resources/testharness.js"></script> |
4 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 4 <script src="../resources/testharnessreport.js"></script> |
5 (Please avoid writing new tests using video-test.js) --> | 5 <script src="media-file.js"></script> |
6 <script src=video-test.js></script> | 6 <video></video> |
7 <script> | 7 <script> |
8 video.src = findMediaFile("video", "content/test.mp4"); | 8 async_test(function(t) { |
| 9 var eventCount = 0; |
| 10 var video = document.querySelector("video"); |
9 | 11 |
10 waitForEvent("loadstart"); | 12 video.onloadstart = t.step_func(function() {}); |
11 waitForEvent("ratechange"); | 13 video.onratechange = t.step_func(function() {}); |
12 waitForEvent("waiting"); | 14 video.onwaiting = t.step_func(function() {}); |
13 waitForEvent("ratechange"); | 15 video.ondurationchange = t.step_func(function() {}); |
14 waitForEvent("durationchange"); | 16 video.onloadedmetadata = t.step_func(function() {}); |
15 waitForEvent("loadedmetadata"); | 17 video.onloadeddata = t.step_func(function() {}); |
16 waitForEvent("loadeddata"); | 18 video.oncanplay = t.step_func(function() {}); |
17 waitForEvent("canplay"); | 19 video.oncanplaythrough = t.step_func(function() {}); |
18 waitForEvent("canplaythrough"); | |
19 waitForEvent("play"); | |
20 waitForEvent("timeupdate"); | |
21 waitForEvent('pause', function () { testExpected("video.paused", true); endT
est(); } ); | |
22 | 20 |
| 21 video.onplay = t.step_func(function() { |
| 22 eventCount++; |
| 23 }); |
23 | 24 |
24 run("video.play()"); | 25 video.ontimeupdate = t.step_func(function() { |
25 run("video.pause()"); | 26 eventCount++; |
| 27 }); |
26 | 28 |
27 consoleWrite("SCRIPT DONE"); | 29 video.onpause = t.step_func_done(function () { |
28 </script> | 30 assert_equals(eventCount, 2); |
| 31 assert_true(video.paused); |
| 32 }); |
| 33 |
| 34 video.src = findMediaFile("video", "content/test"); |
| 35 video.play(); |
| 36 video.pause(); |
| 37 }); |
| 38 </script> |
OLD | NEW |