| 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/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/rotator/screen_rotation_animator.h" | 10 #include "ash/rotator/screen_rotation_animator.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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // Tests that the tray only renders as active while selection is ongoing. Any | 200 // Tests that the tray only renders as active while selection is ongoing. Any |
| 201 // dismissal of overview mode clears the active state. | 201 // dismissal of overview mode clears the active state. |
| 202 TEST_F(OverviewButtonTrayTest, ActiveStateOnlyDuringOverviewMode) { | 202 TEST_F(OverviewButtonTrayTest, ActiveStateOnlyDuringOverviewMode) { |
| 203 ASSERT_FALSE( | 203 ASSERT_FALSE( |
| 204 Shell::GetInstance()->window_selector_controller()->IsSelecting()); | 204 Shell::GetInstance()->window_selector_controller()->IsSelecting()); |
| 205 ASSERT_FALSE(GetTray()->draw_background_as_active()); | 205 ASSERT_FALSE(GetTray()->draw_background_as_active()); |
| 206 | 206 |
| 207 // Overview Mode only works when there is a window | 207 // Overview Mode only works when there is a window |
| 208 std::unique_ptr<aura::Window> window( | 208 std::unique_ptr<aura::Window> window( |
| 209 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 209 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
| 210 ui::GestureEvent tap( | 210 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), |
| 211 0, 0, 0, base::TimeDelta(), ui::GestureEventDetails(ui::ET_GESTURE_TAP)); | 211 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
| 212 GetTray()->PerformAction(tap); | 212 GetTray()->PerformAction(tap); |
| 213 EXPECT_TRUE( | 213 EXPECT_TRUE( |
| 214 Shell::GetInstance()->window_selector_controller()->IsSelecting()); | 214 Shell::GetInstance()->window_selector_controller()->IsSelecting()); |
| 215 EXPECT_TRUE(GetTray()->draw_background_as_active()); | 215 EXPECT_TRUE(GetTray()->draw_background_as_active()); |
| 216 | 216 |
| 217 Shell::GetInstance()->window_selector_controller()->OnSelectionEnded(); | 217 Shell::GetInstance()->window_selector_controller()->OnSelectionEnded(); |
| 218 EXPECT_FALSE( | 218 EXPECT_FALSE( |
| 219 Shell::GetInstance()->window_selector_controller()->IsSelecting()); | 219 Shell::GetInstance()->window_selector_controller()->IsSelecting()); |
| 220 EXPECT_FALSE(GetTray()->draw_background_as_active()); | 220 EXPECT_FALSE(GetTray()->draw_background_as_active()); |
| 221 } | 221 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 ->maximize_mode_controller() | 270 ->maximize_mode_controller() |
| 271 ->EnableMaximizeModeWindowManager(true); | 271 ->EnableMaximizeModeWindowManager(true); |
| 272 EXPECT_TRUE(GetTray()->visible()); | 272 EXPECT_TRUE(GetTray()->visible()); |
| 273 Shell::GetInstance() | 273 Shell::GetInstance() |
| 274 ->maximize_mode_controller() | 274 ->maximize_mode_controller() |
| 275 ->EnableMaximizeModeWindowManager(false); | 275 ->EnableMaximizeModeWindowManager(false); |
| 276 EXPECT_FALSE(GetTray()->visible()); | 276 EXPECT_FALSE(GetTray()->visible()); |
| 277 } | 277 } |
| 278 | 278 |
| 279 } // namespace ash | 279 } // namespace ash |
| OLD | NEW |