| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/common/accelerators/accelerator_controller.h" | 5 #include "ash/common/accelerators/accelerator_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/accelerators/accelerator_table.h" | 7 #include "ash/common/accelerators/accelerator_table.h" |
| 8 #include "ash/common/accessibility_delegate.h" | 8 #include "ash/common/accessibility_delegate.h" |
| 9 #include "ash/common/accessibility_types.h" | 9 #include "ash/common/accessibility_types.h" |
| 10 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 | 972 |
| 973 void TearDown() override { | 973 void TearDown() override { |
| 974 chromeos::input_method::InputMethodManager::Shutdown(); | 974 chromeos::input_method::InputMethodManager::Shutdown(); |
| 975 AcceleratorControllerTest::TearDown(); | 975 AcceleratorControllerTest::TearDown(); |
| 976 } | 976 } |
| 977 | 977 |
| 978 private: | 978 private: |
| 979 DISALLOW_COPY_AND_ASSIGN(ToggleCapsLockTest); | 979 DISALLOW_COPY_AND_ASSIGN(ToggleCapsLockTest); |
| 980 }; | 980 }; |
| 981 | 981 |
| 982 // Tests the four combinations of the TOGGLE_CAPS_LOCK accelerator. | 982 // Tests the five combinations of the TOGGLE_CAPS_LOCK accelerator. |
| 983 TEST_F(ToggleCapsLockTest, ToggleCapsLockAccelerators) { | 983 TEST_F(ToggleCapsLockTest, ToggleCapsLockAccelerators) { |
| 984 chromeos::input_method::InputMethodManager* input_method_manager = | 984 chromeos::input_method::InputMethodManager* input_method_manager = |
| 985 chromeos::input_method::InputMethodManager::Get(); | 985 chromeos::input_method::InputMethodManager::Get(); |
| 986 ASSERT_TRUE(input_method_manager); | 986 ASSERT_TRUE(input_method_manager); |
| 987 EXPECT_FALSE(input_method_manager->GetImeKeyboard()->CapsLockIsEnabled()); | 987 EXPECT_FALSE(input_method_manager->GetImeKeyboard()->CapsLockIsEnabled()); |
| 988 | 988 |
| 989 // 1. Press Alt, Press Search, Release Search, Release Alt. | 989 // 1. Press Alt, Press Search, Release Search, Release Alt. |
| 990 // Note when you press Alt then press search, the key_code at this point is | 990 // Note when you press Alt then press search, the key_code at this point is |
| 991 // VKEY_LWIN (for search) and Alt is the modifier. | 991 // VKEY_LWIN (for search) and Alt is the modifier. |
| 992 const ui::Accelerator press_alt_then_search(ui::VKEY_LWIN, ui::EF_ALT_DOWN); | 992 const ui::Accelerator press_alt_then_search(ui::VKEY_LWIN, ui::EF_ALT_DOWN); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1012 const ui::Accelerator release_alt_before_search( | 1012 const ui::Accelerator release_alt_before_search( |
| 1013 CreateReleaseAccelerator(ui::VKEY_MENU, ui::EF_COMMAND_DOWN)); | 1013 CreateReleaseAccelerator(ui::VKEY_MENU, ui::EF_COMMAND_DOWN)); |
| 1014 EXPECT_TRUE(ProcessInController(release_alt_before_search)); | 1014 EXPECT_TRUE(ProcessInController(release_alt_before_search)); |
| 1015 EXPECT_TRUE(input_method_manager->GetImeKeyboard()->CapsLockIsEnabled()); | 1015 EXPECT_TRUE(input_method_manager->GetImeKeyboard()->CapsLockIsEnabled()); |
| 1016 input_method_manager->GetImeKeyboard()->SetCapsLockEnabled(false); | 1016 input_method_manager->GetImeKeyboard()->SetCapsLockEnabled(false); |
| 1017 | 1017 |
| 1018 // 4. Press Search, Press Alt, Release Alt, Release Search. | 1018 // 4. Press Search, Press Alt, Release Alt, Release Search. |
| 1019 EXPECT_FALSE(ProcessInController(press_search_then_alt)); | 1019 EXPECT_FALSE(ProcessInController(press_search_then_alt)); |
| 1020 EXPECT_TRUE(ProcessInController(release_alt_before_search)); | 1020 EXPECT_TRUE(ProcessInController(release_alt_before_search)); |
| 1021 EXPECT_TRUE(input_method_manager->GetImeKeyboard()->CapsLockIsEnabled()); | 1021 EXPECT_TRUE(input_method_manager->GetImeKeyboard()->CapsLockIsEnabled()); |
| 1022 input_method_manager->GetImeKeyboard()->SetCapsLockEnabled(false); |
| 1023 |
| 1024 // 5. Press Caps Lock, Release Caps Lock. |
| 1025 const ui::Accelerator press_caps_lock(ui::VKEY_CAPITAL, ui::EF_NONE); |
| 1026 EXPECT_FALSE(ProcessInController(press_caps_lock)); |
| 1027 EXPECT_FALSE(input_method_manager->GetImeKeyboard()->CapsLockIsEnabled()); |
| 1028 const ui::Accelerator release_caps_lock( |
| 1029 CreateReleaseAccelerator(ui::VKEY_CAPITAL, ui::EF_NONE)); |
| 1030 EXPECT_TRUE(ProcessInController(release_caps_lock)); |
| 1031 EXPECT_TRUE(input_method_manager->GetImeKeyboard()->CapsLockIsEnabled()); |
| 1022 } | 1032 } |
| 1023 | 1033 |
| 1024 class PreferredReservedAcceleratorsTest : public test::AshTestBase { | 1034 class PreferredReservedAcceleratorsTest : public test::AshTestBase { |
| 1025 public: | 1035 public: |
| 1026 PreferredReservedAcceleratorsTest() {} | 1036 PreferredReservedAcceleratorsTest() {} |
| 1027 ~PreferredReservedAcceleratorsTest() override {} | 1037 ~PreferredReservedAcceleratorsTest() override {} |
| 1028 | 1038 |
| 1029 // test::AshTestBase: | 1039 // test::AshTestBase: |
| 1030 void SetUp() override { | 1040 void SetUp() override { |
| 1031 AshTestBase::SetUp(); | 1041 AshTestBase::SetUp(); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1360 // Expect no notifications from the new accelerators. | 1370 // Expect no notifications from the new accelerators. |
| 1361 EXPECT_TRUE(IsMessageCenterEmpty()); | 1371 EXPECT_TRUE(IsMessageCenterEmpty()); |
| 1362 | 1372 |
| 1363 // If the action is LOCK_SCREEN, we must reset the state by unlocking the | 1373 // If the action is LOCK_SCREEN, we must reset the state by unlocking the |
| 1364 // screen before we proceed testing the rest of accelerators. | 1374 // screen before we proceed testing the rest of accelerators. |
| 1365 ResetStateIfNeeded(); | 1375 ResetStateIfNeeded(); |
| 1366 } | 1376 } |
| 1367 } | 1377 } |
| 1368 | 1378 |
| 1369 } // namespace ash | 1379 } // namespace ash |
| OLD | NEW |