Chromium Code Reviews| Index: chrome/browser/ui/ash/event_rewriter_unittest.cc |
| diff --git a/chrome/browser/ui/ash/event_rewriter_unittest.cc b/chrome/browser/ui/ash/event_rewriter_unittest.cc |
| index 488788446a398c31dddd4cd022c03a0bec5d5df7..20341ead8835390dbcfd6777811beb5d5ef92ae3 100644 |
| --- a/chrome/browser/ui/ash/event_rewriter_unittest.cc |
| +++ b/chrome/browser/ui/ash/event_rewriter_unittest.cc |
| @@ -117,6 +117,7 @@ class EventRewriterTest : public testing::Test { |
| keycode_next_(XKeysymToKeycode(display_, XK_Next)), |
| keycode_home_(XKeysymToKeycode(display_, XK_Home)), |
| keycode_end_(XKeysymToKeycode(display_, XK_End)), |
| + keycode_launch6_(XKeysymToKeycode(display_, XF86XK_Launch6)), |
| keycode_launch7_(XKeysymToKeycode(display_, XF86XK_Launch7)), |
| keycode_f1_(XKeysymToKeycode(display_, XK_F1)), |
| keycode_f2_(XKeysymToKeycode(display_, XK_F2)), |
| @@ -224,6 +225,7 @@ class EventRewriterTest : public testing::Test { |
| const KeyCode keycode_next_; |
| const KeyCode keycode_home_; |
| const KeyCode keycode_end_; |
| + const KeyCode keycode_launch6_; // F15 |
| const KeyCode keycode_launch7_; // F16 |
| const KeyCode keycode_f1_; |
| const KeyCode keycode_f2_; |
| @@ -1629,6 +1631,108 @@ TEST_F(EventRewriterTest, DISABLED_TestRewriteCapsLockWithFlag) { |
| *CommandLine::ForCurrentProcess() = original_cl; |
| } |
| +TEST_F(EventRewriterTest, DISABLED_TestRewriteDiamondKey) { |
| + // TODO(yusukes): Reenable the test once build servers are upgraded. |
| + |
| + TestingPrefServiceSyncable prefs; |
| + chromeos::Preferences::RegisterUserPrefs(&prefs); |
| + |
| + chromeos::input_method::MockXKeyboard xkeyboard; |
| + EventRewriter rewriter; |
| + rewriter.set_pref_service_for_testing(&prefs); |
| + rewriter.set_xkeyboard_for_testing(&xkeyboard); |
| + |
| + // F15 should work as Ctrl when --has-chromeos-diamond-key is not specified. |
| + EXPECT_EQ(GetExpectedResultAsString(ui::VKEY_CONTROL, |
| + ui::EF_CONTROL_DOWN, |
| + ui::ET_KEY_PRESSED, |
| + keycode_control_l_, |
| + 0U, |
| + KeyPress), |
| + GetRewrittenEventAsString(&rewriter, |
| + ui::VKEY_F15, |
| + 0, |
| + ui::ET_KEY_PRESSED, |
| + keycode_launch6_, |
| + 0U)); |
| +} |
| + |
| +TEST_F(EventRewriterTest, DISABLED_TestRewriteDiamondKeyWithFlag) { |
| + // TODO(yusukes): Reenable the test once build servers are upgraded. |
| + |
| + const CommandLine original_cl(*CommandLine::ForCurrentProcess()); |
| + CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| + switches::kHasChromeOSDiamondKey, ""); |
| + |
| + TestingPrefServiceSyncable prefs; |
| + chromeos::Preferences::RegisterUserPrefs(&prefs); |
| + |
| + chromeos::input_method::MockXKeyboard xkeyboard; |
| + EventRewriter rewriter; |
| + rewriter.set_pref_service_for_testing(&prefs); |
| + rewriter.set_xkeyboard_for_testing(&xkeyboard); |
| + |
| + // On default, F15 should work as Control. |
|
Yusuke Sato
2013/01/24 20:46:01
By default?
yoshiki
2013/01/25 01:33:10
Done.
|
| + EXPECT_EQ(GetExpectedResultAsString(ui::VKEY_CONTROL, |
| + ui::EF_CONTROL_DOWN, |
| + ui::ET_KEY_PRESSED, |
| + keycode_control_l_, |
| + 0U, |
| + KeyPress), |
| + GetRewrittenEventAsString(&rewriter, |
| + ui::VKEY_F15, |
| + 0, |
| + ui::ET_KEY_PRESSED, |
| + keycode_launch6_, |
| + 0U)); |
| + |
| + IntegerPrefMember diamond; |
| + diamond.Init(prefs::kLanguageRemapDiamondKeyTo, &prefs); |
| + diamond.SetValue(chromeos::input_method::kVoidKey); |
| + |
| + EXPECT_EQ(GetExpectedResultAsString(ui::VKEY_UNKNOWN, |
| + 0, |
| + ui::ET_KEY_PRESSED, |
| + keycode_void_symbol_, |
| + 0U, |
| + KeyPress), |
| + GetRewrittenEventAsString(&rewriter, |
| + ui::VKEY_F15, |
| + 0, |
| + ui::ET_KEY_PRESSED, |
| + keycode_launch6_, |
| + 0U)); |
| + |
| + diamond.SetValue(chromeos::input_method::kControlKey); |
| + |
| + EXPECT_EQ(GetExpectedResultAsString(ui::VKEY_CONTROL, |
| + ui::EF_CONTROL_DOWN, |
| + ui::ET_KEY_PRESSED, |
| + keycode_control_l_, |
| + 0U, |
| + KeyPress), |
| + GetRewrittenEventAsString(&rewriter, |
| + ui::VKEY_F15, |
| + 0, |
| + ui::ET_KEY_PRESSED, |
| + keycode_launch6_, |
| + 0U)); |
| + diamond.SetValue(chromeos::input_method::kAltKey); |
|
Yusuke Sato
2013/01/24 20:46:01
Can you add a test for remapping to Caps Lock?
yoshiki
2013/01/25 01:33:10
Done.
|
| + |
| + EXPECT_EQ(GetExpectedResultAsString(ui::VKEY_MENU, |
| + ui::EF_ALT_DOWN, |
| + ui::ET_KEY_PRESSED, |
| + keycode_alt_l_, |
| + 0, |
| + KeyPress), |
| + GetRewrittenEventAsString(&rewriter, |
| + ui::VKEY_F15, |
| + 0, |
| + ui::ET_KEY_PRESSED, |
| + keycode_launch6_, |
| + 0U)); |
| +} |
| + |
| TEST_F(EventRewriterTest, TestRewriteCapsLockToControl) { |
| TestingPrefServiceSyncable prefs; |
| chromeos::Preferences::RegisterUserPrefs(&prefs); |