OLD | NEW |
1 <html lang="en"> | 1 <html lang="en"> |
2 <head> | 2 <head> |
3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | 3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
4 <title><video> and <source> error test</title> | 4 <title><video> and <source> error test</title> |
| 5 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
| 6 (Please avoid writing new tests using video-test.js) --> |
5 <script src=video-test.js></script> | 7 <script src=video-test.js></script> |
6 | 8 |
7 <script> | 9 <script> |
8 | 10 |
9 var sources = []; | 11 var sources = []; |
10 var errorCount = 0; | 12 var errorCount = 0; |
11 var expectedErrorCount = 4; | 13 var expectedErrorCount = 4; |
12 | 14 |
13 function errorEvent(evt) | 15 function errorEvent(evt) |
14 { | 16 { |
15 consoleWrite(""); | 17 consoleWrite(""); |
16 | 18 |
17 var ndx; | 19 var ndx; |
18 for (ndx = 0; ndx < sources.length; ndx++) { | 20 for (ndx = 0; ndx < sources.length; ndx++) { |
19 if (sources[ndx] == evt.target) | 21 if (sources[ndx] == evt.target) |
20 break; | 22 break; |
21 } | 23 } |
22 | 24 |
23 var src = sources[ndx].getAttribute('src') == null ? "null" : "'
" + relativeURL(evt.target.src) + "'"; | 25 var src = sources[ndx].getAttribute('src') == null ? "null" : "'
" + relativeURL(evt.target.src) + "'"; |
24 if (sources[ndx] == evt.target) | 26 if (sources[ndx] == evt.target) |
25 logResult(true, "EVENT(error) from <source id='<em>" + ev
t.target.id + "</em>' src=<em>" + src + "</em>>"); | 27 logResult(true, "EVENT(error) from <source id='<em>" + ev
t.target.id + "</em>' src=<em>" + src + "</em>>"); |
26 else | 28 else |
27 logResult(false, "EVENT(error) from " + evt.target); | 29 logResult(false, "EVENT(error) from " + evt.target); |
28 | 30 |
29 testExpected("video.error", null); | 31 testExpected("video.error", null); |
30 | 32 |
31 if (++errorCount == expectedErrorCount) { | 33 if (++errorCount == expectedErrorCount) { |
32 consoleWrite(""); | 34 consoleWrite(""); |
33 setTimeout(endTest, 200); | 35 setTimeout(endTest, 200); |
34 } | 36 } |
35 } | 37 } |
36 | 38 |
37 function start() | 39 function start() |
38 { | 40 { |
39 document.addEventListener("error", errorEvent, true); | 41 document.addEventListener("error", errorEvent, true); |
40 | 42 |
41 sources = document.getElementsByTagName('source'); | 43 sources = document.getElementsByTagName('source'); |
42 | 44 |
43 findMediaElement(); | 45 findMediaElement(); |
44 } | 46 } |
45 </script> | 47 </script> |
46 </head> | 48 </head> |
47 | 49 |
48 <body> | 50 <body> |
49 | 51 |
50 <video onloadstart="start()" controls> | 52 <video onloadstart="start()" controls> |
51 <source id=missing-src type="video/blahblah"> | 53 <source id=missing-src type="video/blahblah"> |
52 <source id=bogus-type src=content/test.ogv type="video/blahblah"> | 54 <source id=bogus-type src=content/test.ogv type="video/blahblah"> |
53 <source id=empty-src src="" type="video/ogg"> | 55 <source id=empty-src src="" type="video/ogg"> |
54 <source id=no-extension-no-type src=nonexistent> | 56 <source id=no-extension-no-type src=nonexistent> |
55 </video> | 57 </video> |
56 | 58 |
57 <p>Test that 'error' events are fired from <source> element when i
t can not be used.</p> | 59 <p>Test that 'error' events are fired from <source> element when i
t can not be used.</p> |
58 | 60 |
59 </body> | 61 </body> |
60 </html> | 62 </html> |
OLD | NEW |