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