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

Side by Side Diff: ash/wm/window_cycle_controller_unittest.cc

Issue 2734933004: ash: Use SessionController instead of SessionStateDelegate (Closed)
Patch Set: rebase to get WorkspaceLayoutManagerSoloTest change Created 3 years, 9 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 | « ash/wm/power_button_controller.cc ('k') | chrome/browser/chromeos/login/lock/screen_locker.cc » ('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 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/common/wm/window_cycle_controller.h" 5 #include "ash/common/wm/window_cycle_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/common/focus_cycler.h" 10 #include "ash/common/focus_cycler.h"
11 #include "ash/common/scoped_root_window_for_new_windows.h" 11 #include "ash/common/scoped_root_window_for_new_windows.h"
12 #include "ash/common/session/session_state_delegate.h" 12 #include "ash/common/session/session_controller.h"
13 #include "ash/common/shelf/shelf_widget.h" 13 #include "ash/common/shelf/shelf_widget.h"
14 #include "ash/common/shelf/wm_shelf.h" 14 #include "ash/common/shelf/wm_shelf.h"
15 #include "ash/common/test/test_session_controller_client.h"
15 #include "ash/common/test/test_shelf_delegate.h" 16 #include "ash/common/test/test_shelf_delegate.h"
16 #include "ash/common/wm/window_cycle_list.h" 17 #include "ash/common/wm/window_cycle_list.h"
17 #include "ash/common/wm/window_state.h" 18 #include "ash/common/wm/window_state.h"
18 #include "ash/common/wm/wm_event.h" 19 #include "ash/common/wm/wm_event.h"
19 #include "ash/common/wm_shell.h" 20 #include "ash/common/wm_shell.h"
20 #include "ash/common/wm_window.h" 21 #include "ash/common/wm_window.h"
21 #include "ash/public/cpp/shell_window_ids.h" 22 #include "ash/public/cpp/shell_window_ids.h"
22 #include "ash/shell.h" 23 #include "ash/shell.h"
23 #include "ash/test/ash_test_base.h" 24 #include "ash/test/ash_test_base.h"
24 #include "ash/test/shelf_view_test_api.h" 25 #include "ash/test/shelf_view_test_api.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 controller->HandleCycleWindow(WindowCycleController::BACKWARD); 220 controller->HandleCycleWindow(WindowCycleController::BACKWARD);
220 controller->CompleteCycling(); 221 controller->CompleteCycling();
221 EXPECT_TRUE(wm::IsActiveWindow(window1.get())); 222 EXPECT_TRUE(wm::IsActiveWindow(window1.get()));
222 223
223 // Reset our stacking order. 224 // Reset our stacking order.
224 wm::ActivateWindow(window2.get()); 225 wm::ActivateWindow(window2.get());
225 wm::ActivateWindow(window1.get()); 226 wm::ActivateWindow(window1.get());
226 wm::ActivateWindow(window0.get()); 227 wm::ActivateWindow(window0.get());
227 228
228 // When the screen is locked, cycling window does not take effect. 229 // When the screen is locked, cycling window does not take effect.
229 WmShell::Get()->GetSessionStateDelegate()->LockScreen(); 230 WmShell::Get()->session_controller()->LockScreenAndFlushForTest();
230 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); 231 EXPECT_TRUE(wm::IsActiveWindow(window0.get()));
231 controller->HandleCycleWindow(WindowCycleController::FORWARD); 232 controller->HandleCycleWindow(WindowCycleController::FORWARD);
232 EXPECT_FALSE(controller->IsCycling()); 233 EXPECT_FALSE(controller->IsCycling());
233 234
234 // Unlock, it works again. 235 // Unlock, it works again.
235 WmShell::Get()->GetSessionStateDelegate()->UnlockScreen(); 236 GetSessionControllerClient()->UnlockScreen();
236 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); 237 EXPECT_TRUE(wm::IsActiveWindow(window0.get()));
237 controller->HandleCycleWindow(WindowCycleController::FORWARD); 238 controller->HandleCycleWindow(WindowCycleController::FORWARD);
238 controller->HandleCycleWindow(WindowCycleController::FORWARD); 239 controller->HandleCycleWindow(WindowCycleController::FORWARD);
239 controller->CompleteCycling(); 240 controller->CompleteCycling();
240 EXPECT_TRUE(wm::IsActiveWindow(window2.get())); 241 EXPECT_TRUE(wm::IsActiveWindow(window2.get()));
241 242
242 // When a modal window is active, cycling window does not take effect. 243 // When a modal window is active, cycling window does not take effect.
243 aura::Window* modal_container = Shell::GetContainer( 244 aura::Window* modal_container = Shell::GetContainer(
244 Shell::GetPrimaryRootWindow(), kShellWindowId_SystemModalContainer); 245 Shell::GetPrimaryRootWindow(), kShellWindowId_SystemModalContainer);
245 std::unique_ptr<Window> modal_window( 246 std::unique_ptr<Window> modal_window(
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 // Base case sets the expectation for other cases. 763 // Base case sets the expectation for other cases.
763 if (expected_bounds.IsEmpty()) 764 if (expected_bounds.IsEmpty())
764 expected_bounds = display_relative_bounds; 765 expected_bounds = display_relative_bounds;
765 else 766 else
766 EXPECT_EQ(expected_bounds, display_relative_bounds); 767 EXPECT_EQ(expected_bounds, display_relative_bounds);
767 controller->CompleteCycling(); 768 controller->CompleteCycling();
768 } 769 }
769 } 770 }
770 771
771 } // namespace ash 772 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/power_button_controller.cc ('k') | chrome/browser/chromeos/login/lock/screen_locker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698