Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: LayoutTests/fast/events/option-tab.html

Issue 1234613004: Only execute default actions on trusted events. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master_event_trusted_main3
Patch Set: Rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <p>This tests that option-tab moves you from a text field to a link, but plain o ld tab does not.</p> 1 <p>This tests that option-tab moves you from a text field to a link, but plain o ld tab does not.</p>
2 <p>Note: Option is the Mac name for what other platforms call Alt.</p> 2 <p>Note: Option is the Mac name for what other platforms call Alt.</p>
3 <input id="textField" type=text> <a onfocus="window.linkFocused = true" href="ht tp://www.apple.com">link</a> 3 <input id="textField" type=text> <a onfocus="window.linkFocused = true" href="ht tp://www.apple.com">link</a>
4 <input id="searchField" type=search> <a onfocus="window.linkFocused = true" href ="http://www.apple.com">link</a> 4 <input id="searchField" type=search> <a onfocus="window.linkFocused = true" href ="http://www.apple.com">link</a>
5 <pre id="console"> 5 <pre id="console">
6 </pre> 6 </pre>
7 <script> 7 <script>
8 8
9 if (window.testRunner) 9 if (window.testRunner)
10 testRunner.dumpAsText(); 10 testRunner.dumpAsText();
11 11
12 function test(fieldId) 12 function test(fieldId)
13 { 13 {
14 window.linkFocused = false; 14 window.linkFocused = false;
15 document.getElementById(fieldId).focus(); 15 document.getElementById(fieldId).focus();
16 var event = document.createEvent("KeyboardEvents"); 16
17 event.initKeyboardEvent("keydown", true, true, document.defaultView, "U+0009 ", 0, false, true, false, false, false); 17 if (window.testRunner)
tkent 2015/07/22 23:15:03 should test window.eventSender.
dtapuska 2015/07/23 01:28:10 Done.
18 document.getElementById(fieldId).dispatchEvent(event); 18 eventSender.keyDown('\u0009', ["altKey"]);
19
19 if (window.linkFocused) 20 if (window.linkFocused)
20 document.getElementById("console").innerHTML += "SUCCESS: Option-tab did tab to the link (" + fieldId + ").\n"; 21 document.getElementById("console").innerHTML += "SUCCESS: Option-tab did tab to the link (" + fieldId + ").\n";
21 else 22 else
22 document.getElementById("console").innerHTML += "FAIL: Option-tab did no t tab to the link (" + fieldId + ").\n"; 23 document.getElementById("console").innerHTML += "FAIL: Option-tab did no t tab to the link (" + fieldId + ").\n";
23 24
24 window.linkFocused = false; 25 window.linkFocused = false;
25 document.getElementById(fieldId).focus(); 26 document.getElementById(fieldId).focus();
26 event = document.createEvent("KeyboardEvents"); 27
27 event.initKeyboardEvent("keydown", true, true, document.defaultView, "U+0009 ", 0, false, false, false, false, false); 28 if (window.testRunner)
tkent 2015/07/22 23:15:03 Ditto.
dtapuska 2015/07/23 01:28:10 Done.
28 document.getElementById(fieldId).dispatchEvent(event); 29 eventSender.keyDown('\u0009', []);
30
29 if (window.linkFocused) 31 if (window.linkFocused)
30 document.getElementById("console").innerHTML += "FAIL: Plain old tab did tab to the link (" + fieldId + ").\n"; 32 document.getElementById("console").innerHTML += "FAIL: Plain old tab did tab to the link (" + fieldId + ").\n";
31 else 33 else
32 document.getElementById("console").innerHTML += "SUCCESS: Plain old tab did not tab to the link (" + fieldId + ").\n"; 34 document.getElementById("console").innerHTML += "SUCCESS: Plain old tab did not tab to the link (" + fieldId + ").\n";
33 } 35 }
34 36
35 test("textField"); 37 test("textField");
36 test("searchField"); 38 test("searchField");
37 39
38 </script> 40 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698