OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Video element with src="" should invoke media element's load algorithm an d should fire "error" event. Network state should be NETWORK_NO_SOURCE and the e rror code should be MEDIA_ERR_SRC_NOT_SUPPORTED.</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 <script src="media-file.js"></script> |
6 <script src=video-test.js></script> | 6 <video></video> |
7 <script src=media-file.js></script> | 7 <script> |
8 <script> | 8 async_test(function(t) { |
9 var video = document.querySelector("video"); | |
9 | 10 |
10 function start() | 11 video.onloadstart = t.step_func(function() {}); |
11 { | 12 video.onloadedmetadata = t.step_func(function() {}); |
12 findMediaElement(); | 13 video.onloadeddata = t.step_func(function() {}); |
14 video.onabort = t.step_func(function() {}); | |
15 video.onemptied = t.step_func(function() {}); | |
13 | 16 |
14 waitForEvent("loadstart"); | 17 video.oncanplaythrough = t.step_func(function() { |
15 waitForEvent("loadedmetadata"); | 18 // video with empty src attribute. |
16 waitForEvent("loadeddata"); | 19 video.src = ""; |
fs
2016/06/25 17:12:03
Maybe it would be better to start out with onerror
Srirama
2016/06/26 05:41:55
Done.
| |
17 waitForEvent("abort"); | 20 }); |
18 waitForEvent("emptied"); | |
19 waitForEvent("canplaythrough", testLoad); | |
20 waitForEvent("error", errorEvent); | |
21 consoleWrite("** <video> with valid non-empty 'src' attrib ute**"); | |
22 video.src = findMediaFile("video", "content/test"); | |
23 } | |
24 | 21 |
25 function errorEvent() | 22 video.onerror = t.step_func_done(function() { |
fs
2016/06/25 17:12:03
Nit: Add 'event' as argument?
Srirama
2016/06/26 05:41:55
Done.
| |
26 { | 23 assert_equals(event.target, video); |
27 consoleWrite("<br>'error' event:"); | 24 assert_equals(video.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED); |
28 testExpected('event.target', video); | 25 assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE); |
29 testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SU PPORTED); | 26 }); |
30 testExpected("video.networkState", HTMLMediaElement.NETWORK_NO_S OURCE); | |
31 endTest(); | |
32 } | |
33 | 27 |
34 function testLoad() | 28 // video with valid non-empty "src" attribute. |
35 { | 29 video.src = findMediaFile("video", "content/test"); |
36 consoleWrite("<br>** <video> with empty src attribute**"); | 30 }); |
37 run('video.src = ""'); | 31 </script> |
38 } | |
39 </script> | |
40 </head> | |
41 <body onload="start()"> | |
42 <video width=320 height=60 controls></video> | |
43 <p> <video> element with src="" should invoke media element's load algorithm and should fire 'error' event. Network state should be NETWORK_NO_SOU RCE and set error to MEDIA_ERR_SRC_NOT_SUPPORTED.</p> | |
44 </body> | |
45 </html> | |
OLD | NEW |