Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2679)

Unified Diff: ash/accelerators/accelerator_controller_unittest.cc

Issue 77453013: Add an accessibility alert for incorrect use of some accelerators. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/accelerators/accelerator_table.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_controller_unittest.cc
diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc
index cece32878d685de81159d3703d3988b835885285..4a98b0e0f0ade7aca79f3464030cec0c3ebefa10 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
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/accelerators/accelerator_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698