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

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

Issue 2249583002: Revert "Enable ash window cycle UI by default." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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') | 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/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_and_release_alt_tab = [&generator]() {
1128 generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN);
1129 // Release the alt key to trigger the window activation.
1130 generator.ReleaseKey(ui::VKEY_MENU, ui::EF_NONE);
1131 };
1132
1133 // A fullscreen window can consume ALT-TAB (preferred). 1127 // A fullscreen window can consume ALT-TAB (preferred).
1134 ASSERT_EQ(w1, wm::GetActiveWindow()); 1128 ASSERT_EQ(w1, wm::GetActiveWindow());
1135 press_and_release_alt_tab(); 1129 generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN);
1136 ASSERT_EQ(w1, wm::GetActiveWindow()); 1130 ASSERT_EQ(w1, wm::GetActiveWindow());
1137 ASSERT_NE(w2, wm::GetActiveWindow()); 1131 ASSERT_NE(w2, wm::GetActiveWindow());
1138 1132
1139 // ALT-TAB is non repeatable. Press A to cancel the 1133 // ALT-TAB is non repeatable. Press A to cancel the
1140 // repeat record. 1134 // repeat record.
1141 generator.PressKey(ui::VKEY_A, ui::EF_NONE); 1135 generator.PressKey(ui::VKEY_A, ui::EF_NONE);
1142 generator.ReleaseKey(ui::VKEY_A, ui::EF_NONE); 1136 generator.ReleaseKey(ui::VKEY_A, ui::EF_NONE);
1143 1137
1144 // A normal window shouldn't consume preferred accelerator. 1138 // A normal window shouldn't consume preferred accelerator.
1145 wm::WMEvent normal(wm::WM_EVENT_NORMAL); 1139 wm::WMEvent normal(wm::WM_EVENT_NORMAL);
1146 w1_state->OnWMEvent(&normal); 1140 w1_state->OnWMEvent(&normal);
1147 ASSERT_FALSE(w1_state->IsFullscreen()); 1141 ASSERT_FALSE(w1_state->IsFullscreen());
1148 1142
1149 EXPECT_EQ(w1, wm::GetActiveWindow()); 1143 EXPECT_EQ(w1, wm::GetActiveWindow());
1150 press_and_release_alt_tab(); 1144 generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN);
1151 ASSERT_NE(w1, wm::GetActiveWindow()); 1145 ASSERT_NE(w1, wm::GetActiveWindow());
1152 ASSERT_EQ(w2, wm::GetActiveWindow()); 1146 ASSERT_EQ(w2, wm::GetActiveWindow());
1153 } 1147 }
1154 1148
1155 TEST_F(PreferredReservedAcceleratorsTest, AcceleratorsWithPinned) { 1149 TEST_F(PreferredReservedAcceleratorsTest, AcceleratorsWithPinned) {
1156 aura::Window* w1 = CreateTestWindowInShellWithId(0); 1150 aura::Window* w1 = CreateTestWindowInShellWithId(0);
1157 aura::Window* w2 = CreateTestWindowInShellWithId(1); 1151 aura::Window* w2 = CreateTestWindowInShellWithId(1);
1158 wm::ActivateWindow(w1); 1152 wm::ActivateWindow(w1);
1159 1153
1160 { 1154 {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 EXPECT_TRUE(IsMessageCenterEmpty()); 1407 EXPECT_TRUE(IsMessageCenterEmpty());
1414 1408
1415 // If the action is LOCK_SCREEN, we must reset the state by unlocking the 1409 // If the action is LOCK_SCREEN, we must reset the state by unlocking the
1416 // screen before we proceed testing the rest of accelerators. 1410 // screen before we proceed testing the rest of accelerators.
1417 ResetStateIfNeeded(); 1411 ResetStateIfNeeded();
1418 } 1412 }
1419 } 1413 }
1420 #endif // defined(OS_CHROMEOS) 1414 #endif // defined(OS_CHROMEOS)
1421 1415
1422 } // namespace ash 1416 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/ash_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698