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

Unified Diff: ash/common/wm/workspace/workspace_layout_manager_unittest.cc

Issue 2734933004: ash: Use SessionController instead of SessionStateDelegate (Closed)
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
Index: ash/common/wm/workspace/workspace_layout_manager_unittest.cc
diff --git a/ash/common/wm/workspace/workspace_layout_manager_unittest.cc b/ash/common/wm/workspace/workspace_layout_manager_unittest.cc
index 167fb314117bf059818a12910e27abb3088828e7..a89c861b1a70341fdca3e1510c623cdea66bbc04 100644
--- a/ash/common/wm/workspace/workspace_layout_manager_unittest.cc
+++ b/ash/common/wm/workspace/workspace_layout_manager_unittest.cc
@@ -4,16 +4,17 @@
#include "ash/common/wm/workspace/workspace_layout_manager.h"
+#include <memory>
#include <string>
#include <utility>
-#include "ash/common/session/session_state_delegate.h"
+#include "ash/common/session/session_controller.h"
#include "ash/common/shelf/shelf_constants.h"
#include "ash/common/shelf/shelf_layout_manager.h"
#include "ash/common/shelf/wm_shelf.h"
#include "ash/common/shell_observer.h"
#include "ash/common/test/ash_test.h"
-#include "ash/common/test/test_session_state_delegate.h"
+#include "ash/common/test/test_session_controller_client.h"
#include "ash/common/wm/fullscreen_window_finder.h"
#include "ash/common/wm/maximize_mode/workspace_backdrop_delegate.h"
#include "ash/common/wm/window_state.h"
@@ -27,6 +28,7 @@
#include "ash/shell.h"
#include "ash/wm/window_state_aura.h"
#include "base/command_line.h"
+#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
@@ -896,7 +898,11 @@ TEST_F(WorkspaceLayoutManagerSoloTest,
// Verify if the window is not resized during screen lock. See: crbug.com/173127
TEST_F(WorkspaceLayoutManagerSoloTest, NotResizeWhenScreenIsLocked) {
- test::TestSessionStateDelegate::SetCanLockScreen(true);
+ std::unique_ptr<test::TestSessionControllerClient> session_controller_client =
xiyuan 2017/03/17 07:08:15 Creating a new TestSessionControllerClient because
James Cook 2017/03/17 17:14:36 Could this test be switched to use AshTestBase? We
xiyuan 2017/03/17 22:52:02 That works in both ash_unittests and mash_unittest
James Cook 2017/03/18 18:40:05 Sounds good. I'm pretty sure we run tests based on
+ base::MakeUnique<test::TestSessionControllerClient>(
+ WmShell::Get()->session_controller());
+ session_controller_client->InitializeAndBind();
+ session_controller_client->SetCanLockScreen(true);
std::unique_ptr<WindowOwner> window_owner(
CreateTestWindow(gfx::Rect(1, 2, 3, 4)));
WmWindow* window = window_owner->window();
@@ -913,13 +919,13 @@ TEST_F(WorkspaceLayoutManagerSoloTest, NotResizeWhenScreenIsLocked) {
window_bounds.ToString());
// The window size should not get touched while we are in lock screen.
- WmShell::Get()->GetSessionStateDelegate()->LockScreen();
+ WmShell::Get()->session_controller()->LockScreenAndFlushForTest();
ShelfLayoutManager* shelf_layout_manager = shelf->shelf_layout_manager();
shelf_layout_manager->UpdateVisibilityState();
EXPECT_EQ(window_bounds.ToString(), window->GetBounds().ToString());
// Coming out of the lock screen the window size should still remain.
- WmShell::Get()->GetSessionStateDelegate()->UnlockScreen();
+ session_controller_client->UnlockScreen();
shelf_layout_manager->UpdateVisibilityState();
EXPECT_EQ(wm::GetMaximizedWindowBoundsInParent(window).ToString(),
window_bounds.ToString());

Powered by Google App Engine
This is Rietveld 408576698