Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / media-element-focus-tab.html
blobe291d37e030db2fbf5dac712916a9b52beee7736
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <body id="body">
4 <p>This tests that a media element ie: <code>&lt;Audio&gt;</code> or <code>&lt;video&gt;</code>, without tabindex can be selected with keyboard (TAB Key)</p>
5 <pre id="console"></pre>
7 <input id="WithTabIndexVideo" type=text>
8 <br>
9 <video id="video1" onfocus="window.mediaFocused = true" controls tabindex="0" src="../media/content/test.mp4"></video>
10 <br>
12 <input id="WithoutTabIndexVideo" type=text>
13 <br>
14 <video id="video2" onfocus="window.mediaFocused = true" controls src="../media/content/test.mp4"></video>
15 <br>
17 <input id="WithoutControlsButWithTabIndexVideo" type=text>
18 <br>
19 <video id="video3" onfocus="window.mediaFocused = true" tabindex="0" src="../media/content/test.mp4"></video>
20 <br>
22 <input id="WithoutTabIndexAudio" type=text>
23 <br>
24 <audio id="audio1" onfocus="window.mediaFocused = true" controls src="../media/content/test.wav"></audio>
25 <br>
27 <input id="WithoutControlaAndTabIndexAudio" type=text>
28 <br>
29 <audio id="audio2" onfocus="window.mediaFocused = true" src="../media/content/test.mp4"></audio>
30 <br>
32 <script>
34 if (window.testRunner)
35 testRunner.dumpAsText();
37 function test(mediaId, fieldId, shoulbefocussed)
39 if (!window.eventSender)
40 return;
42 var mediaFocusedResult, mediaNotFocusedResult;
43 if (shoulbefocussed)
45 mediaFocusedResult = "SUCCESS";
46 mediaNotFocusedResult = "FAIL";
48 else
50 mediaFocusedResult = "FAIL";
51 mediaNotFocusedResult = "SUCCESS";
54 window.mediaFocused = false;
55 document.getElementById(fieldId).focus();
56 eventSender.keyDown('\t');
57 if (window.mediaFocused)
58 document.getElementById("console").innerHTML += mediaFocusedResult + ": Tab-Key did tab to the Media Element (" + mediaId + "). TEST: " + fieldId + ".\n";
59 else
60 document.getElementById("console").innerHTML += mediaNotFocusedResult + ": Tab-Key did not tab to the Media Element (" + mediaId + "). TEST: " + fieldId + ".\n";
63 test("video1", "WithTabIndexVideo", true);
64 test("video2", "WithoutTabIndexVideo", true);
65 test("video3", "WithoutControlsButWithTabIndexVideo", true);
66 test("audio1", "WithoutTabIndexAudio", "SUCCESS", true);
67 test("audio2", "WithoutControlaAndTabIndexAudio", false);
69 </script>
70 </body>
71 </html>