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

Unified Diff: ui/views/controls/textfield/textfield_unittest.cc

Issue 1221083008: [NOT FOR COMMIT] Ignore inserting characters of Keys with modifiers on CrOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the double keydowns. Created 5 years, 3 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
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/textfield/textfield_unittest.cc
diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc
index 056a4c569b441b5e3b9c6772b8ef5c3e6976ebca..9a78de27ce255b44f57674e0c13ba960e58a7b7c 100644
--- a/ui/views/controls/textfield/textfield_unittest.cc
+++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -457,6 +457,14 @@ class TextfieldTest : public ViewsTestBase, public TextfieldController {
#endif
}
+ bool TestingNativeCrOs() const {
+#if defined(OS_CHROMEOS)
+ return true;
+#else
+ return false;
+#endif // defined(OS_CHROMEOS)
+ }
+
protected:
void SendKeyEvent(ui::KeyboardCode key_code,
bool alt,
@@ -476,6 +484,10 @@ class TextfieldTest : public ViewsTestBase, public TextfieldController {
(command ? ui::EF_COMMAND_DOWN : 0) |
(caps_lock ? ui::EF_CAPS_LOCK_DOWN : 0);
+ SendKeyPress(key_code, flags);
+ }
+
+ void SendKeyPress(ui::KeyboardCode key_code, int flags) {
#if defined(OS_MACOSX) && !defined(USE_AURA)
// The Mac EventGenerator hooks in before IME. It sends events first to an
// NSResponder, which is necessary to interpret keyboard events into
@@ -707,6 +719,29 @@ TEST_F(TextfieldTest, KeyTest) {
EXPECT_STR_EQ("TexT!1!1", textfield_->text());
}
+TEST_F(TextfieldTest, KeysWithModifiersTest) {
+ InitTextfield();
+ const int ctrl = ui::EF_CONTROL_DOWN;
+ const int alt = ui::EF_ALT_DOWN;
+ const int command = ui::EF_COMMAND_DOWN;
+ const int altgr = ui::EF_ALTGR_DOWN;
+ const int shift = ui::EF_SHIFT_DOWN;
+
+ SendKeyPress(ui::VKEY_T, shift);
+ SendKeyPress(ui::VKEY_E, shift | altgr);
+ SendKeyPress(ui::VKEY_X, 0);
+ SendKeyPress(ui::VKEY_T, ctrl);
+ SendKeyPress(ui::VKEY_1, alt);
+ SendKeyPress(ui::VKEY_2, command);
+ SendKeyPress(ui::VKEY_3, 0);
+ SendKeyPress(ui::VKEY_4, 0);
+
+ if (TestingNativeCrOs())
+ EXPECT_STR_EQ("TEx34", textfield_->text());
+ else
+ EXPECT_STR_EQ("TEx234", textfield_->text());
+}
+
TEST_F(TextfieldTest, ControlAndSelectTest) {
// Insert a test string in a textfield.
InitTextfield();
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698