OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/launcher/launcher.h" | 5 #include "ash/launcher/launcher.h" |
6 #include "ash/root_window_controller.h" | 6 #include "ash/root_window_controller.h" |
7 #include "ash/screen_ash.h" | 7 #include "ash/screen_ash.h" |
8 #include "ash/shelf/shelf_widget.h" | 8 #include "ash/shelf/shelf_widget.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 aura::test::TestWindowDelegate delegate_; | 177 aura::test::TestWindowDelegate delegate_; |
178 NonActivatableActivationDelegate non_activatable_activation_delegate_; | 178 NonActivatableActivationDelegate non_activatable_activation_delegate_; |
179 scoped_ptr<test::ShelfViewTestAPI> shelf_view_test_; | 179 scoped_ptr<test::ShelfViewTestAPI> shelf_view_test_; |
180 | 180 |
181 DISALLOW_COPY_AND_ASSIGN(WindowSelectorTest); | 181 DISALLOW_COPY_AND_ASSIGN(WindowSelectorTest); |
182 }; | 182 }; |
183 | 183 |
184 // Tests entering overview mode with two windows and selecting one. | 184 // Tests entering overview mode with two windows and selecting one. |
185 TEST_F(WindowSelectorTest, Basic) { | 185 TEST_F(WindowSelectorTest, Basic) { |
186 gfx::Rect bounds(0, 0, 400, 400); | 186 gfx::Rect bounds(0, 0, 400, 400); |
187 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); | 187 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
188 scoped_ptr<aura::Window> window1(CreateWindow(bounds)); | 188 scoped_ptr<aura::Window> window1(CreateWindow(bounds)); |
189 scoped_ptr<aura::Window> window2(CreateWindow(bounds)); | 189 scoped_ptr<aura::Window> window2(CreateWindow(bounds)); |
190 scoped_ptr<aura::Window> panel1(CreatePanelWindow(bounds)); | 190 scoped_ptr<aura::Window> panel1(CreatePanelWindow(bounds)); |
191 scoped_ptr<aura::Window> panel2(CreatePanelWindow(bounds)); | 191 scoped_ptr<aura::Window> panel2(CreatePanelWindow(bounds)); |
192 EXPECT_TRUE(WindowsOverlapping(window1.get(), window2.get())); | 192 EXPECT_TRUE(WindowsOverlapping(window1.get(), window2.get())); |
193 EXPECT_TRUE(WindowsOverlapping(panel1.get(), panel2.get())); | 193 EXPECT_TRUE(WindowsOverlapping(panel1.get(), panel2.get())); |
194 wm::ActivateWindow(window2.get()); | 194 wm::ActivateWindow(window2.get()); |
195 EXPECT_FALSE(wm::IsActiveWindow(window1.get())); | 195 EXPECT_FALSE(wm::IsActiveWindow(window1.get())); |
196 EXPECT_TRUE(wm::IsActiveWindow(window2.get())); | 196 EXPECT_TRUE(wm::IsActiveWindow(window2.get())); |
197 EXPECT_EQ(window2.get(), GetFocusedWindow()); | 197 EXPECT_EQ(window2.get(), GetFocusedWindow()); |
198 // Hide the cursor before entering overview to test that it will be shown. | 198 // Hide the cursor before entering overview to test that it will be shown. |
199 GetCursorClient(root_window)->HideCursor(); | 199 aura::client::GetCursorClient(root_window)->HideCursor(); |
200 | 200 |
201 // In overview mode the windows should no longer overlap and focus should | 201 // In overview mode the windows should no longer overlap and focus should |
202 // be removed from the window. | 202 // be removed from the window. |
203 ToggleOverview(); | 203 ToggleOverview(); |
204 EXPECT_EQ(NULL, GetFocusedWindow()); | 204 EXPECT_EQ(NULL, GetFocusedWindow()); |
205 EXPECT_FALSE(WindowsOverlapping(window1.get(), window2.get())); | 205 EXPECT_FALSE(WindowsOverlapping(window1.get(), window2.get())); |
206 EXPECT_FALSE(WindowsOverlapping(window1.get(), panel1.get())); | 206 EXPECT_FALSE(WindowsOverlapping(window1.get(), panel1.get())); |
207 // Panels 1 and 2 should still be overlapping being in a single selector | 207 // Panels 1 and 2 should still be overlapping being in a single selector |
208 // item. | 208 // item. |
209 EXPECT_TRUE(WindowsOverlapping(panel1.get(), panel2.get())); | 209 EXPECT_TRUE(WindowsOverlapping(panel1.get(), panel2.get())); |
210 | 210 |
211 // The cursor should be visible and locked as a pointer | 211 // The cursor should be visible and locked as a pointer |
212 EXPECT_EQ(ui::kCursorPointer, root_window->last_cursor().native_type()); | 212 EXPECT_EQ(ui::kCursorPointer, |
213 EXPECT_TRUE(GetCursorClient(root_window)->IsCursorLocked()); | 213 root_window->GetDispatcher()->last_cursor().native_type()); |
214 EXPECT_TRUE(GetCursorClient(root_window)->IsCursorVisible()); | 214 EXPECT_TRUE(aura::client::GetCursorClient(root_window)->IsCursorLocked()); |
| 215 EXPECT_TRUE(aura::client::GetCursorClient(root_window)->IsCursorVisible()); |
215 | 216 |
216 // Clicking window 1 should activate it. | 217 // Clicking window 1 should activate it. |
217 ClickWindow(window1.get()); | 218 ClickWindow(window1.get()); |
218 EXPECT_TRUE(wm::IsActiveWindow(window1.get())); | 219 EXPECT_TRUE(wm::IsActiveWindow(window1.get())); |
219 EXPECT_FALSE(wm::IsActiveWindow(window2.get())); | 220 EXPECT_FALSE(wm::IsActiveWindow(window2.get())); |
220 EXPECT_EQ(window1.get(), GetFocusedWindow()); | 221 EXPECT_EQ(window1.get(), GetFocusedWindow()); |
221 | 222 |
222 // Cursor should have been unlocked. | 223 // Cursor should have been unlocked. |
223 EXPECT_FALSE(GetCursorClient(root_window)->IsCursorLocked()); | 224 EXPECT_FALSE(aura::client::GetCursorClient(root_window)->IsCursorLocked()); |
224 } | 225 } |
225 | 226 |
226 // Tests that the shelf dimming state is removed while in overview and restored | 227 // Tests that the shelf dimming state is removed while in overview and restored |
227 // on exiting overview. | 228 // on exiting overview. |
228 TEST_F(WindowSelectorTest, OverviewUndimsShelf) { | 229 TEST_F(WindowSelectorTest, OverviewUndimsShelf) { |
229 gfx::Rect bounds(0, 0, 400, 400); | 230 gfx::Rect bounds(0, 0, 400, 400); |
230 scoped_ptr<aura::Window> window1(CreateWindow(bounds)); | 231 scoped_ptr<aura::Window> window1(CreateWindow(bounds)); |
231 wm::WindowState* window_state = wm::GetWindowState(window1.get()); | 232 wm::WindowState* window_state = wm::GetWindowState(window1.get()); |
232 window_state->Maximize(); | 233 window_state->Maximize(); |
233 ash::ShelfWidget* shelf = Shell::GetPrimaryRootWindowController()->shelf(); | 234 ash::ShelfWidget* shelf = Shell::GetPrimaryRootWindowController()->shelf(); |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 ToEnclosingRect(GetTransformedTargetBounds(window1.get())); | 796 ToEnclosingRect(GetTransformedTargetBounds(window1.get())); |
796 EXPECT_EQ(overview_bounds.x(), new_overview_bounds.x()); | 797 EXPECT_EQ(overview_bounds.x(), new_overview_bounds.x()); |
797 EXPECT_EQ(overview_bounds.y(), new_overview_bounds.y()); | 798 EXPECT_EQ(overview_bounds.y(), new_overview_bounds.y()); |
798 EXPECT_EQ(overview_bounds.width(), new_overview_bounds.width()); | 799 EXPECT_EQ(overview_bounds.width(), new_overview_bounds.width()); |
799 EXPECT_EQ(overview_bounds.height(), new_overview_bounds.height()); | 800 EXPECT_EQ(overview_bounds.height(), new_overview_bounds.height()); |
800 StopCycling(); | 801 StopCycling(); |
801 } | 802 } |
802 | 803 |
803 } // namespace internal | 804 } // namespace internal |
804 } // namespace ash | 805 } // namespace ash |
OLD | NEW |