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

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

Issue 2741273002: chromeos: Promotes more from WmShell to Shell (Closed)
Patch Set: feedback 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
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/common/wm/window_positioner.h" 5 #include "ash/common/wm/window_positioner.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/common/scoped_root_window_for_new_windows.h" 9 #include "ash/common/scoped_root_window_for_new_windows.h"
10 #include "ash/common/wm/window_positioner.h" 10 #include "ash/common/wm/window_positioner.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // maximized mode for low and high resolution when this policy is set. 140 // maximized mode for low and high resolution when this policy is set.
141 TEST_F(WindowPositionerTest, FirstRunMaximizeWindowHighResloution) { 141 TEST_F(WindowPositionerTest, FirstRunMaximizeWindowHighResloution) {
142 const int width = ash::WindowPositioner::GetForceMaximizedWidthLimit() + 100; 142 const int width = ash::WindowPositioner::GetForceMaximizedWidthLimit() + 100;
143 // Set resolution to 1466x300. 143 // Set resolution to 1466x300.
144 const std::string resolution = base::IntToString(width) + "x300"; 144 const std::string resolution = base::IntToString(width) + "x300";
145 UpdateDisplay(resolution); 145 UpdateDisplay(resolution);
146 gfx::Rect bounds_in_out(0, 0, 320, 240); // Random bounds. 146 gfx::Rect bounds_in_out(0, 0, 320, 240); // Random bounds.
147 ui::WindowShowState show_state_out = ui::SHOW_STATE_DEFAULT; 147 ui::WindowShowState show_state_out = ui::SHOW_STATE_DEFAULT;
148 148
149 test::TestShellDelegate* const delegate = 149 test::TestShellDelegate* const delegate =
150 static_cast<test::TestShellDelegate*>(WmShell::Get()->delegate()); 150 static_cast<test::TestShellDelegate*>(Shell::Get()->shell_delegate());
151 delegate->SetForceMaximizeOnFirstRun(true); 151 delegate->SetForceMaximizeOnFirstRun(true);
152 152
153 WindowPositioner::GetBoundsAndShowStateForNewWindow( 153 WindowPositioner::GetBoundsAndShowStateForNewWindow(
154 nullptr, false, ui::SHOW_STATE_DEFAULT, &bounds_in_out, &show_state_out); 154 nullptr, false, ui::SHOW_STATE_DEFAULT, &bounds_in_out, &show_state_out);
155 155
156 EXPECT_EQ(show_state_out, ui::SHOW_STATE_MAXIMIZED); 156 EXPECT_EQ(show_state_out, ui::SHOW_STATE_MAXIMIZED);
157 } 157 }
158 158
159 // For detail see description of FirstRunMaximizeWindowHighResloution. 159 // For detail see description of FirstRunMaximizeWindowHighResloution.
160 TEST_F(WindowPositionerTest, FirstRunMaximizeWindowLowResolution) { 160 TEST_F(WindowPositionerTest, FirstRunMaximizeWindowLowResolution) {
161 const int width = ash::WindowPositioner::GetForceMaximizedWidthLimit() - 100; 161 const int width = ash::WindowPositioner::GetForceMaximizedWidthLimit() - 100;
162 // Set resolution to 1266x300. 162 // Set resolution to 1266x300.
163 const std::string resolution = base::IntToString(width) + "x300"; 163 const std::string resolution = base::IntToString(width) + "x300";
164 UpdateDisplay(resolution); 164 UpdateDisplay(resolution);
165 gfx::Rect bounds_in_out(0, 0, 320, 240); // Random bounds. 165 gfx::Rect bounds_in_out(0, 0, 320, 240); // Random bounds.
166 ui::WindowShowState show_state_out = ui::SHOW_STATE_DEFAULT; 166 ui::WindowShowState show_state_out = ui::SHOW_STATE_DEFAULT;
167 167
168 test::TestShellDelegate* const delegate = 168 test::TestShellDelegate* const delegate =
169 static_cast<test::TestShellDelegate*>(WmShell::Get()->delegate()); 169 static_cast<test::TestShellDelegate*>(Shell::Get()->shell_delegate());
170 delegate->SetForceMaximizeOnFirstRun(true); 170 delegate->SetForceMaximizeOnFirstRun(true);
171 171
172 WindowPositioner::GetBoundsAndShowStateForNewWindow( 172 WindowPositioner::GetBoundsAndShowStateForNewWindow(
173 nullptr, false, ui::SHOW_STATE_DEFAULT, &bounds_in_out, &show_state_out); 173 nullptr, false, ui::SHOW_STATE_DEFAULT, &bounds_in_out, &show_state_out);
174 174
175 EXPECT_EQ(show_state_out, ui::SHOW_STATE_MAXIMIZED); 175 EXPECT_EQ(show_state_out, ui::SHOW_STATE_MAXIMIZED);
176 } 176 }
177 177
178 TEST_F(WindowPositionerTest, IgnoreFullscreenInAutoRearrange) { 178 TEST_F(WindowPositionerTest, IgnoreFullscreenInAutoRearrange) {
179 // Set bigger than 1366 so that the new window is opened in normal state. 179 // Set bigger than 1366 so that the new window is opened in normal state.
(...skipping 22 matching lines...) Expand all
202 widget1->SetFullscreen(false); 202 widget1->SetFullscreen(false);
203 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString()); 203 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString());
204 204
205 // Closing 2nd widget triggers the rearrange logic but the 1st 205 // Closing 2nd widget triggers the rearrange logic but the 1st
206 // widget should stay in the current size. 206 // widget should stay in the current size.
207 widget2->CloseNow(); 207 widget2->CloseNow();
208 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString()); 208 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString());
209 } 209 }
210 210
211 } // namespace ash 211 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/lock_state_controller_unittest.cc ('k') | chrome/browser/chromeos/arc/print/arc_print_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698