dec894ce0772f77c59e11f8c317cc8e9da9ded2a
[WebKit-https.git] / LayoutTests / media / video-source-none-supported.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4     <title>no usable &lt;source&gt; test</title>
5     <script src=video-test.js></script>
6     <script>
7         document.addEventListener("error", errorEvent, true);
8
9         function errorEvent(evt)
10         {
11             findMediaElement();
12             consoleWrite("++ ERROR, src = " + relativeURL(event.target.src) + ", type = \"" + event.target.type + "\"");
13             testExpected("event.target.tagName", "SOURCE", "==");
14             
15             // Any more source elements pending?
16             var nextSource = event.target.nextSibling;
17             while (video.hasChildNodes()) {
18                 if (!nextSource || nextSource.tagName == "SOURCE")
19                     break;
20                 nextSource = nextSource.nextSibling;
21             }
22
23             if (!nextSource) {
24                 testExpected("event.target.parentNode.networkState", HTMLMediaElement.NETWORK_NO_SOURCE, "==");
25                 consoleWrite("");
26                 endTest();
27             } else {
28                 // Because the error event is fired asynchronously the network state can be either 
29                 // NETWORK_LOADING or NETWORK_NO_SOURCE, depending on whether or not 
30                 testExpected("event.target.parentNode.networkState", HTMLMediaElement.NETWORK_IDLE, ">");
31             }
32
33             consoleWrite("");
34         }
35     </script>
36
37 </head>
38 <body>
39     <video controls>
40         <source src="test.mp4" type="audio/x-chicken-face">
41         <source src="test.ogv" type="video/x-higglety-pigglety">
42         <source src="doesnotexist.mp4">
43     </video>
44
45     <p>1. Test that no usable &lt;source&gt; element leaves the media element with 
46     networkState == NETWORK_NO_SOURCE</p>
47 </body>
48 </html>