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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/accelerators/accelerator_table.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "ash/accelerators/accelerator_table.h" 6 #include "ash/accelerators/accelerator_table.h"
7 #include "ash/accessibility_delegate.h" 7 #include "ash/accessibility_delegate.h"
8 #include "ash/ash_switches.h" 8 #include "ash/ash_switches.h"
9 #include "ash/caps_lock_delegate.h" 9 #include "ash/caps_lock_delegate.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 EXPECT_EQ(1, delegate->handle_volume_down_count()); 1323 EXPECT_EQ(1, delegate->handle_volume_down_count());
1324 EXPECT_EQ(volume_down, delegate->last_accelerator()); 1324 EXPECT_EQ(volume_down, delegate->last_accelerator());
1325 EXPECT_EQ(0, delegate->handle_volume_up_count()); 1325 EXPECT_EQ(0, delegate->handle_volume_up_count());
1326 EXPECT_TRUE(ProcessWithContext(volume_up)); 1326 EXPECT_TRUE(ProcessWithContext(volume_up));
1327 EXPECT_EQ(1, delegate->handle_volume_up_count()); 1327 EXPECT_EQ(1, delegate->handle_volume_up_count());
1328 EXPECT_EQ(volume_up, delegate->last_accelerator()); 1328 EXPECT_EQ(volume_up, delegate->last_accelerator());
1329 } 1329 }
1330 } 1330 }
1331 #endif 1331 #endif
1332 1332
1333 TEST_F(AcceleratorControllerTest, DisallowedWithNoWindow) {
1334 const ui::Accelerator dummy;
1335 AccessibilityDelegate* delegate =
1336 ash::Shell::GetInstance()->accessibility_delegate();
1337
1338 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) {
1339 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE);
1340 EXPECT_TRUE(
1341 GetController()->PerformAction(kActionsNeedingWindow[i], dummy));
1342 EXPECT_EQ(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_NEEDED);
1343 }
1344
1345 // Make sure we don't alert if we do have a window.
1346 scoped_ptr<aura::Window> window(
1347 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
1348 wm::ActivateWindow(window.get());
1349 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) {
1350 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE);
1351 GetController()->PerformAction(kActionsNeedingWindow[i], dummy);
1352 EXPECT_EQ(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_NONE);
1353 }
1354
1355 // Don't alert if we have a minimized window either.
1356 GetController()->PerformAction(WINDOW_MINIMIZE, dummy);
1357 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) {
1358 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE);
1359 GetController()->PerformAction(kActionsNeedingWindow[i], dummy);
1360 EXPECT_EQ(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_NONE);
1361 }
1362 }
1363
1333 } // namespace ash 1364 } // namespace ash
OLDNEW
« 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