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

Side by Side Diff: ash/accelerators/accelerator_controller_unittest.cc

Issue 682943002: Make chrome/browser/chromeos/accessibility compile on Athena with use_ash=0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@athena_do_not_use_ash41_scroll_end_effect
Patch Set: Created 6 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
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 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/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 EXPECT_FALSE( 1037 EXPECT_FALSE(
1038 GetController()->Process(ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); 1038 GetController()->Process(ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
1039 EXPECT_EQ(ui::VKEY_LWIN, 1039 EXPECT_EQ(ui::VKEY_LWIN,
1040 GetController()->previous_accelerator_for_test().key_code()); 1040 GetController()->previous_accelerator_for_test().key_code());
1041 1041
1042 EXPECT_TRUE( 1042 EXPECT_TRUE(
1043 GetController()->Process(ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE))); 1043 GetController()->Process(ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE)));
1044 EXPECT_TRUE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); 1044 EXPECT_TRUE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
1045 1045
1046 // When spoken feedback is on, the AppList should not toggle. 1046 // When spoken feedback is on, the AppList should not toggle.
1047 delegate->ToggleSpokenFeedback(A11Y_NOTIFICATION_NONE); 1047 delegate->ToggleSpokenFeedback(ui::A11Y_NOTIFICATION_NONE);
1048 EXPECT_FALSE( 1048 EXPECT_FALSE(
1049 GetController()->Process(ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); 1049 GetController()->Process(ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
1050 EXPECT_FALSE( 1050 EXPECT_FALSE(
1051 GetController()->Process(ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE))); 1051 GetController()->Process(ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE)));
1052 delegate->ToggleSpokenFeedback(A11Y_NOTIFICATION_NONE); 1052 delegate->ToggleSpokenFeedback(ui::A11Y_NOTIFICATION_NONE);
1053 EXPECT_TRUE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); 1053 EXPECT_TRUE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
1054 1054
1055 EXPECT_FALSE( 1055 EXPECT_FALSE(
1056 GetController()->Process(ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); 1056 GetController()->Process(ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
1057 EXPECT_TRUE( 1057 EXPECT_TRUE(
1058 GetController()->Process(ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE))); 1058 GetController()->Process(ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE)));
1059 EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); 1059 EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
1060 1060
1061 // When spoken feedback is on, the AppList should not toggle. 1061 // When spoken feedback is on, the AppList should not toggle.
1062 delegate->ToggleSpokenFeedback(A11Y_NOTIFICATION_NONE); 1062 delegate->ToggleSpokenFeedback(ui::A11Y_NOTIFICATION_NONE);
1063 EXPECT_FALSE( 1063 EXPECT_FALSE(
1064 GetController()->Process(ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); 1064 GetController()->Process(ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
1065 EXPECT_FALSE( 1065 EXPECT_FALSE(
1066 GetController()->Process(ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE))); 1066 GetController()->Process(ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE)));
1067 delegate->ToggleSpokenFeedback(A11Y_NOTIFICATION_NONE); 1067 delegate->ToggleSpokenFeedback(ui::A11Y_NOTIFICATION_NONE);
1068 EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); 1068 EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
1069 } 1069 }
1070 1070
1071 TEST_F(AcceleratorControllerTest, ImeGlobalAccelerators) { 1071 TEST_F(AcceleratorControllerTest, ImeGlobalAccelerators) {
1072 // Test IME shortcuts. 1072 // Test IME shortcuts.
1073 { 1073 {
1074 const ui::Accelerator control_space(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); 1074 const ui::Accelerator control_space(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN);
1075 const ui::Accelerator convert(ui::VKEY_CONVERT, ui::EF_NONE); 1075 const ui::Accelerator convert(ui::VKEY_CONVERT, ui::EF_NONE);
1076 const ui::Accelerator non_convert(ui::VKEY_NONCONVERT, ui::EF_NONE); 1076 const ui::Accelerator non_convert(ui::VKEY_NONCONVERT, ui::EF_NONE);
1077 const ui::Accelerator wide_half_1(ui::VKEY_DBE_SBCSCHAR, ui::EF_NONE); 1077 const ui::Accelerator wide_half_1(ui::VKEY_DBE_SBCSCHAR, ui::EF_NONE);
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 } 1444 }
1445 } 1445 }
1446 #endif 1446 #endif
1447 1447
1448 TEST_F(AcceleratorControllerTest, DisallowedWithNoWindow) { 1448 TEST_F(AcceleratorControllerTest, DisallowedWithNoWindow) {
1449 const ui::Accelerator dummy; 1449 const ui::Accelerator dummy;
1450 AccessibilityDelegate* delegate = 1450 AccessibilityDelegate* delegate =
1451 ash::Shell::GetInstance()->accessibility_delegate(); 1451 ash::Shell::GetInstance()->accessibility_delegate();
1452 1452
1453 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) { 1453 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) {
1454 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE); 1454 delegate->TriggerAccessibilityAlert(ui::A11Y_ALERT_NONE);
1455 EXPECT_TRUE( 1455 EXPECT_TRUE(
1456 GetController()->PerformAction(kActionsNeedingWindow[i], dummy)); 1456 GetController()->PerformAction(kActionsNeedingWindow[i], dummy));
1457 EXPECT_EQ(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_NEEDED); 1457 EXPECT_EQ(delegate->GetLastAccessibilityAlert(),
1458 ui::A11Y_ALERT_WINDOW_NEEDED);
1458 } 1459 }
1459 1460
1460 // Make sure we don't alert if we do have a window. 1461 // Make sure we don't alert if we do have a window.
1461 scoped_ptr<aura::Window> window; 1462 scoped_ptr<aura::Window> window;
1462 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) { 1463 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) {
1463 window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 1464 window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
1464 wm::ActivateWindow(window.get()); 1465 wm::ActivateWindow(window.get());
1465 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE); 1466 delegate->TriggerAccessibilityAlert(ui::A11Y_ALERT_NONE);
1466 GetController()->PerformAction(kActionsNeedingWindow[i], dummy); 1467 GetController()->PerformAction(kActionsNeedingWindow[i], dummy);
1467 EXPECT_NE(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_NEEDED); 1468 EXPECT_NE(delegate->GetLastAccessibilityAlert(),
1469 ui::A11Y_ALERT_WINDOW_NEEDED);
1468 } 1470 }
1469 1471
1470 // Don't alert if we have a minimized window either. 1472 // Don't alert if we have a minimized window either.
1471 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) { 1473 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) {
1472 window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 1474 window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
1473 wm::ActivateWindow(window.get()); 1475 wm::ActivateWindow(window.get());
1474 GetController()->PerformAction(WINDOW_MINIMIZE, dummy); 1476 GetController()->PerformAction(WINDOW_MINIMIZE, dummy);
1475 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE); 1477 delegate->TriggerAccessibilityAlert(ui::A11Y_ALERT_NONE);
1476 GetController()->PerformAction(kActionsNeedingWindow[i], dummy); 1478 GetController()->PerformAction(kActionsNeedingWindow[i], dummy);
1477 EXPECT_NE(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_NEEDED); 1479 EXPECT_NE(delegate->GetLastAccessibilityAlert(),
1480 ui::A11Y_ALERT_WINDOW_NEEDED);
1478 } 1481 }
1479 } 1482 }
1480 1483
1481 } // namespace ash 1484 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698