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