| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/aura/wm_window_aura.h" | 10 #include "ash/aura/wm_window_aura.h" |
| 11 #include "ash/common/focus_cycler.h" |
| 11 #include "ash/common/session/session_state_delegate.h" | 12 #include "ash/common/session/session_state_delegate.h" |
| 12 #include "ash/common/shell_window_ids.h" | 13 #include "ash/common/shell_window_ids.h" |
| 13 #include "ash/common/wm/window_state.h" | 14 #include "ash/common/wm/window_state.h" |
| 15 #include "ash/common/wm_shell.h" |
| 14 #include "ash/shelf/shelf.h" | 16 #include "ash/shelf/shelf.h" |
| 15 #include "ash/shelf/shelf_widget.h" | 17 #include "ash/shelf/shelf_widget.h" |
| 16 #include "ash/shell.h" | 18 #include "ash/shell.h" |
| 17 #include "ash/test/ash_test_base.h" | 19 #include "ash/test/ash_test_base.h" |
| 18 #include "ash/test/shelf_test_api.h" | 20 #include "ash/test/shelf_test_api.h" |
| 19 #include "ash/test/shelf_view_test_api.h" | 21 #include "ash/test/shelf_view_test_api.h" |
| 20 #include "ash/test/test_shelf_delegate.h" | 22 #include "ash/test/test_shelf_delegate.h" |
| 21 #include "ash/test/test_shell_delegate.h" | 23 #include "ash/test/test_shell_delegate.h" |
| 22 #include "ash/wm/window_cycle_list.h" | 24 #include "ash/wm/window_cycle_list.h" |
| 23 #include "ash/wm/window_state_aura.h" | 25 #include "ash/wm/window_state_aura.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 WindowCycleController* controller = | 125 WindowCycleController* controller = |
| 124 Shell::GetInstance()->window_cycle_controller(); | 126 Shell::GetInstance()->window_cycle_controller(); |
| 125 | 127 |
| 126 // Create a single test window. | 128 // Create a single test window. |
| 127 std::unique_ptr<Window> window0(CreateTestWindowInShellWithId(0)); | 129 std::unique_ptr<Window> window0(CreateTestWindowInShellWithId(0)); |
| 128 wm::ActivateWindow(window0.get()); | 130 wm::ActivateWindow(window0.get()); |
| 129 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); | 131 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); |
| 130 | 132 |
| 131 // Rotate focus, this should move focus to another window that isn't part of | 133 // Rotate focus, this should move focus to another window that isn't part of |
| 132 // the default container. | 134 // the default container. |
| 133 Shell::GetInstance()->RotateFocus(Shell::FORWARD); | 135 WmShell::Get()->focus_cycler()->RotateFocus(FocusCycler::FORWARD); |
| 134 EXPECT_FALSE(wm::IsActiveWindow(window0.get())); | 136 EXPECT_FALSE(wm::IsActiveWindow(window0.get())); |
| 135 | 137 |
| 136 // Cycling should activate the window. | 138 // Cycling should activate the window. |
| 137 controller->HandleCycleWindow(WindowCycleController::FORWARD); | 139 controller->HandleCycleWindow(WindowCycleController::FORWARD); |
| 138 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); | 140 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); |
| 139 } | 141 } |
| 140 | 142 |
| 141 TEST_F(WindowCycleControllerTest, HandleCycleWindow) { | 143 TEST_F(WindowCycleControllerTest, HandleCycleWindow) { |
| 142 WindowCycleController* controller = | 144 WindowCycleController* controller = |
| 143 Shell::GetInstance()->window_cycle_controller(); | 145 Shell::GetInstance()->window_cycle_controller(); |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); | 637 generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); |
| 636 EXPECT_EQ(0u, key_count.GetCountAndReset()); | 638 EXPECT_EQ(0u, key_count.GetCountAndReset()); |
| 637 generator.ReleaseKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); | 639 generator.ReleaseKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); |
| 638 EXPECT_EQ(0u, key_count.GetCountAndReset()); | 640 EXPECT_EQ(0u, key_count.GetCountAndReset()); |
| 639 generator.ReleaseKey(ui::VKEY_MENU, ui::EF_NONE); | 641 generator.ReleaseKey(ui::VKEY_MENU, ui::EF_NONE); |
| 640 EXPECT_TRUE(wm::GetWindowState(w1.get())->IsActive()); | 642 EXPECT_TRUE(wm::GetWindowState(w1.get())->IsActive()); |
| 641 EXPECT_EQ(0u, key_count.GetCountAndReset()); | 643 EXPECT_EQ(0u, key_count.GetCountAndReset()); |
| 642 } | 644 } |
| 643 | 645 |
| 644 } // namespace ash | 646 } // namespace ash |
| OLD | NEW |