[Modern Media Controls] Turn media/modern-media-controls/ios-inline-media-controls...
[WebKit-https.git] / LayoutTests / media / video-controls-captions-trackmenu-hide-on-click.html
1 <!DOCTYPE html>
2 <html>
3     <head>
4         <title>Selecting from a list of tracks</title>
5         <script src="media-controls.js"></script>
6         <script src="media-file.js"></script>
7         <script src="video-test.js"></script>
8         <script src="trackmenu-test.js"></script>
9         <script>
10             var displayStyle;
11
12             if (window.testRunner)
13                 testRunner.dumpAsText();
14
15             function startTest()
16             {
17                 // By this point the captions menu should be visible. Check that it is.
18                 window.setTimeout(testMenuIsVisible, 100);
19             }
20
21             function testMenuIsVisible()
22             {
23                 var trackListElement = getTrackListElement();
24                 displayStyle = window.getComputedStyle(trackListElement.parentNode).display;
25                 consoleWrite("*** Track menu should be visible " + displayStyle);
26                 testExpected("displayStyle", "block");
27                 // Now, click in the top corner of the video element in order to
28                 // dismiss the menu.
29                 var boundingRect = video.getBoundingClientRect();
30                 var x = boundingRect.left + 2;
31                 var y = boundingRect.top + 2;
32                 eventSender.mouseMoveTo(x, y);
33                 eventSender.mouseDown();
34                 eventSender.mouseUp();
35                 window.setTimeout(function() { testMenuIsInvisible(); }, 100);
36             }
37
38             function testMenuIsInvisible()
39             {
40                 var trackListElement = getTrackListElement();
41                 displayStyle = window.getComputedStyle(trackListElement.parentNode).display;
42                 consoleWrite("*** Track menu should be invisible " + displayStyle);
43                 testExpected("displayStyle", "none");
44                 endTest();
45             }
46
47             function start()
48             {
49                 findMediaElement();
50                 video.src = findMediaFile('video', 'content/test');
51                 waitForEvent('canplaythrough', function () { startTrackMenuTest(startTest); });
52             }
53         </script>
54     </head>
55
56     <body onload="start()">
57         <p>Test that we are able to trigger the list of captions, and then click elsewhere to hide it.</p>
58         <video width="500" height="300" controls>
59             <track kind="captions" src="track/captions-webvtt/captions-fast.vtt" srclang="en">
60         </video>
61     </body>
62 </html>
63