| 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/common/system/overview/overview_button_tray.h" | 5 #include "ash/common/system/overview/overview_button_tray.h" |
| 6 | 6 |
| 7 #include "ash/common/login_status.h" | 7 #include "ash/common/login_status.h" |
| 8 #include "ash/common/system/status_area_widget.h" | 8 #include "ash/common/system/status_area_widget.h" |
| 9 #include "ash/common/test/test_session_state_delegate.h" | 9 #include "ash/common/test/test_session_state_delegate.h" |
| 10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 ->overview_button_tray(); | 40 ->overview_button_tray(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 OverviewButtonTray* GetSecondaryTray() { | 43 OverviewButtonTray* GetSecondaryTray() { |
| 44 return StatusAreaWidgetTestHelper::GetSecondaryStatusAreaWidget() | 44 return StatusAreaWidgetTestHelper::GetSecondaryStatusAreaWidget() |
| 45 ->overview_button_tray(); | 45 ->overview_button_tray(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 } // namespace | 48 } // namespace |
| 49 | 49 |
| 50 // TODO(jamescook): Migrate to //ash/common/system. http://crbug.com/620955 | |
| 51 class OverviewButtonTrayTest : public test::AshTestBase { | 50 class OverviewButtonTrayTest : public test::AshTestBase { |
| 52 public: | 51 public: |
| 53 OverviewButtonTrayTest() {} | 52 OverviewButtonTrayTest() {} |
| 54 ~OverviewButtonTrayTest() override {} | 53 ~OverviewButtonTrayTest() override {} |
| 55 | 54 |
| 56 void SetUp() override; | 55 void SetUp() override; |
| 57 | 56 |
| 58 void NotifySessionStateChanged(); | 57 void NotifySessionStateChanged(); |
| 59 | 58 |
| 60 protected: | 59 protected: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 std::unique_ptr<aura::Window> window( | 103 std::unique_ptr<aura::Window> window( |
| 105 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 104 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
| 106 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), | 105 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), |
| 107 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); | 106 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
| 108 GetTray()->PerformAction(tap); | 107 GetTray()->PerformAction(tap); |
| 109 EXPECT_TRUE(WmShell::Get()->window_selector_controller()->IsSelecting()); | 108 EXPECT_TRUE(WmShell::Get()->window_selector_controller()->IsSelecting()); |
| 110 } | 109 } |
| 111 | 110 |
| 112 // Tests that tapping on the control will record the user action Tray_Overview. | 111 // Tests that tapping on the control will record the user action Tray_Overview. |
| 113 TEST_F(OverviewButtonTrayTest, TrayOverviewUserAction) { | 112 TEST_F(OverviewButtonTrayTest, TrayOverviewUserAction) { |
| 113 // TODO: investigate failure in mash, http://crbug.com/698129. |
| 114 if (WmShell::Get()->IsRunningInMash()) |
| 115 return; |
| 116 |
| 114 ASSERT_FALSE(WmShell::Get()->window_selector_controller()->IsSelecting()); | 117 ASSERT_FALSE(WmShell::Get()->window_selector_controller()->IsSelecting()); |
| 115 | 118 |
| 116 // 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 |
| 117 // enter overview mode) should still record the action. | 120 // enter overview mode) should still record the action. |
| 118 base::UserActionTester user_action_tester; | 121 base::UserActionTester user_action_tester; |
| 119 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), | 122 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), |
| 120 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); | 123 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
| 121 GetTray()->PerformAction(tap); | 124 GetTray()->PerformAction(tap); |
| 122 ASSERT_FALSE(WmShell::Get()->window_selector_controller()->IsSelecting()); | 125 ASSERT_FALSE(WmShell::Get()->window_selector_controller()->IsSelecting()); |
| 123 EXPECT_EQ(1, user_action_tester.GetActionCount(kTrayOverview)); | 126 EXPECT_EQ(1, user_action_tester.GetActionCount(kTrayOverview)); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 EXPECT_TRUE(GetTray()->is_active()); | 203 EXPECT_TRUE(GetTray()->is_active()); |
| 201 | 204 |
| 202 EXPECT_TRUE(WmShell::Get()->window_selector_controller()->ToggleOverview()); | 205 EXPECT_TRUE(WmShell::Get()->window_selector_controller()->ToggleOverview()); |
| 203 EXPECT_FALSE(WmShell::Get()->window_selector_controller()->IsSelecting()); | 206 EXPECT_FALSE(WmShell::Get()->window_selector_controller()->IsSelecting()); |
| 204 EXPECT_FALSE(GetTray()->is_active()); | 207 EXPECT_FALSE(GetTray()->is_active()); |
| 205 } | 208 } |
| 206 | 209 |
| 207 // Test that when a hide animation is aborted via deletion, that the | 210 // Test that when a hide animation is aborted via deletion, that the |
| 208 // OverviewButton is still hidden. | 211 // OverviewButton is still hidden. |
| 209 TEST_F(OverviewButtonTrayTest, HideAnimationAlwaysCompletes) { | 212 TEST_F(OverviewButtonTrayTest, HideAnimationAlwaysCompletes) { |
| 213 // TODO: disabled as ScreenRotationAnimator does not work in mash, |
| 214 // http://crbug.com/696754. |
| 215 if (WmShell::Get()->IsRunningInMash()) |
| 216 return; |
| 217 |
| 210 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 218 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 211 true); | 219 true); |
| 212 | 220 |
| 213 // Long duration for hide animation, to allow it to be interrupted. | 221 // Long duration for hide animation, to allow it to be interrupted. |
| 214 std::unique_ptr<ui::ScopedAnimationDurationScaleMode> hide_duration( | 222 std::unique_ptr<ui::ScopedAnimationDurationScaleMode> hide_duration( |
| 215 new ui::ScopedAnimationDurationScaleMode( | 223 new ui::ScopedAnimationDurationScaleMode( |
| 216 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION)); | 224 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION)); |
| 217 GetTray()->SetVisible(false); | 225 GetTray()->SetVisible(false); |
| 218 | 226 |
| 219 // ScreenRotationAnimator copies the current layers, and deletes them upon | 227 // ScreenRotationAnimator copies the current layers, and deletes them upon |
| (...skipping 25 matching lines...) Expand all Loading... |
| 245 ASSERT_TRUE(WmShell::Get()->IsSystemModalWindowOpen()); | 253 ASSERT_TRUE(WmShell::Get()->IsSystemModalWindowOpen()); |
| 246 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 254 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 247 true); | 255 true); |
| 248 EXPECT_TRUE(GetTray()->visible()); | 256 EXPECT_TRUE(GetTray()->visible()); |
| 249 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 257 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 250 false); | 258 false); |
| 251 EXPECT_FALSE(GetTray()->visible()); | 259 EXPECT_FALSE(GetTray()->visible()); |
| 252 } | 260 } |
| 253 | 261 |
| 254 } // namespace ash | 262 } // namespace ash |
| OLD | NEW |