[Modern Media Controls] Turn media/modern-media-controls/ios-inline-media-controls...
[WebKit-https.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                         consoleWrite("<br>*** starting playback");
22                         run("video.play()"); 
23                         break;
24                     case "playing":
25                         if (++playingCount == 1) {
26                             consoleWrite("<br>*** changing playback rate");
27                             run("video.playbackRate = 2");
28                         }
29                         break;
30                     case "ratechange":
31                         if (++ratechangeCount == 1) {
32                             consoleWrite("<br>*** setting volume");
33                             run("video.volume = 0.5");
34                         }
35                         break;
36                     case "volumechange":
37                         consoleWrite("<br>*** pausing playback");
38                         run("video.pause()");
39                         break;
40                     case "pause":
41                         if(++pauseEventCount == 1) {
42                             consoleWrite("<br>*** seeking");
43                             run("video.currentTime = 5.6");
44                         }
45                         break;
46                     case "seeked":
47                         consoleWrite("<br>*** beginning playback");
48                         run("video.play()");
49                         break;
50                     case "ended":
51                         var mediaFile = findMediaFile("video", "content/garbage");
52                         consoleWrite("<br>*** played to end, setting 'src' to an invalid movie");
53                         run("progressEventCount = 0");
54                         video.src = mediaFile;
55                         break;
56                     case "progress":
57                         ++progressEventCount;
58                         break;
59                     case "error":
60                         testExpected('progressEventCount', 0);
61                         endTest();
62                         break;
63                     default:
64                         break;
65                 }
66             }
67
68             function start()
69             {
70                 setSrcByTagName("video", findMediaFile("video", "content/test"));
71                 findMediaElement();
72             }
73
74         </script>
75     </head>
76
77     <body onload="start()">
78
79         <video controls
80             onabort="eventHandler()"
81             oncanplay="eventHandler()"
82             oncanplaythrough="eventHandler()"
83             ondurationchange="eventHandler()"
84             onemptied="eventHandler()"
85             onended="eventHandler()"
86             onerror="eventHandler()"
87             onloadeddata="eventHandler()"
88             onloadedmetadata="eventHandler()"
89             onloadstart="eventHandler()"
90             onpause="eventHandler()"
91             onplay="eventHandler()"
92             onplaying="eventHandler()"
93             onprogress="eventHandler()"
94             onratechange="eventHandler()"
95             onseeked="eventHandler()"
96             onseeking="eventHandler()"
97             onstalled="eventHandler()"
98             onvolumechange="eventHandler()"
99             onwaiting="eventHandler()"
100             >
101         </video>
102
103     </body>
104 </html>