OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/system/overview/overview_button_tray.h" | 5 #include "ash/system/overview/overview_button_tray.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/common/shelf/shelf_types.h" | 8 #include "ash/common/shelf/shelf_types.h" |
9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 97 } |
98 | 98 |
99 // Tests that activating this control brings up window selection mode. | 99 // Tests that activating this control brings up window selection mode. |
100 TEST_F(OverviewButtonTrayTest, PerformAction) { | 100 TEST_F(OverviewButtonTrayTest, PerformAction) { |
101 ASSERT_FALSE(Shell::GetInstance()->window_selector_controller()-> | 101 ASSERT_FALSE(Shell::GetInstance()->window_selector_controller()-> |
102 IsSelecting()); | 102 IsSelecting()); |
103 | 103 |
104 // Overview Mode only works when there is a window | 104 // Overview Mode only works when there is a window |
105 std::unique_ptr<aura::Window> window( | 105 std::unique_ptr<aura::Window> window( |
106 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 106 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
107 ui::GestureEvent tap( | 107 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), |
108 0, 0, 0, base::TimeDelta(), ui::GestureEventDetails(ui::ET_GESTURE_TAP)); | 108 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
109 GetTray()->PerformAction(tap); | 109 GetTray()->PerformAction(tap); |
110 EXPECT_TRUE(Shell::GetInstance()->window_selector_controller()-> | 110 EXPECT_TRUE(Shell::GetInstance()->window_selector_controller()-> |
111 IsSelecting()); | 111 IsSelecting()); |
112 } | 112 } |
113 | 113 |
114 // Tests that tapping on the control will record the user action Tray_Overview. | 114 // Tests that tapping on the control will record the user action Tray_Overview. |
115 TEST_F(OverviewButtonTrayTest, TrayOverviewUserAction) { | 115 TEST_F(OverviewButtonTrayTest, TrayOverviewUserAction) { |
116 ASSERT_FALSE( | 116 ASSERT_FALSE( |
117 Shell::GetInstance()->window_selector_controller()->IsSelecting()); | 117 Shell::GetInstance()->window_selector_controller()->IsSelecting()); |
118 | 118 |
119 // Tapping on the control when there are no windows (and thus the user cannot | 119 // Tapping on the control when there are no windows (and thus the user cannot |
120 // enter overview mode) should still record the action. | 120 // enter overview mode) should still record the action. |
121 base::UserActionTester user_action_tester; | 121 base::UserActionTester user_action_tester; |
122 ui::GestureEvent tap(0, 0, 0, base::TimeDelta(), | 122 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), |
123 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); | 123 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
124 GetTray()->PerformAction(tap); | 124 GetTray()->PerformAction(tap); |
125 ASSERT_FALSE( | 125 ASSERT_FALSE( |
126 Shell::GetInstance()->window_selector_controller()->IsSelecting()); | 126 Shell::GetInstance()->window_selector_controller()->IsSelecting()); |
127 EXPECT_EQ(1, user_action_tester.GetActionCount(kTrayOverview)); | 127 EXPECT_EQ(1, user_action_tester.GetActionCount(kTrayOverview)); |
128 | 128 |
129 // With one window present, tapping on the control to enter overview mode | 129 // With one window present, tapping on the control to enter overview mode |
130 // should record the user action. | 130 // should record the user action. |
131 std::unique_ptr<aura::Window> window( | 131 std::unique_ptr<aura::Window> window( |
132 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 132 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // Tests that the tray only renders as active while selection is ongoing. Any | 201 // Tests that the tray only renders as active while selection is ongoing. Any |
202 // dismissal of overview mode clears the active state. | 202 // dismissal of overview mode clears the active state. |
203 TEST_F(OverviewButtonTrayTest, ActiveStateOnlyDuringOverviewMode) { | 203 TEST_F(OverviewButtonTrayTest, ActiveStateOnlyDuringOverviewMode) { |
204 ASSERT_FALSE( | 204 ASSERT_FALSE( |
205 Shell::GetInstance()->window_selector_controller()->IsSelecting()); | 205 Shell::GetInstance()->window_selector_controller()->IsSelecting()); |
206 ASSERT_FALSE(GetTray()->draw_background_as_active()); | 206 ASSERT_FALSE(GetTray()->draw_background_as_active()); |
207 | 207 |
208 // Overview Mode only works when there is a window | 208 // Overview Mode only works when there is a window |
209 std::unique_ptr<aura::Window> window( | 209 std::unique_ptr<aura::Window> window( |
210 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 210 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
211 ui::GestureEvent tap( | 211 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), |
212 0, 0, 0, base::TimeDelta(), ui::GestureEventDetails(ui::ET_GESTURE_TAP)); | 212 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
213 GetTray()->PerformAction(tap); | 213 GetTray()->PerformAction(tap); |
214 EXPECT_TRUE( | 214 EXPECT_TRUE( |
215 Shell::GetInstance()->window_selector_controller()->IsSelecting()); | 215 Shell::GetInstance()->window_selector_controller()->IsSelecting()); |
216 EXPECT_TRUE(GetTray()->draw_background_as_active()); | 216 EXPECT_TRUE(GetTray()->draw_background_as_active()); |
217 | 217 |
218 Shell::GetInstance()->window_selector_controller()->OnSelectionEnded(); | 218 Shell::GetInstance()->window_selector_controller()->OnSelectionEnded(); |
219 EXPECT_FALSE( | 219 EXPECT_FALSE( |
220 Shell::GetInstance()->window_selector_controller()->IsSelecting()); | 220 Shell::GetInstance()->window_selector_controller()->IsSelecting()); |
221 EXPECT_FALSE(GetTray()->draw_background_as_active()); | 221 EXPECT_FALSE(GetTray()->draw_background_as_active()); |
222 } | 222 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 ->maximize_mode_controller() | 271 ->maximize_mode_controller() |
272 ->EnableMaximizeModeWindowManager(true); | 272 ->EnableMaximizeModeWindowManager(true); |
273 EXPECT_TRUE(GetTray()->visible()); | 273 EXPECT_TRUE(GetTray()->visible()); |
274 Shell::GetInstance() | 274 Shell::GetInstance() |
275 ->maximize_mode_controller() | 275 ->maximize_mode_controller() |
276 ->EnableMaximizeModeWindowManager(false); | 276 ->EnableMaximizeModeWindowManager(false); |
277 EXPECT_FALSE(GetTray()->visible()); | 277 EXPECT_FALSE(GetTray()->visible()); |
278 } | 278 } |
279 | 279 |
280 } // namespace ash | 280 } // namespace ash |
OLD | NEW |