upload tizen1.0 source
[framework/web/webkit-efl.git] / LayoutTests / media / media-controls-invalid-url.html
1 <!DOCTYPE html>
2 <html>
3     <head>
4         <script src=media-file.js></script>
5         <script src=video-test.js></script>
6         <script>
7             var video;
8
9             function init()
10             {
11                 video = document.getElementsByTagName("video")[0];
12                 video.src = findMediaFile("video", "content/test");
13
14                 waitForEvent("canplaythrough", start);
15                 waitForEvent("seeked", seeked);
16                 waitForEvent("error", error);
17             }
18
19             function getTimeLineValue()
20             {
21                 var timelineContainer;
22                 var timelineValue;
23
24                 var controlsShadow = internals.shadowRoot(video).firstChild.firstChild;
25                 for (child = controlsShadow.firstChild; child; child = child.nextSibling)
26                     if (internals.shadowPseudoId(child) == "-webkit-media-controls-timeline-container") {
27                         timelineContainer = child;
28                         break;
29                     }
30
31                 if(!timelineContainer)
32                     throw "Faild to find -webkit-media-controls-timeline-container";
33
34                 for (child = timelineContainer.firstChild; child; child = child.nextSibling)
35                     if (internals.shadowPseudoId(child) == "-webkit-media-controls-timeline") {
36                         timelineValue = child.value;
37                         break;
38                     }
39
40                 if(!timelineContainer)
41                     throw "Faild to find -webkit-media-controls-timeline";
42
43                 return timelineValue;
44             }
45
46             function error()
47             {
48                 try {
49                     testExpected("getTimeLineValue()", video.currentTime);
50                     endTest();
51                 } catch (exception) {
52                     failTest(exception.description);
53                 }
54             }
55
56             function seeked()
57             {
58                 try {
59                     testExpected("getTimeLineValue()", video.currentTime);
60                 } catch (exception) {
61                     failTest(exception.description);
62                 }
63
64                 // Change video source to an invalid one
65                 video.src = "/invalid.mov";
66             }
67
68             function start()
69             {
70                 if (!window.layoutTestController)
71                     return;
72
73                 try {
74                     testExpected("getTimeLineValue()", video.currentTime);
75                 } catch (exception) {
76                     failTest(exception.description);
77                 }
78
79                 // Seeking to time value 1.0
80                 video.currentTime = 1.0;
81             }
82         </script>
83     </head>
84     <body onload="init()">
85         <p>This tests that media element controls are reset to their default state when the src is changed to an invalid url.</p>
86         <p>This test only runs in DRT!</p>
87         <video controls></video>
88         <div id="console"></div>
89     </body>
90 </html>