[Modern Media Controls] Turn media/modern-media-controls/ios-inline-media-controls...
[WebKit-https.git] / LayoutTests / media / video-controls-captions-trackmenu-includes-enabled-track.html
1 <!DOCTYPE html>
2 <html>
3     <head>
4         <title>Test that all enabled tracks are included in the track menu</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             function startTest()
11             {
12                 showTrackMenu();
13                 window.setTimeout(testInitialState, 50);
14             }
15
16             function testInitialState()
17             {
18                 trackListItems = captionTrackMenuList();
19                 consoleWrite("<br>*** Initially both tracks are disabled so neither should be selected.");
20                 testExpected("video.textTracks[0].mode", "disabled");
21                 testExpected("video.textTracks[1].mode", "disabled");
22                 consoleWrite("");
23                 listTrackMenu();
24
25                 consoleWrite("<br>*** Enable both tracks.");
26                 run("video.textTracks[0].mode = 'showing'");
27                 run("video.textTracks[1].mode = 'showing'");
28
29                 // Hide and show the track menu so it will be rebuilt.
30                 window.setTimeout(function() { testMenuAfterEnablingTracks(); }, 50);
31                 hideTrackMenu();
32                 showTrackMenu();
33             }
34
35             function testMenuAfterEnablingTracks()
36             {
37                 consoleWrite("<br>*** Both tracks are enabled so both should be selected.");
38                 trackListItems = captionTrackMenuList();
39                 testExpected("video.textTracks[0].mode", "showing");
40                 testExpected("video.textTracks[1].mode", "showing");
41                 consoleWrite("");
42                 listTrackMenu();
43
44                 consoleWrite("");
45                 endTest();
46             }
47
48             function start()
49             {
50                 findMediaElement();
51                 video.src = findMediaFile('video', 'content/test');
52                 waitForEvent('canplaythrough', startTest);
53             }
54         </script>
55     </head>
56
57     <body onload="start()">
58         <p>Test that all enabled tracks are included in the track menu.</p>
59         <video width="500" height="300" controls>
60             <track kind="captions" label="English Captions 1" src="track/captions-webvtt/captions-fast.vtt" srclang="en">
61             <track kind="captions" label="English Captions 2" src="track/captions-webvtt/captions-fast.vtt" srclang="en">
62         </video>
63     </body>
64 </html>
65