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

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

Issue 2154523002: Move AccessibilityDelegate ownership to ash::WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@setmediadelegate
Patch Set: fix mash_unittests Created 4 years, 5 months 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/spoken_feedback_toggler.cc » ('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 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
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
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
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
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/accelerators/spoken_feedback_toggler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698