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

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

Issue 1900443002: Removes aura dependencies from WindowPositioner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nuke GetWorkAreaForWindowInParent and fix windows Created 4 years, 8 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/window_positioner.cc ('k') | ash/wm/window_resizer.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/wm/window_positioner.h" 5 #include "ash/wm/window_positioner.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell/toplevel_window.h" 10 #include "ash/shell/toplevel_window.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 const std::string resolution = base::IntToString(width) + "x300"; 173 const std::string resolution = base::IntToString(width) + "x300";
174 UpdateDisplay(resolution); 174 UpdateDisplay(resolution);
175 gfx::Rect bounds_in_out(0, 0, 320, 240); // Random bounds. 175 gfx::Rect bounds_in_out(0, 0, 320, 240); // Random bounds.
176 ui::WindowShowState show_state_out = ui::SHOW_STATE_DEFAULT; 176 ui::WindowShowState show_state_out = ui::SHOW_STATE_DEFAULT;
177 177
178 test::TestShellDelegate* const delegate = 178 test::TestShellDelegate* const delegate =
179 static_cast<test::TestShellDelegate*>(Shell::GetInstance()->delegate()); 179 static_cast<test::TestShellDelegate*>(Shell::GetInstance()->delegate());
180 delegate->SetForceMaximizeOnFirstRun(true); 180 delegate->SetForceMaximizeOnFirstRun(true);
181 181
182 WindowPositioner::GetBoundsAndShowStateForNewWindow( 182 WindowPositioner::GetBoundsAndShowStateForNewWindow(
183 gfx::Screen::GetScreen(), nullptr, false, ui::SHOW_STATE_DEFAULT, 183 nullptr, false, ui::SHOW_STATE_DEFAULT, &bounds_in_out, &show_state_out);
184 &bounds_in_out, &show_state_out);
185 184
186 EXPECT_EQ(show_state_out, ui::SHOW_STATE_MAXIMIZED); 185 EXPECT_EQ(show_state_out, ui::SHOW_STATE_MAXIMIZED);
187 } 186 }
188 187
189 // For detail see description of FirstRunMaximizeWindowHighResloution. 188 // For detail see description of FirstRunMaximizeWindowHighResloution.
190 TEST_F(WindowPositionerTest, FirstRunMaximizeWindowLowResolution) { 189 TEST_F(WindowPositionerTest, FirstRunMaximizeWindowLowResolution) {
191 const int width = ash::WindowPositioner::GetForceMaximizedWidthLimit() - 100; 190 const int width = ash::WindowPositioner::GetForceMaximizedWidthLimit() - 100;
192 // Set resolution to 1266x300. 191 // Set resolution to 1266x300.
193 const std::string resolution = base::IntToString(width) + "x300"; 192 const std::string resolution = base::IntToString(width) + "x300";
194 UpdateDisplay(resolution); 193 UpdateDisplay(resolution);
195 gfx::Rect bounds_in_out(0, 0, 320, 240); // Random bounds. 194 gfx::Rect bounds_in_out(0, 0, 320, 240); // Random bounds.
196 ui::WindowShowState show_state_out = ui::SHOW_STATE_DEFAULT; 195 ui::WindowShowState show_state_out = ui::SHOW_STATE_DEFAULT;
197 196
198 test::TestShellDelegate* const delegate = 197 test::TestShellDelegate* const delegate =
199 static_cast<test::TestShellDelegate*>(Shell::GetInstance()->delegate()); 198 static_cast<test::TestShellDelegate*>(Shell::GetInstance()->delegate());
200 delegate->SetForceMaximizeOnFirstRun(true); 199 delegate->SetForceMaximizeOnFirstRun(true);
201 200
202 WindowPositioner::GetBoundsAndShowStateForNewWindow( 201 WindowPositioner::GetBoundsAndShowStateForNewWindow(
203 gfx::Screen::GetScreen(), nullptr, false, ui::SHOW_STATE_DEFAULT, 202 nullptr, false, ui::SHOW_STATE_DEFAULT, &bounds_in_out, &show_state_out);
204 &bounds_in_out, &show_state_out);
205 203
206 EXPECT_EQ(show_state_out, ui::SHOW_STATE_MAXIMIZED); 204 EXPECT_EQ(show_state_out, ui::SHOW_STATE_MAXIMIZED);
207 } 205 }
208 206
209 TEST_F(WindowPositionerTest, IgnoreFullscreenInAutoRearrange) { 207 TEST_F(WindowPositionerTest, IgnoreFullscreenInAutoRearrange) {
210 if (!SupportsHostWindowResize()) 208 if (!SupportsHostWindowResize())
211 return; 209 return;
212 // Set bigger than 1366 so that the new window is opened in normal state. 210 // Set bigger than 1366 so that the new window is opened in normal state.
213 UpdateDisplay("1400x800"); 211 UpdateDisplay("1400x800");
214 212
(...skipping 20 matching lines...) Expand all
235 widget1->SetFullscreen(false); 233 widget1->SetFullscreen(false);
236 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString()); 234 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString());
237 235
238 // Closing 2nd widget triggers the rearrange logic but the 1st 236 // Closing 2nd widget triggers the rearrange logic but the 1st
239 // widget should stay in the current size. 237 // widget should stay in the current size.
240 widget2->CloseNow(); 238 widget2->CloseNow();
241 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString()); 239 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString());
242 } 240 }
243 241
244 } // namespace ash 242 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_positioner.cc ('k') | ash/wm/window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698