[Modern Media Controls] Turn media/modern-media-controls/ios-inline-media-controls...
[WebKit-https.git] / LayoutTests / media / media-controls-cancel-events.html
1 <!DOCTYPE html><!-- webkit-test-runner [ enableModernMediaControls=false ] -->
2 <html>
3     <head>
4         <script src=media-file.js></script>
5         <script src=media-controls.js></script>
6         <script src=video-test.js></script>
7         <script>
8             function bodyClick(event)
9             {
10                 consoleWrite("");
11                 failTest("'click' event handler on video parent triggered!");
12             }
13
14             function moveMouseToControlElement(elementName, click)
15             {
16                 var controlLocation;
17                 try {
18                     controlLocation = mediaControlsButtonCoordinates(video, elementName);
19                 } catch (exception) {
20                     failTest(exception.description);
21                     return;
22                 }
23
24                 eventSender.mouseMoveTo(controlLocation[0], controlLocation[1]);
25                 if (click) {
26                     eventSender.mouseDown();
27                     eventSender.mouseUp();
28                 }
29             }
30
31             function canplaythrough()
32             {
33                 consoleWrite("<br>clicking in the play button<br>");
34                 moveMouseToControlElement("play-button", true);
35             }
36
37             function playing()
38             {
39                 consoleWrite("<br>clicking in mute button<br>");
40                 moveMouseToControlElement("mute-button", true);
41             }
42
43             function volumechange()
44             {
45                 consoleWrite("<br>clicking in closed caption button<br>");
46                 moveMouseToControlElement("toggle-closed-captions-button", true);
47                 window.setTimeout(finish, 100);
48             }
49
50             function finish()
51             {
52                 consoleWrite("100ms timer fired<br>");
53                 endTest();
54             }
55
56             function start()
57             {
58                 findMediaElement();
59
60                 waitForEventOnce("canplaythrough", canplaythrough);
61                 waitForEventOnce("playing", playing);
62                 waitForEventOnce('volumechange', volumechange);
63
64                 video.src = findMediaFile("video", "content/test");
65
66                 if (!window.internals) {
67                     failTest('This test requires window.internals.');
68                     return;
69                 }
70             }
71         </script>
72     </head>
73
74     <body onload="start()" onclick="bodyClick()">
75         <p>Test that 'click' events in the media controls don't propogate to the page.</p>
76         <p>This test only runs in DRT!</p>
77         <video controls>
78             <track src="track/captions-webvtt/captions-fast.vtt" kind="captions" srclang="en">
79         </video>
80     </body>
81 </html>