OLD | NEW |
1 <video controls></video> | 1 <!DOCTYPE html> |
2 <script src=media-file.js></script> | 2 <title>Test media element readystate value on load.</title> |
3 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 3 <script src="../resources/testharness.js"></script> |
4 (Please avoid writing new tests using video-test.js) --> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <script src=video-test.js></script> | 5 <script src="media-file.js"></script> |
| 6 <video></video> |
6 <script> | 7 <script> |
7 function testReadyState(expected, endit, op) | 8 async_test(function(t) { |
8 { | 9 var video = document.querySelector("video"); |
9 testExpected("video.readyState", expected, op); | 10 assert_equals(video.readyState, HTMLMediaElement.HAVE_NOTHING); |
10 if (endit) | 11 video.onloadstart = t.step_func(function() {}); |
11 endTest(); | 12 video.onloadedmetadata = t.step_func(function() {}); |
12 } | 13 video.onloadeddata = t.step_func(function() {}); |
| 14 video.oncanplay = t.step_func(function() {}); |
| 15 video.onplay = t.unreached_func(); |
| 16 video.onplaying = t.unreached_func(); |
13 | 17 |
14 testExpected("video.readyState", HTMLMediaElement.HAVE_NOTHING); | 18 video.oncanplaythrough = t.step_func_done(function () { |
15 waitForEvent("loadstart"); | 19 assert_equals(video.readyState, HTMLMediaElement.HAVE_ENOUGH_DATA); |
16 waitForEvent("loadedmetadata"); | 20 }); |
17 waitForEvent("loadeddata"); | |
18 waitForEvent("canplay"); | |
19 waitForEventAndFail("play"); | |
20 waitForEventAndFail("playing"); | |
21 waitForEvent("canplaythrough", function () { testReadyState(HTMLMediaElement
.HAVE_ENOUGH_DATA, true ); } ); | |
22 | 21 |
23 video.src = findMediaFile("video", "content/test"); | 22 video.src = findMediaFile("video", "content/test"); |
24 </script> | 23 }); |
| 24 </script> |
OLD | NEW |