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

Side by Side Diff: ash/common/wm/workspace/workspace_layout_manager_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/common/wm/workspace/workspace_layout_manager.cc ('k') | ash/common/wm_shell.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 (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/common/wm/workspace/workspace_layout_manager.h" 5 #include "ash/common/wm/workspace/workspace_layout_manager.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/common/session/session_state_delegate.h" 10 #include "ash/common/session/session_controller.h"
11 #include "ash/common/shelf/shelf_constants.h" 11 #include "ash/common/shelf/shelf_constants.h"
12 #include "ash/common/shelf/shelf_layout_manager.h" 12 #include "ash/common/shelf/shelf_layout_manager.h"
13 #include "ash/common/shelf/wm_shelf.h" 13 #include "ash/common/shelf/wm_shelf.h"
14 #include "ash/common/shell_observer.h" 14 #include "ash/common/shell_observer.h"
15 #include "ash/common/test/ash_test.h" 15 #include "ash/common/test/ash_test.h"
16 #include "ash/common/test/test_session_state_delegate.h" 16 #include "ash/common/test/test_session_controller_client.h"
17 #include "ash/common/wm/fullscreen_window_finder.h" 17 #include "ash/common/wm/fullscreen_window_finder.h"
18 #include "ash/common/wm/maximize_mode/workspace_backdrop_delegate.h" 18 #include "ash/common/wm/maximize_mode/workspace_backdrop_delegate.h"
19 #include "ash/common/wm/window_state.h" 19 #include "ash/common/wm/window_state.h"
20 #include "ash/common/wm/wm_event.h" 20 #include "ash/common/wm/wm_event.h"
21 #include "ash/common/wm/wm_screen_util.h" 21 #include "ash/common/wm/wm_screen_util.h"
22 #include "ash/common/wm/workspace/workspace_window_resizer.h" 22 #include "ash/common/wm/workspace/workspace_window_resizer.h"
23 #include "ash/common/wm_shell.h" 23 #include "ash/common/wm_shell.h"
24 #include "ash/common/wm_window.h" 24 #include "ash/common/wm_window.h"
25 #include "ash/public/cpp/shell_window_ids.h" 25 #include "ash/public/cpp/shell_window_ids.h"
26 #include "ash/root_window_controller.h" 26 #include "ash/root_window_controller.h"
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 EXPECT_EQ(bounds.ToString(), 903 EXPECT_EQ(bounds.ToString(),
904 window_state->GetRestoreBoundsInParent().ToString()); 904 window_state->GetRestoreBoundsInParent().ToString());
905 EXPECT_TRUE(window_state->IsMaximized()); 905 EXPECT_TRUE(window_state->IsMaximized());
906 906
907 window_state->Restore(); 907 window_state->Restore();
908 EXPECT_EQ(bounds.ToString(), window->GetBounds().ToString()); 908 EXPECT_EQ(bounds.ToString(), window->GetBounds().ToString());
909 } 909 }
910 910
911 // Verify if the window is not resized during screen lock. See: crbug.com/173127 911 // Verify if the window is not resized during screen lock. See: crbug.com/173127
912 TEST_F(WorkspaceLayoutManagerSoloTest, NotResizeWhenScreenIsLocked) { 912 TEST_F(WorkspaceLayoutManagerSoloTest, NotResizeWhenScreenIsLocked) {
913 test::TestSessionStateDelegate::SetCanLockScreen(true); 913 SetCanLockScreen(true);
914 std::unique_ptr<aura::Window> window_owner( 914 std::unique_ptr<aura::Window> window_owner(
915 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4))); 915 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4)));
916 WmWindow* window = WmWindow::Get(window_owner.get()); 916 WmWindow* window = WmWindow::Get(window_owner.get());
917 // window with AlwaysOnTop will be managed by BaseLayoutManager. 917 // window with AlwaysOnTop will be managed by BaseLayoutManager.
918 window->SetAlwaysOnTop(true); 918 window->SetAlwaysOnTop(true);
919 window->Show(); 919 window->Show();
920 920
921 WmShelf* shelf = GetPrimaryShelf(); 921 WmShelf* shelf = GetPrimaryShelf();
922 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 922 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
923 923
924 window->SetBounds(wm::GetMaximizedWindowBoundsInParent(window)); 924 window->SetBounds(wm::GetMaximizedWindowBoundsInParent(window));
925 gfx::Rect window_bounds = window->GetBounds(); 925 gfx::Rect window_bounds = window->GetBounds();
926 EXPECT_EQ(wm::GetMaximizedWindowBoundsInParent(window).ToString(), 926 EXPECT_EQ(wm::GetMaximizedWindowBoundsInParent(window).ToString(),
927 window_bounds.ToString()); 927 window_bounds.ToString());
928 928
929 // The window size should not get touched while we are in lock screen. 929 // The window size should not get touched while we are in lock screen.
930 WmShell::Get()->GetSessionStateDelegate()->LockScreen(); 930 WmShell::Get()->session_controller()->LockScreenAndFlushForTest();
931 ShelfLayoutManager* shelf_layout_manager = shelf->shelf_layout_manager(); 931 ShelfLayoutManager* shelf_layout_manager = shelf->shelf_layout_manager();
932 shelf_layout_manager->UpdateVisibilityState(); 932 shelf_layout_manager->UpdateVisibilityState();
933 EXPECT_EQ(window_bounds.ToString(), window->GetBounds().ToString()); 933 EXPECT_EQ(window_bounds.ToString(), window->GetBounds().ToString());
934 934
935 // Coming out of the lock screen the window size should still remain. 935 // Coming out of the lock screen the window size should still remain.
936 WmShell::Get()->GetSessionStateDelegate()->UnlockScreen(); 936 GetSessionControllerClient()->UnlockScreen();
937 shelf_layout_manager->UpdateVisibilityState(); 937 shelf_layout_manager->UpdateVisibilityState();
938 EXPECT_EQ(wm::GetMaximizedWindowBoundsInParent(window).ToString(), 938 EXPECT_EQ(wm::GetMaximizedWindowBoundsInParent(window).ToString(),
939 window_bounds.ToString()); 939 window_bounds.ToString());
940 EXPECT_EQ(window_bounds.ToString(), window->GetBounds().ToString()); 940 EXPECT_EQ(window_bounds.ToString(), window->GetBounds().ToString());
941 } 941 }
942 942
943 // Following tests are written to test the backdrop functionality. 943 // Following tests are written to test the backdrop functionality.
944 944
945 namespace { 945 namespace {
946 946
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 window->SetBounds(keyboard_bounds()); 1279 window->SetBounds(keyboard_bounds());
1280 window->GetWindowState()->set_ignore_keyboard_bounds_change(true); 1280 window->GetWindowState()->set_ignore_keyboard_bounds_change(true);
1281 window->Activate(); 1281 window->Activate();
1282 1282
1283 EXPECT_EQ(keyboard_bounds(), window->GetBounds()); 1283 EXPECT_EQ(keyboard_bounds(), window->GetBounds());
1284 ShowKeyboard(); 1284 ShowKeyboard();
1285 EXPECT_EQ(keyboard_bounds(), window->GetBounds()); 1285 EXPECT_EQ(keyboard_bounds(), window->GetBounds());
1286 } 1286 }
1287 1287
1288 } // namespace ash 1288 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/workspace/workspace_layout_manager.cc ('k') | ash/common/wm_shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698