| 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/aura/wm_window_aura.h" | 8 #include "ash/aura/wm_window_aura.h" |
| 9 #include "ash/common/accessibility_delegate.h" | 9 #include "ash/common/accessibility_delegate.h" |
| 10 #include "ash/common/accessibility_types.h" | 10 #include "ash/common/accessibility_types.h" |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 // Lock screen | 946 // Lock screen |
| 947 // NOTE: Accelerators that do not work on the lock screen need to be | 947 // NOTE: Accelerators that do not work on the lock screen need to be |
| 948 // tested before the sequence below is invoked because it causes a side | 948 // tested before the sequence below is invoked because it causes a side |
| 949 // effect of locking the screen. | 949 // effect of locking the screen. |
| 950 EXPECT_TRUE(ProcessInController( | 950 EXPECT_TRUE(ProcessInController( |
| 951 ui::Accelerator(ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); | 951 ui::Accelerator(ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
| 952 #endif | 952 #endif |
| 953 } | 953 } |
| 954 | 954 |
| 955 TEST_F(AcceleratorControllerTest, GlobalAcceleratorsToggleAppList) { | 955 TEST_F(AcceleratorControllerTest, GlobalAcceleratorsToggleAppList) { |
| 956 AccessibilityDelegate* delegate = WmShell::Get()->GetAccessibilityDelegate(); | 956 AccessibilityDelegate* delegate = WmShell::Get()->accessibility_delegate(); |
| 957 EXPECT_FALSE(Shell::GetInstance()->GetAppListTargetVisibility()); | 957 EXPECT_FALSE(Shell::GetInstance()->GetAppListTargetVisibility()); |
| 958 | 958 |
| 959 // The press event should not open the AppList, the release should instead. | 959 // The press event should not open the AppList, the release should instead. |
| 960 EXPECT_FALSE( | 960 EXPECT_FALSE( |
| 961 ProcessInController(ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); | 961 ProcessInController(ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
| 962 EXPECT_EQ(ui::VKEY_LWIN, GetCurrentAccelerator().key_code()); | 962 EXPECT_EQ(ui::VKEY_LWIN, GetCurrentAccelerator().key_code()); |
| 963 | 963 |
| 964 EXPECT_FALSE(Shell::GetInstance()->GetAppListTargetVisibility()); | 964 EXPECT_FALSE(Shell::GetInstance()->GetAppListTargetVisibility()); |
| 965 | 965 |
| 966 EXPECT_TRUE( | 966 EXPECT_TRUE( |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 EXPECT_EQ(volume_down, delegate->last_accelerator()); | 1276 EXPECT_EQ(volume_down, delegate->last_accelerator()); |
| 1277 EXPECT_EQ(0, delegate->handle_volume_up_count()); | 1277 EXPECT_EQ(0, delegate->handle_volume_up_count()); |
| 1278 EXPECT_TRUE(ProcessInController(volume_up)); | 1278 EXPECT_TRUE(ProcessInController(volume_up)); |
| 1279 EXPECT_EQ(1, delegate->handle_volume_up_count()); | 1279 EXPECT_EQ(1, delegate->handle_volume_up_count()); |
| 1280 EXPECT_EQ(volume_up, delegate->last_accelerator()); | 1280 EXPECT_EQ(volume_up, delegate->last_accelerator()); |
| 1281 } | 1281 } |
| 1282 } | 1282 } |
| 1283 #endif | 1283 #endif |
| 1284 | 1284 |
| 1285 TEST_F(AcceleratorControllerTest, DisallowedWithNoWindow) { | 1285 TEST_F(AcceleratorControllerTest, DisallowedWithNoWindow) { |
| 1286 AccessibilityDelegate* delegate = WmShell::Get()->GetAccessibilityDelegate(); | 1286 AccessibilityDelegate* delegate = WmShell::Get()->accessibility_delegate(); |
| 1287 | 1287 |
| 1288 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) { | 1288 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) { |
| 1289 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE); | 1289 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE); |
| 1290 EXPECT_TRUE( | 1290 EXPECT_TRUE( |
| 1291 GetController()->PerformActionIfEnabled(kActionsNeedingWindow[i])); | 1291 GetController()->PerformActionIfEnabled(kActionsNeedingWindow[i])); |
| 1292 EXPECT_EQ(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_NEEDED); | 1292 EXPECT_EQ(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_NEEDED); |
| 1293 } | 1293 } |
| 1294 | 1294 |
| 1295 // Make sure we don't alert if we do have a window. | 1295 // Make sure we don't alert if we do have a window. |
| 1296 std::unique_ptr<aura::Window> window; | 1296 std::unique_ptr<aura::Window> window; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1411 EXPECT_TRUE(IsMessageCenterEmpty()); | 1411 EXPECT_TRUE(IsMessageCenterEmpty()); |
| 1412 | 1412 |
| 1413 // If the action is LOCK_SCREEN, we must reset the state by unlocking the | 1413 // If the action is LOCK_SCREEN, we must reset the state by unlocking the |
| 1414 // screen before we proceed testing the rest of accelerators. | 1414 // screen before we proceed testing the rest of accelerators. |
| 1415 ResetStateIfNeeded(); | 1415 ResetStateIfNeeded(); |
| 1416 } | 1416 } |
| 1417 } | 1417 } |
| 1418 #endif // defined(OS_CHROMEOS) | 1418 #endif // defined(OS_CHROMEOS) |
| 1419 | 1419 |
| 1420 } // namespace ash | 1420 } // namespace ash |
| OLD | NEW |