upload tizen1.0 source
[framework/web/webkit-efl.git] / LayoutTests / media / video-src-none.html
1 <!DOCTYPE html>
2 <html>
3     <head>
4         <script src=video-test.js></script>
5         <script>
6             var state;
7
8             function someTimeLater()
9             {
10                 testExpected("state", "load() with missing 'src'");
11                 testExpected("videos[0].error", null);
12                 testExpected("videos[0].networkState", HTMLMediaElement.NETWORK_EMPTY);
13                 testExpected("videos[0].src", "");
14                 endTest();
15             }
16
17             function errorEvent()
18             {
19                 consoleWrite("'error' event:");
20                 testExpected("state", "load() with empty 'src'");
21                 testExpected(event.target, videos[1]);
22                 testExpected("videos[1].error.code", MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
23                 testExpected("videos[1].networkState", HTMLMediaElement.NETWORK_NO_SOURCE);
24
25                 consoleWrite("<br><i>Calling load() with no 'src' should NOT fire 'error' event, set network state to NETWORK_EMPTY.<" + "/i>");
26                 state = "load() with missing 'src'";
27                 videos[0].load();
28
29                 setTimeout(someTimeLater, 100) ;
30             }
31
32             function test()
33             {
34                 videos = document.querySelectorAll('video');
35
36                 consoleWrite("<br><i>Network state should remain in NETWORK_EMPTY with empty or missing 'src' attribute.<" + "/i>");
37                 consoleWrite("** &lt;video&gt; with no src attribute**");
38                 testExpected("videos[0].error", null);
39                 testExpected("videos[0].networkState", HTMLMediaElement.NETWORK_EMPTY);
40                 testExpected("videos[0].src", "");
41
42                 consoleWrite("** &lt;video&gt; with empty src attribute **");
43                 testExpected("videos[1].error", null);
44                 testExpected("videos[1].networkState", HTMLMediaElement.NETWORK_EMPTY);
45                 testExpected("relativeURL(videos[1].src)", "video-src-none.html");
46
47                 consoleWrite("<br><" + "i>Calling load() with empty 'src' should fire 'error' event, set network state to NETWORK_NO_SOURCE, and set error to MEDIA_ERR_SRC_NOT_SUPPORTED.<" + "/i>");
48                 state = "load() with empty 'src'";
49                 videos[1].load();
50             }
51         </script>
52     </head>
53
54     <body onload="setTimeout(test, 100)">
55         <video width=320 height=60 controls onerror="errorEvent()"></video>
56         <br>
57         <video width=320 height=60 controls src="" onerror="errorEvent()"></video>
58     </body>
59 </html>