| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/events/event_rewriter.h" | 5 #include "chrome/browser/chromeos/events/event_rewriter.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/sticky_keys/sticky_keys_controller.h" | 10 #include "ash/sticky_keys/sticky_keys_controller.h" |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 CheckKeyTestCase(&rewriter, test); | 482 CheckKeyTestCase(&rewriter, test); |
| 483 } | 483 } |
| 484 } | 484 } |
| 485 | 485 |
| 486 TEST_F(EventRewriterTest, TestRewriteNumPadKeys) { | 486 TEST_F(EventRewriterTest, TestRewriteNumPadKeys) { |
| 487 TestRewriteNumPadKeys(); | 487 TestRewriteNumPadKeys(); |
| 488 } | 488 } |
| 489 | 489 |
| 490 TEST_F(EventRewriterTest, TestRewriteNumPadKeysWithDiamondKeyFlag) { | 490 TEST_F(EventRewriterTest, TestRewriteNumPadKeysWithDiamondKeyFlag) { |
| 491 // Make sure the num lock works correctly even when Diamond key exists. | 491 // Make sure the num lock works correctly even when Diamond key exists. |
| 492 const base::CommandLine original_cl(*base::CommandLine::ForCurrentProcess()); | |
| 493 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 492 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 494 chromeos::switches::kHasChromeOSDiamondKey, ""); | 493 chromeos::switches::kHasChromeOSDiamondKey, ""); |
| 495 | |
| 496 TestRewriteNumPadKeys(); | 494 TestRewriteNumPadKeys(); |
| 497 *base::CommandLine::ForCurrentProcess() = original_cl; | |
| 498 } | 495 } |
| 499 | 496 |
| 500 // Tests if the rewriter can handle a Command + Num Pad event. | 497 // Tests if the rewriter can handle a Command + Num Pad event. |
| 501 void EventRewriterTest::TestRewriteNumPadKeysOnAppleKeyboard() { | 498 void EventRewriterTest::TestRewriteNumPadKeysOnAppleKeyboard() { |
| 502 syncable_prefs::TestingPrefServiceSyncable prefs; | 499 syncable_prefs::TestingPrefServiceSyncable prefs; |
| 503 EventRewriter rewriter(NULL); | 500 EventRewriter rewriter(NULL); |
| 504 rewriter.KeyboardDeviceAddedForTesting(kKeyboardDeviceId, "Apple Keyboard"); | 501 rewriter.KeyboardDeviceAddedForTesting(kKeyboardDeviceId, "Apple Keyboard"); |
| 505 rewriter.set_last_keyboard_device_id_for_testing(kKeyboardDeviceId); | 502 rewriter.set_last_keyboard_device_id_for_testing(kKeyboardDeviceId); |
| 506 rewriter.set_pref_service_for_testing(&prefs); | 503 rewriter.set_pref_service_for_testing(&prefs); |
| 507 | 504 |
| (...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2629 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); | 2626 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); |
| 2630 EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); | 2627 EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); |
| 2631 | 2628 |
| 2632 // Turn off AltGr and Mod3. | 2629 // Turn off AltGr and Mod3. |
| 2633 sticky_keys_controller_->SetModifiersEnabled(false, false); | 2630 sticky_keys_controller_->SetModifiersEnabled(false, false); |
| 2634 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); | 2631 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); |
| 2635 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); | 2632 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); |
| 2636 } | 2633 } |
| 2637 | 2634 |
| 2638 } // namespace chromeos | 2635 } // namespace chromeos |
| OLD | NEW |