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