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/login_status.h" | 7 #include "ash/login_status.h" |
| 8 #include "ash/public/cpp/config.h" |
8 #include "ash/public/cpp/shelf_types.h" | 9 #include "ash/public/cpp/shelf_types.h" |
9 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
10 #include "ash/rotator/screen_rotation_animator.h" | 11 #include "ash/rotator/screen_rotation_animator.h" |
11 #include "ash/session/session_controller.h" | 12 #include "ash/session/session_controller.h" |
12 #include "ash/shell.h" | 13 #include "ash/shell.h" |
13 #include "ash/shell_port.h" | 14 #include "ash/shell_port.h" |
14 #include "ash/system/status_area_widget.h" | 15 #include "ash/system/status_area_widget.h" |
15 #include "ash/test/ash_test_base.h" | 16 #include "ash/test/ash_test_base.h" |
16 #include "ash/test/ash_test_helper.h" | 17 #include "ash/test/ash_test_helper.h" |
17 #include "ash/test/status_area_widget_test_helper.h" | 18 #include "ash/test/status_area_widget_test_helper.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 106 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
106 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), | 107 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), |
107 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); | 108 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
108 GetTray()->PerformAction(tap); | 109 GetTray()->PerformAction(tap); |
109 EXPECT_TRUE(Shell::Get()->window_selector_controller()->IsSelecting()); | 110 EXPECT_TRUE(Shell::Get()->window_selector_controller()->IsSelecting()); |
110 } | 111 } |
111 | 112 |
112 // Tests that tapping on the control will record the user action Tray_Overview. | 113 // Tests that tapping on the control will record the user action Tray_Overview. |
113 TEST_F(OverviewButtonTrayTest, TrayOverviewUserAction) { | 114 TEST_F(OverviewButtonTrayTest, TrayOverviewUserAction) { |
114 // TODO: investigate failure in mash, http://crbug.com/698129. | 115 // TODO: investigate failure in mash, http://crbug.com/698129. |
115 if (ShellPort::Get()->IsRunningInMash()) | 116 if (Shell::GetAshConfig() == Config::MASH) |
116 return; | 117 return; |
117 | 118 |
118 ASSERT_FALSE(Shell::Get()->window_selector_controller()->IsSelecting()); | 119 ASSERT_FALSE(Shell::Get()->window_selector_controller()->IsSelecting()); |
119 | 120 |
120 // Tapping on the control when there are no windows (and thus the user cannot | 121 // Tapping on the control when there are no windows (and thus the user cannot |
121 // enter overview mode) should still record the action. | 122 // enter overview mode) should still record the action. |
122 base::UserActionTester user_action_tester; | 123 base::UserActionTester user_action_tester; |
123 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), | 124 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), |
124 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); | 125 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
125 GetTray()->PerformAction(tap); | 126 GetTray()->PerformAction(tap); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 EXPECT_TRUE(Shell::Get()->window_selector_controller()->ToggleOverview()); | 207 EXPECT_TRUE(Shell::Get()->window_selector_controller()->ToggleOverview()); |
207 EXPECT_FALSE(Shell::Get()->window_selector_controller()->IsSelecting()); | 208 EXPECT_FALSE(Shell::Get()->window_selector_controller()->IsSelecting()); |
208 EXPECT_FALSE(GetTray()->is_active()); | 209 EXPECT_FALSE(GetTray()->is_active()); |
209 } | 210 } |
210 | 211 |
211 // Test that when a hide animation is aborted via deletion, that the | 212 // Test that when a hide animation is aborted via deletion, that the |
212 // OverviewButton is still hidden. | 213 // OverviewButton is still hidden. |
213 TEST_F(OverviewButtonTrayTest, HideAnimationAlwaysCompletes) { | 214 TEST_F(OverviewButtonTrayTest, HideAnimationAlwaysCompletes) { |
214 // TODO: disabled as ScreenRotationAnimator does not work in mash, | 215 // TODO: disabled as ScreenRotationAnimator does not work in mash, |
215 // http://crbug.com/696754. | 216 // http://crbug.com/696754. |
216 if (ShellPort::Get()->IsRunningInMash()) | 217 if (Shell::GetAshConfig() == Config::MASH) |
217 return; | 218 return; |
218 | 219 |
219 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 220 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
220 true); | 221 true); |
221 | 222 |
222 // Long duration for hide animation, to allow it to be interrupted. | 223 // Long duration for hide animation, to allow it to be interrupted. |
223 std::unique_ptr<ui::ScopedAnimationDurationScaleMode> hide_duration( | 224 std::unique_ptr<ui::ScopedAnimationDurationScaleMode> hide_duration( |
224 new ui::ScopedAnimationDurationScaleMode( | 225 new ui::ScopedAnimationDurationScaleMode( |
225 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION)); | 226 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION)); |
226 GetTray()->SetVisible(false); | 227 GetTray()->SetVisible(false); |
(...skipping 27 matching lines...) Expand all Loading... |
254 ASSERT_TRUE(ShellPort::Get()->IsSystemModalWindowOpen()); | 255 ASSERT_TRUE(ShellPort::Get()->IsSystemModalWindowOpen()); |
255 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 256 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
256 true); | 257 true); |
257 EXPECT_TRUE(GetTray()->visible()); | 258 EXPECT_TRUE(GetTray()->visible()); |
258 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 259 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
259 false); | 260 false); |
260 EXPECT_FALSE(GetTray()->visible()); | 261 EXPECT_FALSE(GetTray()->visible()); |
261 } | 262 } |
262 | 263 |
263 } // namespace ash | 264 } // namespace ash |
OLD | NEW |