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

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

Issue 2234233002: Enable ash window cycle UI by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more coverage Created 4 years, 4 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 | « no previous file | ash/common/ash_switches.h » ('j') | ash/common/wm/window_cycle_controller.cc » ('J')
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/common/accelerators/accelerator_controller.h" 5 #include "ash/common/accelerators/accelerator_controller.h"
6 6
7 #include "ash/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/accelerators/accelerator_table.h" 8 #include "ash/common/accelerators/accelerator_table.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 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 ui::test::EventGenerator& generator = GetEventGenerator(); 1117 ui::test::EventGenerator& generator = GetEventGenerator();
1118 #if defined(OS_CHROMEOS) 1118 #if defined(OS_CHROMEOS)
1119 // Power key (reserved) should always be handled. 1119 // Power key (reserved) should always be handled.
1120 LockStateController::TestApi test_api( 1120 LockStateController::TestApi test_api(
1121 Shell::GetInstance()->lock_state_controller()); 1121 Shell::GetInstance()->lock_state_controller());
1122 EXPECT_FALSE(test_api.is_animating_lock()); 1122 EXPECT_FALSE(test_api.is_animating_lock());
1123 generator.PressKey(ui::VKEY_POWER, ui::EF_NONE); 1123 generator.PressKey(ui::VKEY_POWER, ui::EF_NONE);
1124 EXPECT_TRUE(test_api.is_animating_lock()); 1124 EXPECT_TRUE(test_api.is_animating_lock());
1125 #endif 1125 #endif
1126 1126
1127 auto press_alt_tab = [&generator]() {
sky 2016/08/13 15:56:06 optional: press_alt_tab is easy to assume means on
Evan Stade 2016/08/14 01:43:12 Done.
1128 generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN);
1129 // Release the alt key to complete Alt+Tab.
1130 generator.ReleaseKey(ui::VKEY_MENU, ui::EF_NONE);
1131 };
1132
1127 // A fullscreen window can consume ALT-TAB (preferred). 1133 // A fullscreen window can consume ALT-TAB (preferred).
1128 ASSERT_EQ(w1, wm::GetActiveWindow()); 1134 ASSERT_EQ(w1, wm::GetActiveWindow());
1129 generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); 1135 press_alt_tab();
1130 ASSERT_EQ(w1, wm::GetActiveWindow()); 1136 ASSERT_EQ(w1, wm::GetActiveWindow());
1131 ASSERT_NE(w2, wm::GetActiveWindow()); 1137 ASSERT_NE(w2, wm::GetActiveWindow());
1132 1138
1133 // ALT-TAB is non repeatable. Press A to cancel the 1139 // ALT-TAB is non repeatable. Press A to cancel the
1134 // repeat record. 1140 // repeat record.
1135 generator.PressKey(ui::VKEY_A, ui::EF_NONE); 1141 generator.PressKey(ui::VKEY_A, ui::EF_NONE);
1136 generator.ReleaseKey(ui::VKEY_A, ui::EF_NONE); 1142 generator.ReleaseKey(ui::VKEY_A, ui::EF_NONE);
1137 1143
1138 // A normal window shouldn't consume preferred accelerator. 1144 // A normal window shouldn't consume preferred accelerator.
1139 wm::WMEvent normal(wm::WM_EVENT_NORMAL); 1145 wm::WMEvent normal(wm::WM_EVENT_NORMAL);
1140 w1_state->OnWMEvent(&normal); 1146 w1_state->OnWMEvent(&normal);
1141 ASSERT_FALSE(w1_state->IsFullscreen()); 1147 ASSERT_FALSE(w1_state->IsFullscreen());
1142 1148
1143 EXPECT_EQ(w1, wm::GetActiveWindow()); 1149 EXPECT_EQ(w1, wm::GetActiveWindow());
1144 generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); 1150 press_alt_tab();
1145 ASSERT_NE(w1, wm::GetActiveWindow()); 1151 ASSERT_NE(w1, wm::GetActiveWindow());
1146 ASSERT_EQ(w2, wm::GetActiveWindow()); 1152 ASSERT_EQ(w2, wm::GetActiveWindow());
1147 } 1153 }
1148 1154
1149 TEST_F(PreferredReservedAcceleratorsTest, AcceleratorsWithPinned) { 1155 TEST_F(PreferredReservedAcceleratorsTest, AcceleratorsWithPinned) {
1150 aura::Window* w1 = CreateTestWindowInShellWithId(0); 1156 aura::Window* w1 = CreateTestWindowInShellWithId(0);
1151 aura::Window* w2 = CreateTestWindowInShellWithId(1); 1157 aura::Window* w2 = CreateTestWindowInShellWithId(1);
1152 wm::ActivateWindow(w1); 1158 wm::ActivateWindow(w1);
1153 1159
1154 { 1160 {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 EXPECT_TRUE(IsMessageCenterEmpty()); 1413 EXPECT_TRUE(IsMessageCenterEmpty());
1408 1414
1409 // If the action is LOCK_SCREEN, we must reset the state by unlocking the 1415 // If the action is LOCK_SCREEN, we must reset the state by unlocking the
1410 // screen before we proceed testing the rest of accelerators. 1416 // screen before we proceed testing the rest of accelerators.
1411 ResetStateIfNeeded(); 1417 ResetStateIfNeeded();
1412 } 1418 }
1413 } 1419 }
1414 #endif // defined(OS_CHROMEOS) 1420 #endif // defined(OS_CHROMEOS)
1415 1421
1416 } // namespace ash 1422 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/ash_switches.h » ('j') | ash/common/wm/window_cycle_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698