diff options
Diffstat (limited to 'ash/accelerators/accelerator_controller_unittest.cc')
-rw-r--r-- | ash/accelerators/accelerator_controller_unittest.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc index cece328..4a98b0e 100644 --- a/ash/accelerators/accelerator_controller_unittest.cc +++ b/ash/accelerators/accelerator_controller_unittest.cc @@ -1330,4 +1330,35 @@ TEST_F(AcceleratorControllerTest, DisallowedAtModalWindow) { } #endif +TEST_F(AcceleratorControllerTest, DisallowedWithNoWindow) { + const ui::Accelerator dummy; + AccessibilityDelegate* delegate = + ash::Shell::GetInstance()->accessibility_delegate(); + + for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) { + delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE); + EXPECT_TRUE( + GetController()->PerformAction(kActionsNeedingWindow[i], dummy)); + EXPECT_EQ(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_NEEDED); + } + + // Make sure we don't alert if we do have a window. + scoped_ptr<aura::Window> window( + CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); + wm::ActivateWindow(window.get()); + for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) { + delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE); + GetController()->PerformAction(kActionsNeedingWindow[i], dummy); + EXPECT_EQ(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_NONE); + } + + // Don't alert if we have a minimized window either. + GetController()->PerformAction(WINDOW_MINIMIZE, dummy); + for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) { + delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE); + GetController()->PerformAction(kActionsNeedingWindow[i], dummy); + EXPECT_EQ(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_NONE); + } +} + } // namespace ash |