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