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

Side by Side Diff: ash/wm/workspace/workspace_layout_manager_unittest.cc

Issue 2111443002: mash: Migrate SessionStateDelegate access to WmShell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 5 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
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/aura/wm_window_aura.h" 10 #include "ash/aura/wm_window_aura.h"
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 Shelf* shelf = Shelf::ForWindow(window.get()); 832 Shelf* shelf = Shelf::ForWindow(window.get());
833 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 833 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
834 834
835 window->SetBounds(ScreenUtil::GetMaximizedWindowBoundsInParent(window.get())); 835 window->SetBounds(ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()));
836 gfx::Rect window_bounds = window->bounds(); 836 gfx::Rect window_bounds = window->bounds();
837 EXPECT_EQ( 837 EXPECT_EQ(
838 ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()).ToString(), 838 ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()).ToString(),
839 window_bounds.ToString()); 839 window_bounds.ToString());
840 840
841 // The window size should not get touched while we are in lock screen. 841 // The window size should not get touched while we are in lock screen.
842 Shell::GetInstance()->session_state_delegate()->LockScreen(); 842 WmShell::Get()->GetSessionStateDelegate()->LockScreen();
843 ShelfLayoutManager* shelf_layout_manager = shelf->shelf_layout_manager(); 843 ShelfLayoutManager* shelf_layout_manager = shelf->shelf_layout_manager();
844 shelf_layout_manager->UpdateVisibilityState(); 844 shelf_layout_manager->UpdateVisibilityState();
845 EXPECT_EQ(window_bounds.ToString(), window->bounds().ToString()); 845 EXPECT_EQ(window_bounds.ToString(), window->bounds().ToString());
846 846
847 // Coming out of the lock screen the window size should still remain. 847 // Coming out of the lock screen the window size should still remain.
848 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); 848 WmShell::Get()->GetSessionStateDelegate()->UnlockScreen();
849 shelf_layout_manager->UpdateVisibilityState(); 849 shelf_layout_manager->UpdateVisibilityState();
850 EXPECT_EQ( 850 EXPECT_EQ(
851 ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()).ToString(), 851 ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()).ToString(),
852 window_bounds.ToString()); 852 window_bounds.ToString());
853 EXPECT_EQ(window_bounds.ToString(), window->bounds().ToString()); 853 EXPECT_EQ(window_bounds.ToString(), window->bounds().ToString());
854 } 854 }
855 855
856 // Following tests are written to test the backdrop functionality. 856 // Following tests are written to test the backdrop functionality.
857 857
858 namespace { 858 namespace {
(...skipping 15 matching lines...) Expand all
874 kShellWindowId_DefaultContainer); 874 kShellWindowId_DefaultContainer);
875 } 875 }
876 876
877 aura::Window* CreateTestWindow(const gfx::Rect& bounds) { 877 aura::Window* CreateTestWindow(const gfx::Rect& bounds) {
878 aura::Window* window = CreateTestWindowInShellWithBounds(bounds); 878 aura::Window* window = CreateTestWindowInShellWithBounds(bounds);
879 return window; 879 return window;
880 } 880 }
881 881
882 // Turn the top window back drop on / off. 882 // Turn the top window back drop on / off.
883 void ShowTopWindowBackdrop(bool show) { 883 void ShowTopWindowBackdrop(bool show) {
884 std::unique_ptr<ash::WorkspaceLayoutManagerBackdropDelegate> backdrop; 884 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> backdrop;
885 if (show) { 885 if (show) {
886 backdrop.reset(new ash::WorkspaceBackdropDelegate( 886 backdrop.reset(new WorkspaceBackdropDelegate(
887 WmWindowAura::Get(default_container_))); 887 WmWindowAura::Get(default_container_)));
888 } 888 }
889 GetWorkspaceLayoutManager(default_container_) 889 GetWorkspaceLayoutManager(default_container_)
890 ->SetMaximizeBackdropDelegate(std::move(backdrop)); 890 ->SetMaximizeBackdropDelegate(std::move(backdrop));
891 // Closing and / or opening can be a delayed operation. 891 // Closing and / or opening can be a delayed operation.
892 base::RunLoop().RunUntilIdle(); 892 base::RunLoop().RunUntilIdle();
893 } 893 }
894 894
895 // Return the default container. 895 // Return the default container.
896 aura::Window* default_container() { return default_container_; } 896 aura::Window* default_container() { return default_container_; }
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 CreateTestWindowInShellWithDelegate(&delegate2, -1, keyboard_bounds())); 1190 CreateTestWindowInShellWithDelegate(&delegate2, -1, keyboard_bounds()));
1191 wm::GetWindowState(window.get())->set_ignore_keyboard_bounds_change(true); 1191 wm::GetWindowState(window.get())->set_ignore_keyboard_bounds_change(true);
1192 wm::ActivateWindow(window.get()); 1192 wm::ActivateWindow(window.get());
1193 1193
1194 EXPECT_EQ(keyboard_bounds(), window->bounds()); 1194 EXPECT_EQ(keyboard_bounds(), window->bounds());
1195 ShowKeyboard(); 1195 ShowKeyboard();
1196 EXPECT_EQ(keyboard_bounds(), window->bounds()); 1196 EXPECT_EQ(keyboard_bounds(), window->bounds());
1197 } 1197 }
1198 1198
1199 } // namespace ash 1199 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698