OLD | NEW |
1 <p>Test that the media element is in correct state after load fails.</p> | 1 <!DOCTYPE HTML> |
2 <video controls></video> | 2 <title>Test that the media element is in correct state after load fails.</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 <video></video> |
6 <script> | 6 <script> |
| 7 async_test(function(t) { |
| 8 var video = document.querySelector("video"); |
| 9 assert_equals(video.error, null); |
7 | 10 |
8 consoleWrite(""); | 11 video.oncanplaythrough = t.unreached_func(); |
9 testExpected("video.error", null); | |
10 | 12 |
11 waitForEventAndTest("canplaythrough", "false"); | 13 video.onerror = t.step_func_done(function () { |
| 14 assert_not_equals(video.error, null); |
| 15 assert_equals(video.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED); |
12 | 16 |
13 waitForEvent("error", function () { | 17 assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE); |
14 testExpected("video.error", null, "!="); | |
15 testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED)
; | |
16 | 18 |
17 testExpected("video.networkState", HTMLMediaElement.NETWORK_NO_SOURCE); | 19 assert_true(isNaN(video.duration)); |
18 | 20 assert_equals(video.currentTime, 0); |
19 testExpected("isNaN(video.duration)", true); | 21 assert_equals(video.buffered.length, 0); |
20 testExpected("video.currentTime", 0); | 22 assert_equals(video.seekable.length, 0); |
21 testExpected("video.buffered.length", 0); | 23 assert_equals(video.buffered.length, 0); |
22 testExpected("video.seekable.length", 0); | |
23 testExpected("video.buffered.length", 0); | |
24 endTest(); | |
25 }); | 24 }); |
26 | 25 |
27 video.src = "content/does-not-exist.mpeg"; | 26 video.src = "content/does-not-exist.mpeg"; |
28 consoleWrite(""); | 27 }); |
29 </script> | 28 </script> |
OLD | NEW |