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 "ash/wm/window_resizer.h" | 7 #include "ash/wm/window_resizer.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 if (!monitor2_bounds.IsEmpty()) | 200 if (!monitor2_bounds.IsEmpty()) |
201 test_screen.AddDisplay(monitor2_bounds, monitor2_bounds); | 201 test_screen.AddDisplay(monitor2_bounds, monitor2_bounds); |
202 scoped_ptr<TestStateProvider> sp(new TestStateProvider); | 202 scoped_ptr<TestStateProvider> sp(new TestStateProvider); |
203 if (source == PERSISTED || source == BOTH) | 203 if (source == PERSISTED || source == BOTH) |
204 sp->SetPersistentState(bounds, work_area, show_state_persisted, true); | 204 sp->SetPersistentState(bounds, work_area, show_state_persisted, true); |
205 if (source == LAST_ACTIVE || source == BOTH) | 205 if (source == LAST_ACTIVE || source == BOTH) |
206 sp->SetLastActiveState(bounds, show_state_last, true); | 206 sp->SetLastActiveState(bounds, show_state_last, true); |
207 scoped_ptr<WindowSizer::TargetDisplayProvider> tdp( | 207 scoped_ptr<WindowSizer::TargetDisplayProvider> tdp( |
208 new TestTargetDisplayProvider); | 208 new TestTargetDisplayProvider); |
209 | 209 |
210 WindowSizer sizer(sp.PassAs<WindowSizer::StateProvider>(), | 210 WindowSizer sizer(sp.Pass(), tdp.Pass(), &test_screen, browser); |
211 tdp.Pass(), &test_screen, browser); | |
212 sizer.DetermineWindowBoundsAndShowState(passed_in, | 211 sizer.DetermineWindowBoundsAndShowState(passed_in, |
213 out_bounds, | 212 out_bounds, |
214 out_show_state); | 213 out_show_state); |
215 } | 214 } |
216 | 215 |
217 void GetWindowBounds(const gfx::Rect& monitor1_bounds, | 216 void GetWindowBounds(const gfx::Rect& monitor1_bounds, |
218 const gfx::Rect& monitor1_work_area, | 217 const gfx::Rect& monitor1_work_area, |
219 const gfx::Rect& monitor2_bounds, | 218 const gfx::Rect& monitor2_bounds, |
220 const gfx::Rect& bounds, | 219 const gfx::Rect& bounds, |
221 const gfx::Rect& work_area, | 220 const gfx::Rect& work_area, |
(...skipping 18 matching lines...) Expand all Loading... |
240 TestScreen test_screen; | 239 TestScreen test_screen; |
241 test_screen.AddDisplay(display_config, display_config); | 240 test_screen.AddDisplay(display_config, display_config); |
242 scoped_ptr<TestStateProvider> sp(new TestStateProvider); | 241 scoped_ptr<TestStateProvider> sp(new TestStateProvider); |
243 if (source == PERSISTED || source == BOTH) | 242 if (source == PERSISTED || source == BOTH) |
244 sp->SetPersistentState(bounds, display_config, show_state_persisted, true); | 243 sp->SetPersistentState(bounds, display_config, show_state_persisted, true); |
245 if (source == LAST_ACTIVE || source == BOTH) | 244 if (source == LAST_ACTIVE || source == BOTH) |
246 sp->SetLastActiveState(bounds, show_state_last, true); | 245 sp->SetLastActiveState(bounds, show_state_last, true); |
247 scoped_ptr<WindowSizer::TargetDisplayProvider> tdp( | 246 scoped_ptr<WindowSizer::TargetDisplayProvider> tdp( |
248 new TestTargetDisplayProvider); | 247 new TestTargetDisplayProvider); |
249 | 248 |
250 WindowSizer sizer(sp.PassAs<WindowSizer::StateProvider>(), | 249 WindowSizer sizer(sp.Pass(), tdp.Pass(), &test_screen, browser); |
251 tdp.Pass(), &test_screen, browser); | |
252 | 250 |
253 ui::WindowShowState out_show_state = ui::SHOW_STATE_DEFAULT; | 251 ui::WindowShowState out_show_state = ui::SHOW_STATE_DEFAULT; |
254 gfx::Rect out_bounds; | 252 gfx::Rect out_bounds; |
255 sizer.DetermineWindowBoundsAndShowState( | 253 sizer.DetermineWindowBoundsAndShowState( |
256 gfx::Rect(), | 254 gfx::Rect(), |
257 &out_bounds, | 255 &out_bounds, |
258 &out_show_state); | 256 &out_show_state); |
259 return out_show_state; | 257 return out_show_state; |
260 } | 258 } |
261 | 259 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 { // Check that a window which hangs out of the screen get moved back in. | 460 { // Check that a window which hangs out of the screen get moved back in. |
463 gfx::Rect window_bounds; | 461 gfx::Rect window_bounds; |
464 GetWindowBounds(p1024x768, p1024x768, gfx::Rect(), gfx::Rect(), | 462 GetWindowBounds(p1024x768, p1024x768, gfx::Rect(), gfx::Rect(), |
465 gfx::Rect(), DEFAULT, NULL, | 463 gfx::Rect(), DEFAULT, NULL, |
466 gfx::Rect(1020, 700, 100, 100), &window_bounds); | 464 gfx::Rect(1020, 700, 100, 100), &window_bounds); |
467 EXPECT_EQ("924,668 100x100", window_bounds.ToString()); | 465 EXPECT_EQ("924,668 100x100", window_bounds.ToString()); |
468 } | 466 } |
469 } | 467 } |
470 | 468 |
471 #endif // defined(OS_MACOSX) | 469 #endif // defined(OS_MACOSX) |
OLD | NEW |