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 "ash/wm/base_layout_manager.h" | 5 #include "ash/wm/base_layout_manager.h" |
6 | 6 |
7 #include "ash/screen_ash.h" | 7 #include "ash/screen_ash.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
11 #include "ash/wm/property_util.h" | 11 #include "ash/wm/property_util.h" |
12 #include "ash/wm/window_util.h" | 12 #include "ash/wm/window_util.h" |
| 13 #include "ash/wm/workspace/workspace_window_resizer.h" |
13 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
15 #include "ui/aura/client/aura_constants.h" | 16 #include "ui/aura/client/aura_constants.h" |
16 #include "ui/aura/root_window.h" | 17 #include "ui/aura/root_window.h" |
17 #include "ui/aura/test/test_windows.h" | 18 #include "ui/aura/test/test_windows.h" |
18 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
19 #include "ui/base/ui_base_types.h" | 20 #include "ui/base/ui_base_types.h" |
20 #include "ui/gfx/insets.h" | 21 #include "ui/gfx/insets.h" |
21 #include "ui/gfx/screen.h" | 22 #include "ui/gfx/screen.h" |
22 | 23 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // to smaller than the full work area. | 164 // to smaller than the full work area. |
164 TEST_F(BaseLayoutManagerTest, BoundsWithScreenEdgeVisible) { | 165 TEST_F(BaseLayoutManagerTest, BoundsWithScreenEdgeVisible) { |
165 // Create a window with bounds that fill the screen. | 166 // Create a window with bounds that fill the screen. |
166 gfx::Rect bounds = gfx::Screen::GetPrimaryDisplay().bounds(); | 167 gfx::Rect bounds = gfx::Screen::GetPrimaryDisplay().bounds(); |
167 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); | 168 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); |
168 // Maximize it, which writes the old bounds to restore bounds. | 169 // Maximize it, which writes the old bounds to restore bounds. |
169 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 170 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
170 // Restore it. | 171 // Restore it. |
171 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 172 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
172 // It should have the default maximized window bounds, inset by the grid size. | 173 // It should have the default maximized window bounds, inset by the grid size. |
173 int grid_size = ash::Shell::GetInstance()->GetGridSize(); | 174 int grid_size = internal::WorkspaceWindowResizer::kScreenEdgeInset; |
174 gfx::Rect max_bounds = | 175 gfx::Rect max_bounds = |
175 ash::ScreenAsh::GetMaximizedWindowBoundsInParent(window.get()); | 176 ash::ScreenAsh::GetMaximizedWindowBoundsInParent(window.get()); |
176 max_bounds.Inset(grid_size, grid_size); | 177 max_bounds.Inset(grid_size, grid_size); |
177 EXPECT_EQ(max_bounds.ToString(), window->bounds().ToString()); | 178 EXPECT_EQ(max_bounds.ToString(), window->bounds().ToString()); |
178 } | 179 } |
179 | 180 |
180 // Verifies maximizing sets the restore bounds, and restoring | 181 // Verifies maximizing sets the restore bounds, and restoring |
181 // restores the bounds. | 182 // restores the bounds. |
182 TEST_F(BaseLayoutManagerTest, MaximizeSetsRestoreBounds) { | 183 TEST_F(BaseLayoutManagerTest, MaximizeSetsRestoreBounds) { |
183 scoped_ptr<aura::Window> window(CreateTestWindow(gfx::Rect(1, 2, 3, 4))); | 184 scoped_ptr<aura::Window> window(CreateTestWindow(gfx::Rect(1, 2, 3, 4))); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 GetRestoreBoundsInParent(window.get()).ToString()); | 227 GetRestoreBoundsInParent(window.get()).ToString()); |
227 EXPECT_TRUE(wm::IsWindowMaximized(window.get())); | 228 EXPECT_TRUE(wm::IsWindowMaximized(window.get())); |
228 | 229 |
229 wm::RestoreWindow(window.get()); | 230 wm::RestoreWindow(window.get()); |
230 EXPECT_EQ(bounds.ToString(), window->bounds().ToString()); | 231 EXPECT_EQ(bounds.ToString(), window->bounds().ToString()); |
231 } | 232 } |
232 | 233 |
233 } // namespace | 234 } // namespace |
234 | 235 |
235 } // namespace ash | 236 } // namespace ash |
OLD | NEW |