2011-02-24 Victoria Kirst <vrk@google.com>
[WebKit.git] / LayoutTests / media / invalid-media-url-crash.html
1 <html>
2     <body>
3         <p>Tests that invalid media src url does not result in crash.</p>
4         <script src=video-test.js></script>
5         <script>
6             var invalid_url = "http:aa" + String.fromCharCode(0) + "%aa#aa";
7             var error_count = 0;
8
9             function errorEvent()
10             {
11                 error_count++;
12                 if (error_count == 2)
13                 {
14                     testExpected("audio.error.code", MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
15                     testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
16                     testExpected("audio.networkState", HTMLMediaElement.NETWORK_NO_SOURCE);
17                     testExpected("video.networkState", HTMLMediaElement.NETWORK_NO_SOURCE);
18                     endTest();
19                 }
20             }
21
22             var audio = document.createElement('audio');
23             var video = document.createElement('video');
24             audio.src = invalid_url;
25             video.src = invalid_url;
26             audio.onerror = errorEvent;
27             video.onerror = errorEvent;
28             document.body.appendChild(audio);
29             document.body.appendChild(video);
30         </script>
31     </body>
32 </html>