OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <title>Test that the media element is in correct state after load fails.</title> | 2 <title>Test that the media element is in correct state after load fails.</title> |
3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <video></video> | 5 <video></video> |
6 <script> | 6 <script> |
7 async_test(function(t) { | 7 async_test(function(t) { |
8 var video = document.querySelector("video"); | 8 var video = document.querySelector("video"); |
9 assert_equals(video.error, null); | 9 assert_equals(video.error, null); |
10 | 10 |
11 video.oncanplaythrough = t.unreached_func(); | 11 video.oncanplaythrough = t.unreached_func(); |
12 | 12 |
13 video.onerror = t.step_func_done(function () { | 13 video.onerror = t.step_func_done(function () { |
14 assert_not_equals(video.error, null); | 14 assert_not_equals(video.error, null); |
15 assert_equals(video.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED); | 15 assert_equals(video.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED); |
16 | 16 |
| 17 // Actual message can vary greatly, so we only verify the attribute's ty
pe. |
| 18 assert_equals(typeof video.error.message, 'string', 'MediaError.message
type'); |
| 19 |
17 assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE); | 20 assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE); |
18 | 21 |
19 assert_true(isNaN(video.duration)); | 22 assert_true(isNaN(video.duration)); |
20 assert_equals(video.currentTime, 0); | 23 assert_equals(video.currentTime, 0); |
21 assert_equals(video.buffered.length, 0); | 24 assert_equals(video.buffered.length, 0); |
22 assert_equals(video.seekable.length, 0); | 25 assert_equals(video.seekable.length, 0); |
23 assert_equals(video.buffered.length, 0); | 26 assert_equals(video.buffered.length, 0); |
24 }); | 27 }); |
25 | 28 |
26 video.src = "content/does-not-exist.mpeg"; | 29 video.src = "content/does-not-exist.mpeg"; |
27 }); | 30 }); |
28 </script> | 31 </script> |
OLD | NEW |