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

Side by Side Diff: LayoutTests/fast/events/keydown-leftright-keys.html

Issue 20986003: Define DOM_KEY_LOCATION_* constants on KeyboardEvent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../js/resources/js-test-pre.js"></script> 4 <script src="../js/resources/js-test-pre.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <script> 7 <script>
8 description("This tests keyboard events with KeyLocationCode argument."); 8 description("This tests keyboard events with KeyLocationCode argument.");
9 9
10 var lastKeyboardEvent; 10 var lastKeyboardEvent;
11 var VK_SHIFT = 16; 11 var VK_SHIFT = 16;
12 var VK_CONTROL = 17; 12 var VK_CONTROL = 17;
13 var VK_MENU = 18; 13 var VK_MENU = 18;
14 var KEY_LOCATION_LEFT = 1;
15 var KEY_LOCATION_RIGHT = 2;
16 14
17 function recordKeyEvent(ev) { 15 function recordKeyEvent(ev) {
18 ev = ev || event; 16 ev = ev || event;
19 ev.keyCode = (ev.which || ev.keyCode); 17 ev.keyCode = (ev.which || ev.keyCode);
20 if (window.eventSender) { 18 if (window.eventSender) {
21 lastKeyboardEvent = ev; 19 lastKeyboardEvent = ev;
22 } else { 20 } else {
23 debug('Type=' + ev.type + ',' + 21 debug('Type=' + ev.type + ',' +
24 'keyCode=' + ev.keyCode + ',' + 22 'keyCode=' + ev.keyCode + ',' +
25 'ctrlKey=' + ev.ctrlKey + ',' + 23 'ctrlKey=' + ev.ctrlKey + ',' +
(...skipping 11 matching lines...) Expand all
37 shouldEvaluateTo("lastKeyboardEvent.location", expectedLocation); 35 shouldEvaluateTo("lastKeyboardEvent.location", expectedLocation);
38 } 36 }
39 37
40 var textarea = document.createElement("textarea"); 38 var textarea = document.createElement("textarea");
41 textarea.addEventListener("keydown", recordKeyEvent, false); 39 textarea.addEventListener("keydown", recordKeyEvent, false);
42 document.body.insertBefore(textarea, document.body.firstChild); 40 document.body.insertBefore(textarea, document.body.firstChild);
43 textarea.focus(); 41 textarea.focus();
44 42
45 if (window.eventSender) { 43 if (window.eventSender) {
46 // location=0 indicates that we send events as standard keys. 44 // location=0 indicates that we send events as standard keys.
47 testKeyEventWithLocation("leftShift", VK_SHIFT, "KEY_LOCATION_LEFT"); 45 testKeyEventWithLocation("leftShift", VK_SHIFT, "KeyboardEvent.DOM_KEY_LOCAT ION_LEFT");
48 testKeyEventWithLocation("leftControl", VK_CONTROL, "KEY_LOCATION_LEFT"); 46 testKeyEventWithLocation("leftControl", VK_CONTROL, "KeyboardEvent.DOM_KEY_L OCATION_LEFT");
49 testKeyEventWithLocation("leftAlt", VK_MENU, "KEY_LOCATION_LEFT"); 47 testKeyEventWithLocation("leftAlt", VK_MENU, "KeyboardEvent.DOM_KEY_LOCATION _LEFT");
50 48
51 testKeyEventWithLocation("rightShift", VK_SHIFT, "KEY_LOCATION_RIGHT"); 49 testKeyEventWithLocation("rightShift", VK_SHIFT, "KeyboardEvent.DOM_KEY_LOCA TION_RIGHT");
52 testKeyEventWithLocation("rightControl", VK_CONTROL, "KEY_LOCATION_RIGHT"); 50 testKeyEventWithLocation("rightControl", VK_CONTROL, "KeyboardEvent.DOM_KEY_ LOCATION_RIGHT");
53 testKeyEventWithLocation("rightAlt", VK_MENU, "KEY_LOCATION_RIGHT"); 51 testKeyEventWithLocation("rightAlt", VK_MENU, "KeyboardEvent.DOM_KEY_LOCATIO N_RIGHT");
54 } else { 52 } else {
55 debug("This test requires DumpRenderTree."); 53 debug("This test requires DumpRenderTree.");
56 } 54 }
57 </script> 55 </script>
58 <script src="../js/resources/js-test-post.js"></script> 56 <script src="../js/resources/js-test-post.js"></script>
59 </body> 57 </body>
60 </html> 58 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698