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/display/display_controller.h" | 5 #include "ash/display/display_controller.h" |
6 #include "ash/display/multi_display_manager.h" | 6 #include "ash/display/multi_display_manager.h" |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 } // namespace | 86 } // namespace |
87 | 87 |
88 namespace test { | 88 namespace test { |
89 | 89 |
90 typedef test::AshTestBase RootWindowControllerTest; | 90 typedef test::AshTestBase RootWindowControllerTest; |
91 | 91 |
92 TEST_F(RootWindowControllerTest, MoveWindows_Basic) { | 92 TEST_F(RootWindowControllerTest, MoveWindows_Basic) { |
93 UpdateDisplay("600x600,500x500"); | 93 UpdateDisplay("600x600,500x500"); |
94 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 94 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 95 ash::Shell::GetInstance()->SetShelfAutoHideBehavior( |
| 96 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
95 | 97 |
96 views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100)); | 98 views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100)); |
97 EXPECT_EQ(root_windows[1], normal->GetNativeView()->GetRootWindow()); | 99 EXPECT_EQ(root_windows[1], normal->GetNativeView()->GetRootWindow()); |
98 EXPECT_EQ("650,10 100x100", normal->GetWindowBoundsInScreen().ToString()); | 100 EXPECT_EQ("650,10 100x100", normal->GetWindowBoundsInScreen().ToString()); |
99 EXPECT_EQ("50,10 100x100", | 101 EXPECT_EQ("50,10 100x100", |
100 normal->GetNativeView()->GetBoundsInRootWindow().ToString()); | 102 normal->GetNativeView()->GetBoundsInRootWindow().ToString()); |
101 | 103 |
102 views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100)); | 104 views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100)); |
103 maximized->Maximize(); | 105 maximized->Maximize(); |
104 EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow()); | 106 EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 UpdateDisplay("600x600"); | 142 UpdateDisplay("600x600"); |
141 | 143 |
142 // d2 must have been deleted. | 144 // d2 must have been deleted. |
143 EXPECT_FALSE(tracker.Contains(d2)); | 145 EXPECT_FALSE(tracker.Contains(d2)); |
144 | 146 |
145 EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); | 147 EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); |
146 EXPECT_EQ("50,10 100x100", normal->GetWindowBoundsInScreen().ToString()); | 148 EXPECT_EQ("50,10 100x100", normal->GetWindowBoundsInScreen().ToString()); |
147 EXPECT_EQ("50,10 100x100", | 149 EXPECT_EQ("50,10 100x100", |
148 normal->GetNativeView()->GetBoundsInRootWindow().ToString()); | 150 normal->GetNativeView()->GetBoundsInRootWindow().ToString()); |
149 | 151 |
150 // Maximized area on primary display has 2px (given as | 152 // Maximized area on primary display has 3px (given as |
151 // kAutoHideSize in shelf_layout_manager.cc) inset at the bottom. | 153 // kAutoHideSize in shelf_layout_manager.cc) inset at the bottom. |
152 EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow()); | 154 EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow()); |
153 EXPECT_EQ("0,0 600x597", | 155 EXPECT_EQ("0,0 600x597", |
154 maximized->GetWindowBoundsInScreen().ToString()); | 156 maximized->GetWindowBoundsInScreen().ToString()); |
155 EXPECT_EQ("0,0 600x597", | 157 EXPECT_EQ("0,0 600x597", |
156 maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); | 158 maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); |
157 | 159 |
158 EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow()); | 160 EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow()); |
159 EXPECT_EQ("200,10 100x100", | 161 EXPECT_EQ("200,10 100x100", |
160 minimized->GetWindowBoundsInScreen().ToString()); | 162 minimized->GetWindowBoundsInScreen().ToString()); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 205 |
204 UpdateDisplay("500x500"); | 206 UpdateDisplay("500x500"); |
205 EXPECT_EQ(root_windows[0], modal->GetNativeView()->GetRootWindow()); | 207 EXPECT_EQ(root_windows[0], modal->GetNativeView()->GetRootWindow()); |
206 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); | 208 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); |
207 generator_1st.ClickLeftButton(); | 209 generator_1st.ClickLeftButton(); |
208 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); | 210 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); |
209 } | 211 } |
210 | 212 |
211 } // namespace test | 213 } // namespace test |
212 } // namespace ash | 214 } // namespace ash |
OLD | NEW |