OLD | NEW |
1 <html> | 1 <!DOCTYPE html> |
2 <body> | 2 <title>Test that play() from EMPTY network state triggers load() and async playi
ng event.</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"); |
| 10 assert_equals(video.networkState, HTMLMediaElement.NETWORK_EMPTY); |
3 | 11 |
4 <video controls></video> | 12 video.onloadstart = t.step_func(function() {}); |
5 <p>Test that play() from EMPTY network state triggers load() and async play
event.</p> | 13 video.onratechange = t.step_func(function() {}); |
6 <script src=media-file.js></script> | 14 video.onwaiting = t.step_func(function() {}); |
7 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 15 video.ondurationchange = t.step_func(function() {}); |
8 (Please avoid writing new tests using video-test.js) --> | 16 video.onloadedmetadata = t.step_func(function() {}); |
9 <script src=video-test.js></script> | 17 video.onloadeddata = t.step_func(function() {}); |
10 <script> | 18 video.oncanplay = t.step_func(function() {}); |
11 testExpected("video.networkState", HTMLMediaElement.NETWORK_EMPTY); | 19 video.onplay = t.step_func(function() {}); |
12 | 20 |
13 waitForEvent("loadstart"); | 21 video.onplaying = t.step_func_done(function () { |
14 waitForEvent("ratechange"); | 22 assert_false(video.paused); |
15 waitForEvent("waiting"); | 23 }); |
16 waitForEvent("ratechange"); | |
17 waitForEvent("durationchange"); | |
18 waitForEvent("loadedmetadata"); | |
19 waitForEvent("loadeddata"); | |
20 waitForEvent("canplay"); | |
21 waitForEvent("play"); | |
22 | 24 |
23 waitForEvent('playing', function () { testExpected("video.paused", false
); endTest(); } ); | 25 video.src = findMediaFile("video", "content/test"); |
24 | 26 video.play(); |
25 video.src = findMediaFile("video", "content/test"); | 27 }); |
26 run("video.play()"); | 28 </script> |
27 consoleWrite("SCRIPT DONE"); | |
28 </script> | |
29 | |
30 </body> | |
31 </html> | |
OLD | NEW |