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_manager2.h" | 5 #include "ash/wm/workspace/workspace_layout_manager2.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" |
11 #include "ash/wm/shelf_layout_manager.h" | 11 #include "ash/wm/shelf_layout_manager.h" |
12 #include "ash/wm/window_util.h" | 12 #include "ash/wm/window_util.h" |
13 #include "ui/aura/root_window.h" | 13 #include "ui/aura/root_window.h" |
14 #include "ui/aura/test/test_windows.h" | 14 #include "ui/aura/test/test_windows.h" |
15 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
16 #include "ui/gfx/display.h" | |
17 #include "ui/gfx/insets.h" | 16 #include "ui/gfx/insets.h" |
18 #include "ui/gfx/screen.h" | |
19 | 17 |
20 namespace ash { | 18 namespace ash { |
21 | 19 |
22 namespace { | 20 namespace { |
23 | 21 |
24 class WorkspaceLayoutManager2Test : public test::AshTestBase { | 22 class WorkspaceLayoutManager2Test : public test::AshTestBase { |
25 public: | 23 public: |
26 WorkspaceLayoutManager2Test() {} | 24 WorkspaceLayoutManager2Test() {} |
27 virtual ~WorkspaceLayoutManager2Test() {} | 25 virtual ~WorkspaceLayoutManager2Test() {} |
28 | 26 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 138 |
141 // Verifies the size of a window is enforced to be smaller than the work area. | 139 // Verifies the size of a window is enforced to be smaller than the work area. |
142 TEST_F(WorkspaceLayoutManager2Test, SizeToWorkArea) { | 140 TEST_F(WorkspaceLayoutManager2Test, SizeToWorkArea) { |
143 // Normal window bounds shouldn't be changed. | 141 // Normal window bounds shouldn't be changed. |
144 gfx::Size work_area( | 142 gfx::Size work_area( |
145 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area().size()); | 143 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area().size()); |
146 const gfx::Rect window_bounds( | 144 const gfx::Rect window_bounds( |
147 100, 101, work_area.width() + 1, work_area.height() + 2); | 145 100, 101, work_area.width() + 1, work_area.height() + 2); |
148 scoped_ptr<aura::Window> window(CreateTestWindow(window_bounds)); | 146 scoped_ptr<aura::Window> window(CreateTestWindow(window_bounds)); |
149 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), | 147 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), |
150 window->bounds().ToString()); | 148 window->bounds().ToString()); |
151 | 149 |
152 // Directly setting the bounds triggers a slightly different code path. Verify | 150 // Directly setting the bounds triggers a slightly different code path. Verify |
153 // that too. | 151 // that too. |
154 window->SetBounds(window_bounds); | 152 window->SetBounds(window_bounds); |
155 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), | 153 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), |
156 window->bounds().ToString()); | 154 window->bounds().ToString()); |
157 } | 155 } |
158 | 156 |
159 } // namespace | 157 } // namespace |
160 | |
161 } // namespace ash | 158 } // namespace ash |
OLD | NEW |