| 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 | 9 |
| 9 #include "ash/wm/window_resizer.h" | 10 #include "ash/wm/window_resizer.h" |
| 10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "ui/gfx/display.h" | 18 #include "ui/gfx/display.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 if (!monitor2_bounds.IsEmpty()) | 187 if (!monitor2_bounds.IsEmpty()) |
| 187 test_screen.AddDisplay(monitor2_bounds, monitor2_bounds); | 188 test_screen.AddDisplay(monitor2_bounds, monitor2_bounds); |
| 188 scoped_ptr<TestStateProvider> sp(new TestStateProvider); | 189 scoped_ptr<TestStateProvider> sp(new TestStateProvider); |
| 189 if (source == PERSISTED || source == BOTH) | 190 if (source == PERSISTED || source == BOTH) |
| 190 sp->SetPersistentState(bounds, work_area, show_state_persisted, true); | 191 sp->SetPersistentState(bounds, work_area, show_state_persisted, true); |
| 191 if (source == LAST_ACTIVE || source == BOTH) | 192 if (source == LAST_ACTIVE || source == BOTH) |
| 192 sp->SetLastActiveState(bounds, show_state_last, true); | 193 sp->SetLastActiveState(bounds, show_state_last, true); |
| 193 scoped_ptr<WindowSizer::TargetDisplayProvider> tdp( | 194 scoped_ptr<WindowSizer::TargetDisplayProvider> tdp( |
| 194 new TestTargetDisplayProvider); | 195 new TestTargetDisplayProvider); |
| 195 | 196 |
| 196 WindowSizer sizer(sp.Pass(), tdp.Pass(), &test_screen, browser); | 197 WindowSizer sizer(std::move(sp), std::move(tdp), &test_screen, browser); |
| 197 sizer.DetermineWindowBoundsAndShowState(passed_in, | 198 sizer.DetermineWindowBoundsAndShowState(passed_in, |
| 198 out_bounds, | 199 out_bounds, |
| 199 out_show_state); | 200 out_show_state); |
| 200 } | 201 } |
| 201 | 202 |
| 202 void GetWindowBounds(const gfx::Rect& monitor1_bounds, | 203 void GetWindowBounds(const gfx::Rect& monitor1_bounds, |
| 203 const gfx::Rect& monitor1_work_area, | 204 const gfx::Rect& monitor1_work_area, |
| 204 const gfx::Rect& monitor2_bounds, | 205 const gfx::Rect& monitor2_bounds, |
| 205 const gfx::Rect& bounds, | 206 const gfx::Rect& bounds, |
| 206 const gfx::Rect& work_area, | 207 const gfx::Rect& work_area, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 225 TestScreen test_screen; | 226 TestScreen test_screen; |
| 226 test_screen.AddDisplay(display_config, display_config); | 227 test_screen.AddDisplay(display_config, display_config); |
| 227 scoped_ptr<TestStateProvider> sp(new TestStateProvider); | 228 scoped_ptr<TestStateProvider> sp(new TestStateProvider); |
| 228 if (source == PERSISTED || source == BOTH) | 229 if (source == PERSISTED || source == BOTH) |
| 229 sp->SetPersistentState(bounds, display_config, show_state_persisted, true); | 230 sp->SetPersistentState(bounds, display_config, show_state_persisted, true); |
| 230 if (source == LAST_ACTIVE || source == BOTH) | 231 if (source == LAST_ACTIVE || source == BOTH) |
| 231 sp->SetLastActiveState(bounds, show_state_last, true); | 232 sp->SetLastActiveState(bounds, show_state_last, true); |
| 232 scoped_ptr<WindowSizer::TargetDisplayProvider> tdp( | 233 scoped_ptr<WindowSizer::TargetDisplayProvider> tdp( |
| 233 new TestTargetDisplayProvider); | 234 new TestTargetDisplayProvider); |
| 234 | 235 |
| 235 WindowSizer sizer(sp.Pass(), tdp.Pass(), &test_screen, browser); | 236 WindowSizer sizer(std::move(sp), std::move(tdp), &test_screen, browser); |
| 236 | 237 |
| 237 ui::WindowShowState out_show_state = ui::SHOW_STATE_DEFAULT; | 238 ui::WindowShowState out_show_state = ui::SHOW_STATE_DEFAULT; |
| 238 gfx::Rect out_bounds; | 239 gfx::Rect out_bounds; |
| 239 sizer.DetermineWindowBoundsAndShowState( | 240 sizer.DetermineWindowBoundsAndShowState( |
| 240 gfx::Rect(), | 241 gfx::Rect(), |
| 241 &out_bounds, | 242 &out_bounds, |
| 242 &out_show_state); | 243 &out_show_state); |
| 243 return out_show_state; | 244 return out_show_state; |
| 244 } | 245 } |
| 245 | 246 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 { // 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. |
| 447 gfx::Rect window_bounds; | 448 gfx::Rect window_bounds; |
| 448 GetWindowBounds(p1024x768, p1024x768, gfx::Rect(), gfx::Rect(), | 449 GetWindowBounds(p1024x768, p1024x768, gfx::Rect(), gfx::Rect(), |
| 449 gfx::Rect(), DEFAULT, NULL, | 450 gfx::Rect(), DEFAULT, NULL, |
| 450 gfx::Rect(1020, 700, 100, 100), &window_bounds); | 451 gfx::Rect(1020, 700, 100, 100), &window_bounds); |
| 451 EXPECT_EQ("924,668 100x100", window_bounds.ToString()); | 452 EXPECT_EQ("924,668 100x100", window_bounds.ToString()); |
| 452 } | 453 } |
| 453 } | 454 } |
| 454 | 455 |
| 455 #endif // defined(OS_MACOSX) | 456 #endif // defined(OS_MACOSX) |
| OLD | NEW |