Not all subtitle tracks are SDH
[WebKit-https.git] / LayoutTests / media / video-controls-captions-trackmenu-localized.html
1 <!DOCTYPE html>
2 <html>
3     <head>
4         <title>Testing that the track menu gets localized strings</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
11         var trackListSection;
12         var item;
13
14         if (window.testRunner)
15             testRunner.dumpAsText();
16
17         function testMenuHeaders()
18         {
19             var trackListElement = getTrackListElement();
20             if (!trackListElement)
21                 return;
22
23             trackListSection = trackListElement.querySelector("h3");
24             if (!trackListSection) {
25                 failTest("There should be a single section element in track list menu");
26                 return;
27             }
28
29             consoleWrite("Heading should be labelled 'Subtitles'");
30             testExpected("trackListSection.textContent", "Subtitles");
31
32             var captionsEntries = trackListElement.querySelectorAll("li");
33             if (!captionsEntries || captionsEntries.length <= 0) {
34                 failTest("Not enough items in captions menu");
35                 return;
36             }
37
38             item = captionsEntries[0];
39             consoleWrite("<br>First item in captions menu should be labelled 'Off'");
40             testExpected("item.textContent", "Off");
41
42             item = captionsEntries[1];
43             consoleWrite("<br>Second item in captions menu should be labelled 'Auto (Recommended)'");
44             testExpected("item.textContent", "Auto (Recommended)");
45
46
47             item = captionsEntries[2];
48             consoleWrite("<br>Third item in captions menu should be labelled 'English CC'");
49             testExpected("item.textContent", "English CC");
50
51             item = captionsEntries[3];
52             consoleWrite("<br>Fourth item in captions menu should be labelled 'Laugh Track (English-United States)'");
53             testExpected("item.textContent", "Laugh Track (English-United States)");
54
55             item = captionsEntries[4];
56             consoleWrite("<br>Fifth item in captions menu should be labelled 'Unknown'");
57             testExpected("item.textContent", "Unknown");
58
59             endTest();
60         }
61
62         function start()
63         {
64             findMediaElement();
65             video.src = 'content/counting-captioned.mov';
66             waitForEvent('canplaythrough', function () { startTrackMenuTest(testMenuHeaders); });
67         }
68         </script>
69     </head>
70
71     <body onload="start()">
72         <p>Test that captions and subtitles menu items are localized.</p>
73         <video width="500" height="300" controls>
74             <track kind="captions" src="track/captions-webvtt/captions-fast.vtt">
75             <track kind="subtitles" src="track/captions-webvtt/captions-fast.vtt" label="Laugh Track" srclang="en-US">
76         </video>
77     </body>
78 </html>
79