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

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

Issue 2355063002: Separate ash::test::DisplayManagerTestApi from ash (Closed)
Patch Set: review comment Created 4 years, 2 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 window_state->Minimize(); 114 window_state->Minimize();
115 window_state->Restore(); 115 window_state->Restore();
116 EXPECT_EQ("0,0 100x100", window_state->GetRestoreBoundsInScreen().ToString()); 116 EXPECT_EQ("0,0 100x100", window_state->GetRestoreBoundsInScreen().ToString());
117 EXPECT_EQ("10,15 25x35", window.get()->bounds().ToString()); 117 EXPECT_EQ("10,15 25x35", window.get()->bounds().ToString());
118 118
119 if (!SupportsMultipleDisplays()) 119 if (!SupportsMultipleDisplays())
120 return; 120 return;
121 121
122 UpdateDisplay("400x300,500x400"); 122 UpdateDisplay("400x300,500x400");
123 window->SetBoundsInScreen(gfx::Rect(600, 0, 100, 100), 123 window->SetBoundsInScreen(gfx::Rect(600, 0, 100, 100),
124 ScreenUtil::GetSecondaryDisplay()); 124 display_manager()->GetSecondaryDisplay());
125 EXPECT_EQ(Shell::GetAllRootWindows()[1], window->GetRootWindow()); 125 EXPECT_EQ(Shell::GetAllRootWindows()[1], window->GetRootWindow());
126 window_state->Minimize(); 126 window_state->Minimize();
127 // This will not be used for un-minimizing window. 127 // This will not be used for un-minimizing window.
128 window_state->SetRestoreBoundsInScreen(gfx::Rect(0, 0, 100, 100)); 128 window_state->SetRestoreBoundsInScreen(gfx::Rect(0, 0, 100, 100));
129 window_state->Restore(); 129 window_state->Restore();
130 EXPECT_EQ("600,0 100x100", window->GetBoundsInScreen().ToString()); 130 EXPECT_EQ("600,0 100x100", window->GetBoundsInScreen().ToString());
131 131
132 // Make sure the unminimized window moves inside the display when 132 // Make sure the unminimized window moves inside the display when
133 // 2nd display is disconnected. 133 // 2nd display is disconnected.
134 window_state->Minimize(); 134 window_state->Minimize();
135 UpdateDisplay("400x300"); 135 UpdateDisplay("400x300");
136 window_state->Restore(); 136 window_state->Restore();
137 EXPECT_EQ(Shell::GetPrimaryRootWindow(), window->GetRootWindow()); 137 EXPECT_EQ(Shell::GetPrimaryRootWindow(), window->GetRootWindow());
138 EXPECT_TRUE( 138 EXPECT_TRUE(
139 Shell::GetPrimaryRootWindow()->bounds().Intersects(window->bounds())); 139 Shell::GetPrimaryRootWindow()->bounds().Intersects(window->bounds()));
140 } 140 }
141 141
142 TEST_F(WorkspaceLayoutManagerTest, KeepMinimumVisibilityInDisplays) { 142 TEST_F(WorkspaceLayoutManagerTest, KeepMinimumVisibilityInDisplays) {
143 if (!SupportsMultipleDisplays()) 143 if (!SupportsMultipleDisplays())
144 return; 144 return;
145 145
146 UpdateDisplay("300x400,400x500"); 146 UpdateDisplay("300x400,400x500");
147 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 147 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
148 148
149 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( 149 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays(
150 test::CreateDisplayLayout(display::DisplayPlacement::TOP, 0)); 150 test::CreateDisplayLayout(display_manager(),
151 display::DisplayPlacement::TOP, 0));
151 EXPECT_EQ("0,-500 400x500", root_windows[1]->GetBoundsInScreen().ToString()); 152 EXPECT_EQ("0,-500 400x500", root_windows[1]->GetBoundsInScreen().ToString());
152 153
153 std::unique_ptr<aura::Window> window1( 154 std::unique_ptr<aura::Window> window1(
154 CreateTestWindowInShellWithBounds(gfx::Rect(10, -400, 200, 200))); 155 CreateTestWindowInShellWithBounds(gfx::Rect(10, -400, 200, 200)));
155 EXPECT_EQ("10,-400 200x200", window1->GetBoundsInScreen().ToString()); 156 EXPECT_EQ("10,-400 200x200", window1->GetBoundsInScreen().ToString());
156 157
157 // Make sure the caption is visible. 158 // Make sure the caption is visible.
158 std::unique_ptr<aura::Window> window2( 159 std::unique_ptr<aura::Window> window2(
159 CreateTestWindowInShellWithBounds(gfx::Rect(10, -600, 200, 200))); 160 CreateTestWindowInShellWithBounds(gfx::Rect(10, -600, 200, 200)));
160 EXPECT_EQ("10,-500 200x200", window2->GetBoundsInScreen().ToString()); 161 EXPECT_EQ("10,-500 200x200", window2->GetBoundsInScreen().ToString());
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 changed_window_bounds.Offset(0, -shift); 1308 changed_window_bounds.Offset(0, -shift);
1308 // Window should be shifted up. 1309 // Window should be shifted up.
1309 EXPECT_EQ(changed_window_bounds, window->bounds()); 1310 EXPECT_EQ(changed_window_bounds, window->bounds());
1310 1311
1311 kb_controller->HideKeyboard( 1312 kb_controller->HideKeyboard(
1312 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); 1313 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC);
1313 EXPECT_EQ(orig_window_bounds, window->bounds()); 1314 EXPECT_EQ(orig_window_bounds, window->bounds());
1314 } 1315 }
1315 1316
1316 } // namespace ash 1317 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_event_handler_unittest.cc ('k') | ash/wm/workspace/workspace_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698