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

Unified Diff: LayoutTests/fast/events/script-tests/keydown-numpad-keys.js

Issue 20986003: Define DOM_KEY_LOCATION_* constants on KeyboardEvent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nits Created 7 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/events/script-tests/keydown-numpad-keys.js
diff --git a/LayoutTests/fast/events/script-tests/keydown-numpad-keys.js b/LayoutTests/fast/events/script-tests/keydown-numpad-keys.js
index eb09867f347d4b5dd1e83e7d72a17962fdf50ba8..01ddc4cbb9fbbe059c7a11ac66f6f1b8979ef871 100644
--- a/LayoutTests/fast/events/script-tests/keydown-numpad-keys.js
+++ b/LayoutTests/fast/events/script-tests/keydown-numpad-keys.js
@@ -19,7 +19,7 @@ function recordKeyEvent(ev) {
}
function testKeyEventWithLocation(evString, evLocation, expectedKeyCode) {
- eventSender.keyDown(evString, [], evLocation);
+ eventSender.keyDown(evString, [], eval(evLocation));
shouldBe("lastKeyboardEvent.type", '"keydown"');
shouldEvaluateTo("lastKeyboardEvent.keyCode", expectedKeyCode);
shouldEvaluateTo("lastKeyboardEvent.keyLocation", evLocation);
@@ -31,29 +31,27 @@ document.body.insertBefore(textarea, document.body.firstChild);
textarea.focus();
if (window.eventSender) {
- // location=0 indicates that we send events as standard keys.
- testKeyEventWithLocation("pageUp", 0, 33);
- testKeyEventWithLocation("pageDown", 0, 34);
- testKeyEventWithLocation("home", 0, 36);
- testKeyEventWithLocation("end", 0, 35);
- testKeyEventWithLocation("leftArrow", 0, 37);
- testKeyEventWithLocation("rightArrow", 0, 39);
- testKeyEventWithLocation("upArrow", 0, 38);
- testKeyEventWithLocation("downArrow", 0, 40);
- testKeyEventWithLocation("insert", 0, 45);
- testKeyEventWithLocation("delete", 0, 46);
+ testKeyEventWithLocation("pageUp", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD", 33);
+ testKeyEventWithLocation("pageDown", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD", 34);
+ testKeyEventWithLocation("home", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD", 36);
+ testKeyEventWithLocation("end", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD", 35);
+ testKeyEventWithLocation("leftArrow", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD", 37);
+ testKeyEventWithLocation("rightArrow", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD", 39);
+ testKeyEventWithLocation("upArrow", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD", 38);
+ testKeyEventWithLocation("downArrow", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD", 40);
+ testKeyEventWithLocation("insert", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD", 45);
+ testKeyEventWithLocation("delete", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD", 46);
- // location=3 indicates that we send events as numeric-pad keys.
- testKeyEventWithLocation("pageUp", 3, 33);
- testKeyEventWithLocation("pageDown", 3, 34);
- testKeyEventWithLocation("home", 3, 36);
- testKeyEventWithLocation("end", 3, 35);
- testKeyEventWithLocation("leftArrow", 3, 37);
- testKeyEventWithLocation("rightArrow", 3, 39);
- testKeyEventWithLocation("upArrow", 3, 38);
- testKeyEventWithLocation("downArrow", 3, 40);
- testKeyEventWithLocation("insert", 3, 45);
- testKeyEventWithLocation("delete", 3, 46);
+ testKeyEventWithLocation("pageUp", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD", 33);
+ testKeyEventWithLocation("pageDown", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD", 34);
+ testKeyEventWithLocation("home", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD", 36);
+ testKeyEventWithLocation("end", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD", 35);
+ testKeyEventWithLocation("leftArrow", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD", 37);
+ testKeyEventWithLocation("rightArrow", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD", 39);
+ testKeyEventWithLocation("upArrow", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD", 38);
+ testKeyEventWithLocation("downArrow", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD", 40);
+ testKeyEventWithLocation("insert", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD", 45);
+ testKeyEventWithLocation("delete", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD", 46);
} else {
- debug("This test requires DumpRenderTree. To manually test, 1) focus on the textarea above and push numpad keys without locking NumLock and 2) see if the location= value is 3 (DOM_KEY_LOCATION_NUMPAD specified in DOM level 3).");
+ debug("This test requires DumpRenderTree. To manually test, 1) focus on the textarea above and push numpad keys without locking NumLock and 2) see if the location= value is KeyboardEvent.DOM_KEY_LOCATION_NUMPAD (specified in DOM level 3).");
}

Powered by Google App Engine
This is Rietveld 408576698