| 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();
|
|
|