| 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 #ifndef CHROME_BROWSER_UI_WINDOW_SIZER_COMMON_UNITTEST_H_ | 5 #ifndef CHROME_BROWSER_UI_WINDOW_SIZER_COMMON_UNITTEST_H_ |
| 6 #define CHROME_BROWSER_UI_WINDOW_SIZER_COMMON_UNITTEST_H_ | 6 #define CHROME_BROWSER_UI_WINDOW_SIZER_COMMON_UNITTEST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 // Some standard monitor sizes (no task bar). | 9 // Some standard monitor sizes (no task bar). |
| 10 static const gfx::Rect tentwentyfour(0, 0, 1024, 768); | 10 static const gfx::Rect tentwentyfour(0, 0, 1024, 768); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // A convenience function to read the window bounds from the window sizer | 169 // A convenience function to read the window bounds from the window sizer |
| 170 // according to the specified configuration. | 170 // according to the specified configuration. |
| 171 enum Source { DEFAULT, LAST_ACTIVE, PERSISTED }; | 171 enum Source { DEFAULT, LAST_ACTIVE, PERSISTED }; |
| 172 static void GetWindowBounds(const gfx::Rect& monitor1_bounds, | 172 static void GetWindowBounds(const gfx::Rect& monitor1_bounds, |
| 173 const gfx::Rect& monitor1_work_area, | 173 const gfx::Rect& monitor1_work_area, |
| 174 const gfx::Rect& monitor2_bounds, | 174 const gfx::Rect& monitor2_bounds, |
| 175 const gfx::Rect& state, | 175 const gfx::Rect& state, |
| 176 const gfx::Rect& work_area, | 176 const gfx::Rect& work_area, |
| 177 Source source, | 177 Source source, |
| 178 gfx::Rect* out_bounds, | 178 gfx::Rect* out_bounds, |
| 179 const Browser* browser) { | 179 const Browser* browser, |
| 180 const gfx::Rect& passed_in) { |
| 180 TestMonitorInfoProvider* mip = new TestMonitorInfoProvider; | 181 TestMonitorInfoProvider* mip = new TestMonitorInfoProvider; |
| 181 mip->AddMonitor(monitor1_bounds, monitor1_work_area); | 182 mip->AddMonitor(monitor1_bounds, monitor1_work_area); |
| 182 if (!monitor2_bounds.IsEmpty()) | 183 if (!monitor2_bounds.IsEmpty()) |
| 183 mip->AddMonitor(monitor2_bounds, monitor2_bounds); | 184 mip->AddMonitor(monitor2_bounds, monitor2_bounds); |
| 184 TestStateProvider* sp = new TestStateProvider; | 185 TestStateProvider* sp = new TestStateProvider; |
| 185 if (source == PERSISTED) | 186 if (source == PERSISTED) |
| 186 sp->SetPersistentState(state, work_area, true); | 187 sp->SetPersistentState(state, work_area, true); |
| 187 else if (source == LAST_ACTIVE) | 188 else if (source == LAST_ACTIVE) |
| 188 sp->SetLastActiveState(state, true); | 189 sp->SetLastActiveState(state, true); |
| 189 | 190 |
| 190 WindowSizer sizer(sp, mip, browser); | 191 WindowSizer sizer(sp, mip, browser); |
| 191 sizer.DetermineWindowBounds(gfx::Rect(), out_bounds); | 192 sizer.DetermineWindowBounds(passed_in, out_bounds); |
| 192 } | 193 } |
| 193 | 194 |
| 194 #endif // CHROME_BROWSER_UI_WINDOW_SIZER_COMMON_UNITTEST_H_ | 195 #endif // CHROME_BROWSER_UI_WINDOW_SIZER_COMMON_UNITTEST_H_ |
| OLD | NEW |