OLD | NEW |
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/wm/window_cycle_controller.h" | 5 #include "ash/wm/window_cycle_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/display/display_controller.h" | 9 #include "ash/display/display_controller.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
11 #include "ash/session_state_delegate.h" | |
12 #include "ash/shell.h" | 11 #include "ash/shell.h" |
13 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
14 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.h" |
15 #include "ash/test/test_shell_delegate.h" | 14 #include "ash/test/test_shell_delegate.h" |
16 #include "ash/wm/window_cycle_list.h" | 15 #include "ash/wm/window_cycle_list.h" |
17 #include "ash/wm/window_util.h" | 16 #include "ash/wm/window_util.h" |
18 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
19 #include "ui/aura/client/aura_constants.h" | 18 #include "ui/aura/client/aura_constants.h" |
20 #include "ui/aura/client/screen_position_client.h" | 19 #include "ui/aura/client/screen_position_client.h" |
21 #include "ui/aura/env.h" | 20 #include "ui/aura/env.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // Passing false for is_alt_down does not start a cycle gesture. | 138 // Passing false for is_alt_down does not start a cycle gesture. |
140 controller->HandleCycleWindow(WindowCycleController::FORWARD, false); | 139 controller->HandleCycleWindow(WindowCycleController::FORWARD, false); |
141 EXPECT_FALSE(controller->IsCycling()); | 140 EXPECT_FALSE(controller->IsCycling()); |
142 EXPECT_TRUE(wm::IsActiveWindow(window1.get())); | 141 EXPECT_TRUE(wm::IsActiveWindow(window1.get())); |
143 | 142 |
144 controller->HandleCycleWindow(WindowCycleController::FORWARD, false); | 143 controller->HandleCycleWindow(WindowCycleController::FORWARD, false); |
145 EXPECT_FALSE(controller->IsCycling()); | 144 EXPECT_FALSE(controller->IsCycling()); |
146 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); | 145 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); |
147 | 146 |
148 // When the screen is locked, cycling window does not take effect. | 147 // When the screen is locked, cycling window does not take effect. |
149 Shell::GetInstance()->session_state_delegate()->LockScreen(); | 148 Shell::GetInstance()->delegate()->LockScreen(); |
150 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); | 149 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); |
151 controller->HandleCycleWindow(WindowCycleController::FORWARD, false); | 150 controller->HandleCycleWindow(WindowCycleController::FORWARD, false); |
152 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); | 151 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); |
153 controller->HandleCycleWindow(WindowCycleController::BACKWARD, false); | 152 controller->HandleCycleWindow(WindowCycleController::BACKWARD, false); |
154 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); | 153 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); |
155 | 154 |
156 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); | 155 Shell::GetInstance()->delegate()->UnlockScreen(); |
157 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); | 156 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); |
158 controller->HandleCycleWindow(WindowCycleController::FORWARD, false); | 157 controller->HandleCycleWindow(WindowCycleController::FORWARD, false); |
159 EXPECT_TRUE(wm::IsActiveWindow(window1.get())); | 158 EXPECT_TRUE(wm::IsActiveWindow(window1.get())); |
160 controller->HandleCycleWindow(WindowCycleController::FORWARD, false); | 159 controller->HandleCycleWindow(WindowCycleController::FORWARD, false); |
161 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); | 160 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); |
162 | 161 |
163 // When a modal window is active, cycling window does not take effect. | 162 // When a modal window is active, cycling window does not take effect. |
164 aura::Window* modal_container = | 163 aura::Window* modal_container = |
165 ash::Shell::GetContainer( | 164 ash::Shell::GetContainer( |
166 Shell::GetPrimaryRootWindow(), | 165 Shell::GetPrimaryRootWindow(), |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 controller->HandleCycleWindow(WindowCycleController::FORWARD, true); | 441 controller->HandleCycleWindow(WindowCycleController::FORWARD, true); |
443 EXPECT_TRUE(wm::IsActiveWindow(window2.get())); | 442 EXPECT_TRUE(wm::IsActiveWindow(window2.get())); |
444 | 443 |
445 controller->HandleCycleWindow(WindowCycleController::FORWARD, true); | 444 controller->HandleCycleWindow(WindowCycleController::FORWARD, true); |
446 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); | 445 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); |
447 } | 446 } |
448 | 447 |
449 } // namespace | 448 } // namespace |
450 | 449 |
451 } // namespace ash | 450 } // namespace ash |
OLD | NEW |