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" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 gfx::Rect old_bounds = window->bounds(); | 157 gfx::Rect old_bounds = window->bounds(); |
158 Shell::GetPrimaryRootWindow()->SetHostSize(gfx::Size(800, 600)); | 158 Shell::GetPrimaryRootWindow()->SetHostSize(gfx::Size(800, 600)); |
159 EXPECT_EQ(old_bounds.width(), window->bounds().width()); | 159 EXPECT_EQ(old_bounds.width(), window->bounds().width()); |
160 EXPECT_EQ(old_bounds.height(), window->bounds().height()); | 160 EXPECT_EQ(old_bounds.height(), window->bounds().height()); |
161 } | 161 } |
162 | 162 |
163 // Tests that a maximized window with too-large restore bounds will be restored | 163 // Tests that a maximized window with too-large restore bounds will be restored |
164 // to smaller than the full work area. | 164 // to smaller than the full work area. |
165 TEST_F(BaseLayoutManagerTest, BoundsWithScreenEdgeVisible) { | 165 TEST_F(BaseLayoutManagerTest, BoundsWithScreenEdgeVisible) { |
166 // Create a window with bounds that fill the screen. | 166 // Create a window with bounds that fill the screen. |
167 gfx::Rect bounds = gfx::Screen::GetPrimaryDisplay().bounds(); | 167 gfx::Rect bounds = gfx::Screen::GetPrimaryDisplay( |
| 168 ash::Shell::GetRootNativeView()).bounds(); |
168 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); | 169 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); |
169 // Maximize it, which writes the old bounds to restore bounds. | 170 // Maximize it, which writes the old bounds to restore bounds. |
170 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 171 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
171 // Restore it. | 172 // Restore it. |
172 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 173 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
173 // It should have the default maximized window bounds, inset by the grid size. | 174 // It should have the default maximized window bounds, inset by the grid size. |
174 int grid_size = internal::WorkspaceWindowResizer::kScreenEdgeInset; | 175 int grid_size = internal::WorkspaceWindowResizer::kScreenEdgeInset; |
175 gfx::Rect max_bounds = | 176 gfx::Rect max_bounds = |
176 ash::ScreenAsh::GetMaximizedWindowBoundsInParent(window.get()); | 177 ash::ScreenAsh::GetMaximizedWindowBoundsInParent(window.get()); |
177 max_bounds.Inset(grid_size, grid_size); | 178 max_bounds.Inset(grid_size, grid_size); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 GetRestoreBoundsInParent(window.get()).ToString()); | 228 GetRestoreBoundsInParent(window.get()).ToString()); |
228 EXPECT_TRUE(wm::IsWindowMaximized(window.get())); | 229 EXPECT_TRUE(wm::IsWindowMaximized(window.get())); |
229 | 230 |
230 wm::RestoreWindow(window.get()); | 231 wm::RestoreWindow(window.get()); |
231 EXPECT_EQ(bounds.ToString(), window->bounds().ToString()); | 232 EXPECT_EQ(bounds.ToString(), window->bounds().ToString()); |
232 } | 233 } |
233 | 234 |
234 } // namespace | 235 } // namespace |
235 | 236 |
236 } // namespace ash | 237 } // namespace ash |
OLD | NEW |