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/shelf_types.h" | 8 #include "ash/public/cpp/shelf_types.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" |
11 #include "ash/session/session_controller.h" | 11 #include "ash/session/session_controller.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/shell_port.h" |
13 #include "ash/system/status_area_widget.h" | 14 #include "ash/system/status_area_widget.h" |
14 #include "ash/test/ash_test_base.h" | 15 #include "ash/test/ash_test_base.h" |
15 #include "ash/test/ash_test_helper.h" | 16 #include "ash/test/ash_test_helper.h" |
16 #include "ash/test/status_area_widget_test_helper.h" | 17 #include "ash/test/status_area_widget_test_helper.h" |
17 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 18 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
18 #include "ash/wm/overview/window_selector_controller.h" | 19 #include "ash/wm/overview/window_selector_controller.h" |
19 #include "ash/wm_shell.h" | |
20 #include "base/command_line.h" | 20 #include "base/command_line.h" |
21 #include "base/test/user_action_tester.h" | 21 #include "base/test/user_action_tester.h" |
22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
23 #include "ui/aura/client/aura_constants.h" | 23 #include "ui/aura/client/aura_constants.h" |
24 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
25 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 25 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
26 #include "ui/display/display_switches.h" | 26 #include "ui/display/display_switches.h" |
27 #include "ui/display/manager/display_manager.h" | 27 #include "ui/display/manager/display_manager.h" |
28 #include "ui/events/event.h" | 28 #include "ui/events/event.h" |
29 #include "ui/events/event_constants.h" | 29 #include "ui/events/event_constants.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 105 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
106 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), | 106 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), |
107 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); | 107 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
108 GetTray()->PerformAction(tap); | 108 GetTray()->PerformAction(tap); |
109 EXPECT_TRUE(Shell::Get()->window_selector_controller()->IsSelecting()); | 109 EXPECT_TRUE(Shell::Get()->window_selector_controller()->IsSelecting()); |
110 } | 110 } |
111 | 111 |
112 // Tests that tapping on the control will record the user action Tray_Overview. | 112 // Tests that tapping on the control will record the user action Tray_Overview. |
113 TEST_F(OverviewButtonTrayTest, TrayOverviewUserAction) { | 113 TEST_F(OverviewButtonTrayTest, TrayOverviewUserAction) { |
114 // TODO: investigate failure in mash, http://crbug.com/698129. | 114 // TODO: investigate failure in mash, http://crbug.com/698129. |
115 if (WmShell::Get()->IsRunningInMash()) | 115 if (ShellPort::Get()->IsRunningInMash()) |
116 return; | 116 return; |
117 | 117 |
118 ASSERT_FALSE(Shell::Get()->window_selector_controller()->IsSelecting()); | 118 ASSERT_FALSE(Shell::Get()->window_selector_controller()->IsSelecting()); |
119 | 119 |
120 // Tapping on the control when there are no windows (and thus the user cannot | 120 // Tapping on the control when there are no windows (and thus the user cannot |
121 // enter overview mode) should still record the action. | 121 // enter overview mode) should still record the action. |
122 base::UserActionTester user_action_tester; | 122 base::UserActionTester user_action_tester; |
123 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), | 123 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), |
124 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); | 124 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
125 GetTray()->PerformAction(tap); | 125 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()); | 206 EXPECT_TRUE(Shell::Get()->window_selector_controller()->ToggleOverview()); |
207 EXPECT_FALSE(Shell::Get()->window_selector_controller()->IsSelecting()); | 207 EXPECT_FALSE(Shell::Get()->window_selector_controller()->IsSelecting()); |
208 EXPECT_FALSE(GetTray()->is_active()); | 208 EXPECT_FALSE(GetTray()->is_active()); |
209 } | 209 } |
210 | 210 |
211 // Test that when a hide animation is aborted via deletion, that the | 211 // Test that when a hide animation is aborted via deletion, that the |
212 // OverviewButton is still hidden. | 212 // OverviewButton is still hidden. |
213 TEST_F(OverviewButtonTrayTest, HideAnimationAlwaysCompletes) { | 213 TEST_F(OverviewButtonTrayTest, HideAnimationAlwaysCompletes) { |
214 // TODO: disabled as ScreenRotationAnimator does not work in mash, | 214 // TODO: disabled as ScreenRotationAnimator does not work in mash, |
215 // http://crbug.com/696754. | 215 // http://crbug.com/696754. |
216 if (WmShell::Get()->IsRunningInMash()) | 216 if (ShellPort::Get()->IsRunningInMash()) |
217 return; | 217 return; |
218 | 218 |
219 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 219 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
220 true); | 220 true); |
221 | 221 |
222 // Long duration for hide animation, to allow it to be interrupted. | 222 // Long duration for hide animation, to allow it to be interrupted. |
223 std::unique_ptr<ui::ScopedAnimationDurationScaleMode> hide_duration( | 223 std::unique_ptr<ui::ScopedAnimationDurationScaleMode> hide_duration( |
224 new ui::ScopedAnimationDurationScaleMode( | 224 new ui::ScopedAnimationDurationScaleMode( |
225 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION)); | 225 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION)); |
226 GetTray()->SetVisible(false); | 226 GetTray()->SetVisible(false); |
(...skipping 17 matching lines...) Expand all Loading... |
244 TEST_F(OverviewButtonTrayTest, VisibilityChangesForSystemModalWindow) { | 244 TEST_F(OverviewButtonTrayTest, VisibilityChangesForSystemModalWindow) { |
245 // TODO(jonross): When CreateTestWindow*() have been unified, use the | 245 // TODO(jonross): When CreateTestWindow*() have been unified, use the |
246 // appropriate method to replace this setup. (crbug.com/483503) | 246 // appropriate method to replace this setup. (crbug.com/483503) |
247 std::unique_ptr<aura::Window> window(new aura::Window(nullptr)); | 247 std::unique_ptr<aura::Window> window(new aura::Window(nullptr)); |
248 window->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_SYSTEM); | 248 window->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_SYSTEM); |
249 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 249 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
250 window->Init(ui::LAYER_TEXTURED); | 250 window->Init(ui::LAYER_TEXTURED); |
251 window->Show(); | 251 window->Show(); |
252 ParentWindowInPrimaryRootWindow(window.get()); | 252 ParentWindowInPrimaryRootWindow(window.get()); |
253 | 253 |
254 ASSERT_TRUE(WmShell::Get()->IsSystemModalWindowOpen()); | 254 ASSERT_TRUE(ShellPort::Get()->IsSystemModalWindowOpen()); |
255 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 255 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
256 true); | 256 true); |
257 EXPECT_TRUE(GetTray()->visible()); | 257 EXPECT_TRUE(GetTray()->visible()); |
258 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 258 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
259 false); | 259 false); |
260 EXPECT_FALSE(GetTray()->visible()); | 260 EXPECT_FALSE(GetTray()->visible()); |
261 } | 261 } |
262 | 262 |
263 } // namespace ash | 263 } // namespace ash |
OLD | NEW |