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/workspace/workspace_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
6 | 6 |
7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
9 #include "ash/shelf/shelf_widget.h" | 9 #include "ash/shelf/shelf_widget.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 bounds.Intersect(root_window_bounds); | 132 bounds.Intersect(root_window_bounds); |
133 // 2/3 of the window must be visible. | 133 // 2/3 of the window must be visible. |
134 EXPECT_GT(bounds.width(), out_window->bounds().width() * 0.6); | 134 EXPECT_GT(bounds.width(), out_window->bounds().width() * 0.6); |
135 EXPECT_GT(bounds.height(), out_window->bounds().height() * 0.6); | 135 EXPECT_GT(bounds.height(), out_window->bounds().height() * 0.6); |
136 } | 136 } |
137 | 137 |
138 // Verifies the size of a window is enforced to be smaller than the work area. | 138 // Verifies the size of a window is enforced to be smaller than the work area. |
139 TEST_F(WorkspaceLayoutManagerTest, SizeToWorkArea) { | 139 TEST_F(WorkspaceLayoutManagerTest, SizeToWorkArea) { |
140 // Normal window bounds shouldn't be changed. | 140 // Normal window bounds shouldn't be changed. |
141 gfx::Size work_area( | 141 gfx::Size work_area( |
142 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area().size()); | 142 Shell::GetScreen()->GetPrimaryDisplay().work_area().size()); |
143 const gfx::Rect window_bounds( | 143 const gfx::Rect window_bounds( |
144 100, 101, work_area.width() + 1, work_area.height() + 2); | 144 100, 101, work_area.width() + 1, work_area.height() + 2); |
145 scoped_ptr<aura::Window> window( | 145 scoped_ptr<aura::Window> window( |
146 CreateTestWindowInShellWithBounds(window_bounds)); | 146 CreateTestWindowInShellWithBounds(window_bounds)); |
147 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), | 147 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), |
148 window->bounds().ToString()); | 148 window->bounds().ToString()); |
149 | 149 |
150 // Directly setting the bounds triggers a slightly different code path. Verify | 150 // Directly setting the bounds triggers a slightly different code path. Verify |
151 // that too. | 151 // that too. |
152 window->SetBounds(window_bounds); | 152 window->SetBounds(window_bounds); |
153 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), | 153 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), |
154 window->bounds().ToString()); | 154 window->bounds().ToString()); |
155 } | 155 } |
156 | 156 |
157 } // namespace | 157 } // namespace |
158 } // namespace ash | 158 } // namespace ash |
OLD | NEW |