OLD | NEW |
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 "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" | 5 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "ash/wm/window_resizer.h" | 10 #include "ash/wm/window_resizer.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 Source source, | 179 Source source, |
180 const Browser* browser, | 180 const Browser* browser, |
181 const gfx::Rect& passed_in, | 181 const gfx::Rect& passed_in, |
182 gfx::Rect* out_bounds, | 182 gfx::Rect* out_bounds, |
183 ui::WindowShowState* out_show_state) { | 183 ui::WindowShowState* out_show_state) { |
184 DCHECK(out_show_state); | 184 DCHECK(out_show_state); |
185 TestScreen test_screen; | 185 TestScreen test_screen; |
186 test_screen.AddDisplay(monitor1_bounds, monitor1_work_area); | 186 test_screen.AddDisplay(monitor1_bounds, monitor1_work_area); |
187 if (!monitor2_bounds.IsEmpty()) | 187 if (!monitor2_bounds.IsEmpty()) |
188 test_screen.AddDisplay(monitor2_bounds, monitor2_bounds); | 188 test_screen.AddDisplay(monitor2_bounds, monitor2_bounds); |
189 scoped_ptr<TestStateProvider> sp(new TestStateProvider); | 189 std::unique_ptr<TestStateProvider> sp(new TestStateProvider); |
190 if (source == PERSISTED || source == BOTH) | 190 if (source == PERSISTED || source == BOTH) |
191 sp->SetPersistentState(bounds, work_area, show_state_persisted, true); | 191 sp->SetPersistentState(bounds, work_area, show_state_persisted, true); |
192 if (source == LAST_ACTIVE || source == BOTH) | 192 if (source == LAST_ACTIVE || source == BOTH) |
193 sp->SetLastActiveState(bounds, show_state_last, true); | 193 sp->SetLastActiveState(bounds, show_state_last, true); |
194 scoped_ptr<WindowSizer::TargetDisplayProvider> tdp( | 194 std::unique_ptr<WindowSizer::TargetDisplayProvider> tdp( |
195 new TestTargetDisplayProvider); | 195 new TestTargetDisplayProvider); |
196 | 196 |
197 WindowSizer sizer(std::move(sp), std::move(tdp), &test_screen, browser); | 197 WindowSizer sizer(std::move(sp), std::move(tdp), &test_screen, browser); |
198 sizer.DetermineWindowBoundsAndShowState(passed_in, | 198 sizer.DetermineWindowBoundsAndShowState(passed_in, |
199 out_bounds, | 199 out_bounds, |
200 out_show_state); | 200 out_show_state); |
201 } | 201 } |
202 | 202 |
203 void GetWindowBounds(const gfx::Rect& monitor1_bounds, | 203 void GetWindowBounds(const gfx::Rect& monitor1_bounds, |
204 const gfx::Rect& monitor1_work_area, | 204 const gfx::Rect& monitor1_work_area, |
(...skipping 13 matching lines...) Expand all Loading... |
218 | 218 |
219 ui::WindowShowState GetWindowShowState( | 219 ui::WindowShowState GetWindowShowState( |
220 ui::WindowShowState show_state_persisted, | 220 ui::WindowShowState show_state_persisted, |
221 ui::WindowShowState show_state_last, | 221 ui::WindowShowState show_state_last, |
222 Source source, | 222 Source source, |
223 const Browser* browser, | 223 const Browser* browser, |
224 const gfx::Rect& bounds, | 224 const gfx::Rect& bounds, |
225 const gfx::Rect& display_config) { | 225 const gfx::Rect& display_config) { |
226 TestScreen test_screen; | 226 TestScreen test_screen; |
227 test_screen.AddDisplay(display_config, display_config); | 227 test_screen.AddDisplay(display_config, display_config); |
228 scoped_ptr<TestStateProvider> sp(new TestStateProvider); | 228 std::unique_ptr<TestStateProvider> sp(new TestStateProvider); |
229 if (source == PERSISTED || source == BOTH) | 229 if (source == PERSISTED || source == BOTH) |
230 sp->SetPersistentState(bounds, display_config, show_state_persisted, true); | 230 sp->SetPersistentState(bounds, display_config, show_state_persisted, true); |
231 if (source == LAST_ACTIVE || source == BOTH) | 231 if (source == LAST_ACTIVE || source == BOTH) |
232 sp->SetLastActiveState(bounds, show_state_last, true); | 232 sp->SetLastActiveState(bounds, show_state_last, true); |
233 scoped_ptr<WindowSizer::TargetDisplayProvider> tdp( | 233 std::unique_ptr<WindowSizer::TargetDisplayProvider> tdp( |
234 new TestTargetDisplayProvider); | 234 new TestTargetDisplayProvider); |
235 | 235 |
236 WindowSizer sizer(std::move(sp), std::move(tdp), &test_screen, browser); | 236 WindowSizer sizer(std::move(sp), std::move(tdp), &test_screen, browser); |
237 | 237 |
238 ui::WindowShowState out_show_state = ui::SHOW_STATE_DEFAULT; | 238 ui::WindowShowState out_show_state = ui::SHOW_STATE_DEFAULT; |
239 gfx::Rect out_bounds; | 239 gfx::Rect out_bounds; |
240 sizer.DetermineWindowBoundsAndShowState( | 240 sizer.DetermineWindowBoundsAndShowState( |
241 gfx::Rect(), | 241 gfx::Rect(), |
242 &out_bounds, | 242 &out_bounds, |
243 &out_show_state); | 243 &out_show_state); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 { // Check that a window which hangs out of the screen get moved back in. | 447 { // Check that a window which hangs out of the screen get moved back in. |
448 gfx::Rect window_bounds; | 448 gfx::Rect window_bounds; |
449 GetWindowBounds(p1024x768, p1024x768, gfx::Rect(), gfx::Rect(), | 449 GetWindowBounds(p1024x768, p1024x768, gfx::Rect(), gfx::Rect(), |
450 gfx::Rect(), DEFAULT, NULL, | 450 gfx::Rect(), DEFAULT, NULL, |
451 gfx::Rect(1020, 700, 100, 100), &window_bounds); | 451 gfx::Rect(1020, 700, 100, 100), &window_bounds); |
452 EXPECT_EQ("924,668 100x100", window_bounds.ToString()); | 452 EXPECT_EQ("924,668 100x100", window_bounds.ToString()); |
453 } | 453 } |
454 } | 454 } |
455 | 455 |
456 #endif // defined(OS_MACOSX) | 456 #endif // defined(OS_MACOSX) |
OLD | NEW |