upload tizen1.0 source
[framework/web/webkit-efl.git] / LayoutTests / media / event-attributes.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 ratechangeCount = 0;
8             var playingCount = 0;
9             var progressEventCount = 0;
10             var pauseEventCount = 0;
11
12             function eventHandler()
13             {
14                 // Don't log progress event since the number and order are platform
15                 // specific.
16                 if (event.type != "progress")
17                     consoleWrite("EVENT(" + event.type + ")");
18                 switch (event.type)
19                 {
20                     case "canplaythrough":
21                         testExpected('progressEventCount', 1, '>=');
22                         consoleWrite("<br>*** starting playback");
23                         run("video.play()"); 
24                         break;
25                     case "playing":
26                         if (++playingCount == 1) {
27                             consoleWrite("<br>*** changing playback rate");
28                             run("video.playbackRate = 2");
29                         }
30                         break;
31                     case "ratechange":
32                         if (++ratechangeCount == 1) {
33                             consoleWrite("<br>*** setting volume");
34                             run("video.volume = 0.5");
35                         }
36                         break;
37                     case "volumechange":
38                         consoleWrite("<br>*** pausing playback");
39                         run("video.pause()");
40                         break;
41                     case "pause":
42                         if(++pauseEventCount == 1) {
43                             consoleWrite("<br>*** seeking");
44                             run("video.currentTime = 5.6");
45                         }
46                         break;
47                     case "seeked":
48                         consoleWrite("<br>*** beginning playback");
49                         run("video.play()");
50                         break;
51                     case "ended":
52                         var mediaFile = findMediaFile("video", "content/garbage");
53                         consoleWrite("<br>*** played to end, setting 'src' to an invalid movie");
54                         run("progressEventCount = 0");
55                         video.src = mediaFile;
56                         break;
57                     case "progress":
58                         ++progressEventCount;
59                         break;
60                     case "error":
61                         testExpected('progressEventCount', 0);
62                         endTest();
63                         break;
64                     default:
65                         break;
66                 }
67             }
68
69             function start()
70             {
71                 setSrcByTagName("video", findMediaFile("video", "content/test"));
72                 findMediaElement();
73             }
74
75         </script>
76     </head>
77
78     <body onload="start()">
79
80         <video controls
81             onabort="eventHandler()"
82             oncanplay="eventHandler()"
83             oncanplaythrough="eventHandler()"
84             ondurationchange="eventHandler()"
85             onemptied="eventHandler()"
86             onended="eventHandler()"
87             onerror="eventHandler()"
88             onloadeddata="eventHandler()"
89             onloadedmetadata="eventHandler()"
90             onloadstart="eventHandler()"
91             onpause="eventHandler()"
92             onplay="eventHandler()"
93             onplaying="eventHandler()"
94             onprogress="eventHandler()"
95             onratechange="eventHandler()"
96             onseeked="eventHandler()"
97             onseeking="eventHandler()"
98             onstalled="eventHandler()"
99             onsuspend="eventHandler()"
100             onvolumechange="eventHandler()"
101             onwaiting="eventHandler()"
102             >
103         </video>
104
105     </body>
106 </html>