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

Unified Diff: content/shell/renderer/test_runner/event_sender.cc

Issue 929053004: [KeyboardEvent] Add embedder APIs to translate between Dom |key| enum and strings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "API has been updated on the blink side" Created 5 years, 9 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: content/shell/renderer/test_runner/event_sender.cc
diff --git a/content/shell/renderer/test_runner/event_sender.cc b/content/shell/renderer/test_runner/event_sender.cc
index 1960be99e20fa3f6a35c36f14288099ac31c78e5..cbd0ea451ab9e818b4b80a2e7c76311f4b7f2df1 100644
--- a/content/shell/renderer/test_runner/event_sender.cc
+++ b/content/shell/renderer/test_runner/event_sender.cc
@@ -1280,6 +1280,7 @@ void EventSender::KeyDown(const std::string& code_str,
int text = 0;
bool needs_shift_key_modifier = false;
std::string domString;
Wez 2015/04/21 02:25:58 Looks like this should be domCode, to match naming
Habib Virji 2015/04/29 16:05:18 Done.
+ std::string domKey;
if ("\n" == code_str) {
generate_char = true;
@@ -1321,24 +1322,31 @@ void EventSender::KeyDown(const std::string& code_str,
} else if ("menu" == code_str) {
code = ui::VKEY_APPS;
domString.assign("ContextMenu");
+ domKey.assign("MediaApps");
} else if ("leftControl" == code_str) {
code = ui::VKEY_LCONTROL;
domString.assign("ControlLeft");
+ domKey.assign("Control");
} else if ("rightControl" == code_str) {
code = ui::VKEY_RCONTROL;
domString.assign("ControlRight");
+ domKey.assign("Control");
} else if ("leftShift" == code_str) {
code = ui::VKEY_LSHIFT;
domString.assign("ShiftLeft");
+ domKey.assign("Shift");
} else if ("rightShift" == code_str) {
code = ui::VKEY_RSHIFT;
domString.assign("ShiftRight");
+ domKey.assign("Shift");
} else if ("leftAlt" == code_str) {
code = ui::VKEY_LMENU;
domString.assign("AltLeft");
+ domKey.assign("Alt");
} else if ("rightAlt" == code_str) {
code = ui::VKEY_RMENU;
domString.assign("AltRight");
+ domKey.assign("AltGraph");
} else if ("numLock" == code_str) {
code = ui::VKEY_NUMLOCK;
domString.assign("NumLock");
@@ -1399,6 +1407,10 @@ void EventSender::KeyDown(const std::string& code_str,
event_down.windowsKeyCode = code;
event_down.domCode = static_cast<int>(
ui::KeycodeConverter::CodeStringToDomCode(domString.c_str()));
+ if (domKey.empty())
+ domKey = domString;
Wez 2015/04/21 02:25:58 This looks wrong; DOM |code| and |key| are differe
Habib Virji 2015/04/29 16:05:18 Agreed but for some keys such as Enter, ArrowRight
Wez 2015/05/07 00:23:22 It doesn't make sense in general, though, since th
Habib Virji 2015/05/19 16:16:28 I agree with the point you are making and it appea
+ event_down.domKey = static_cast<int>(
+ ui::KeycodeConverter::KeyStringToDomKey(domKey.c_str()));
Wez 2015/05/07 00:23:22 This handles the DomKey enum values, but those onl
Habib Virji 2015/05/19 16:16:28 This is already handled in unmodifiedText: https:/
if (generate_char) {
event_down.text[0] = text;

Powered by Google App Engine
This is Rietveld 408576698