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