OLD | NEW |
1 <html> | 1 <html> |
2 <body> | 2 <body> |
3 <p>Tests that invalid media src url does not result in crash.</p> | 3 <p>Tests that invalid media src url does not result in crash.</p> |
| 4 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
| 5 (Please avoid writing new tests using video-test.js) --> |
4 <script src=video-test.js></script> | 6 <script src=video-test.js></script> |
5 <script> | 7 <script> |
6 var invalid_url = "!:/" + String.fromCharCode(0) + "%aa#aa"; | 8 var invalid_url = "!:/" + String.fromCharCode(0) + "%aa#aa"; |
7 var error_count = 0; | 9 var error_count = 0; |
8 | 10 |
9 function errorEvent() | 11 function errorEvent() |
10 { | 12 { |
11 error_count++; | 13 error_count++; |
12 if (error_count == 2) | 14 if (error_count == 2) |
13 { | 15 { |
14 testExpected("audio.error.code", MediaError.MEDIA_ERR_SRC_NO
T_SUPPORTED); | 16 testExpected("audio.error.code", MediaError.MEDIA_ERR_SRC_NO
T_SUPPORTED); |
15 testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NO
T_SUPPORTED); | 17 testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NO
T_SUPPORTED); |
16 testExpected("audio.networkState", HTMLMediaElement.NETWORK_
NO_SOURCE); | 18 testExpected("audio.networkState", HTMLMediaElement.NETWORK_
NO_SOURCE); |
17 testExpected("video.networkState", HTMLMediaElement.NETWORK_
NO_SOURCE); | 19 testExpected("video.networkState", HTMLMediaElement.NETWORK_
NO_SOURCE); |
18 endTest(); | 20 endTest(); |
19 } | 21 } |
20 } | 22 } |
21 | 23 |
22 var audio = document.createElement('audio'); | 24 var audio = document.createElement('audio'); |
23 var video = document.createElement('video'); | 25 var video = document.createElement('video'); |
24 audio.src = invalid_url; | 26 audio.src = invalid_url; |
25 video.src = invalid_url; | 27 video.src = invalid_url; |
26 audio.onerror = errorEvent; | 28 audio.onerror = errorEvent; |
27 video.onerror = errorEvent; | 29 video.onerror = errorEvent; |
28 document.body.appendChild(audio); | 30 document.body.appendChild(audio); |
29 document.body.appendChild(video); | 31 document.body.appendChild(video); |
30 </script> | 32 </script> |
31 </body> | 33 </body> |
32 </html> | 34 </html> |
OLD | NEW |