OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Test that calling load() with no "src" should not fire "error" event and
network state should be NETWORK_EMPTY.</title> |
3 <head> | 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 <video></video> |
6 <script src=video-test.js></script> | 6 <script> |
7 <script> | 7 async_test(function(t) { |
8 var state; | 8 var video = document.querySelector("video"); |
9 | 9 |
10 function someTimeLater() | 10 video.onerror = t.unreached_func(); |
11 { | 11 // Network state should remain in NETWORK_EMPTY with missing "src" attribute
. |
12 testExpected("state", "load() with missing 'src'"); | 12 verifyVideoState(); |
13 testExpected("videos[0].error", null); | 13 video.load(); |
14 testExpected("videos[0].networkState", HTMLMediaElement.NETWORK_
EMPTY); | |
15 testExpected("videos[0].src", ""); | |
16 endTest(); | |
17 } | |
18 | 14 |
19 function errorEvent() | 15 setTimeout(t.step_func_done(function() { |
20 { | 16 verifyVideoState(); |
21 failTest("<br><i>***'error' event fired***<" + "/i>"); | 17 }), 100); |
22 } | |
23 | 18 |
24 function test() | 19 function verifyVideoState() { |
25 { | 20 assert_equals(video.error, null); |
26 videos = document.querySelectorAll('video'); | 21 assert_equals(video.networkState, HTMLMediaElement.NETWORK_EMPTY); |
27 | 22 assert_equals(video.src, ""); |
28 consoleWrite("<br><i>Network state should remain in NETWORK_EMPT
Y with missing 'src' attribute.<" + "/i>"); | 23 } |
29 consoleWrite("** <video> with no src attribute**"); | 24 }); |
30 testExpected("videos[0].error", null); | 25 </script> |
31 testExpected("videos[0].networkState", HTMLMediaElement.NETWORK_
EMPTY); | |
32 testExpected("videos[0].src", ""); | |
33 | |
34 consoleWrite("<br><i>Calling load() with no 'src' should NOT fir
e 'error' event, set network state to NETWORK_EMPTY.<" + "/i>"); | |
35 state = "load() with missing 'src'"; | |
36 videos[0].load(); | |
37 | |
38 setTimeout(someTimeLater, 100) ; | |
39 } | |
40 </script> | |
41 </head> | |
42 | |
43 <body onload="setTimeout(test, 100)"> | |
44 <video width=320 height=60 controls onerror="errorEvent()"></video> | |
45 </body> | |
46 </html> | |
OLD | NEW |