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