OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/test/ash_test_helper.h" | 5 #include "ash/test/ash_test_helper.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller_delegate_aura.h" | 7 #include "ash/accelerators/accelerator_controller_delegate_aura.h" |
| 8 #include "ash/ash_switches.h" |
8 #include "ash/aura/shell_port_classic.h" | 9 #include "ash/aura/shell_port_classic.h" |
9 #include "ash/mus/bridge/shell_port_mash.h" | 10 #include "ash/mus/bridge/shell_port_mash.h" |
10 #include "ash/mus/screen_mus.h" | 11 #include "ash/mus/screen_mus.h" |
11 #include "ash/mus/window_manager.h" | 12 #include "ash/mus/window_manager.h" |
12 #include "ash/mus/window_manager_application.h" | 13 #include "ash/mus/window_manager_application.h" |
13 #include "ash/public/cpp/config.h" | 14 #include "ash/public/cpp/config.h" |
14 #include "ash/shell.h" | 15 #include "ash/shell.h" |
15 #include "ash/shell_init_params.h" | 16 #include "ash/shell_init_params.h" |
16 #include "ash/shell_port.h" | 17 #include "ash/shell_port.h" |
17 #include "ash/system/screen_layout_observer.h" | 18 #include "ash/system/screen_layout_observer.h" |
(...skipping 20 matching lines...) Expand all Loading... |
38 #include "ui/aura/mus/window_tree_client.h" | 39 #include "ui/aura/mus/window_tree_client.h" |
39 #include "ui/aura/test/env_test_helper.h" | 40 #include "ui/aura/test/env_test_helper.h" |
40 #include "ui/aura/test/event_generator_delegate_aura.h" | 41 #include "ui/aura/test/event_generator_delegate_aura.h" |
41 #include "ui/aura/test/mus/window_tree_client_private.h" | 42 #include "ui/aura/test/mus/window_tree_client_private.h" |
42 #include "ui/base/ime/input_method_initializer.h" | 43 #include "ui/base/ime/input_method_initializer.h" |
43 #include "ui/base/material_design/material_design_controller.h" | 44 #include "ui/base/material_design/material_design_controller.h" |
44 #include "ui/base/platform_window_defaults.h" | 45 #include "ui/base/platform_window_defaults.h" |
45 #include "ui/base/test/material_design_controller_test_api.h" | 46 #include "ui/base/test/material_design_controller_test_api.h" |
46 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 47 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
47 #include "ui/compositor/test/context_factories_for_test.h" | 48 #include "ui/compositor/test/context_factories_for_test.h" |
| 49 #include "ui/display/display_switches.h" |
48 #include "ui/display/manager/display_manager.h" | 50 #include "ui/display/manager/display_manager.h" |
49 #include "ui/display/manager/managed_display_info.h" | 51 #include "ui/display/manager/managed_display_info.h" |
50 #include "ui/display/test/display_manager_test_api.h" | 52 #include "ui/display/test/display_manager_test_api.h" |
51 #include "ui/message_center/message_center.h" | 53 #include "ui/message_center/message_center.h" |
52 #include "ui/wm/core/capture_controller.h" | 54 #include "ui/wm/core/capture_controller.h" |
53 #include "ui/wm/core/cursor_manager.h" | 55 #include "ui/wm/core/cursor_manager.h" |
54 #include "ui/wm/core/wm_state.h" | 56 #include "ui/wm/core/wm_state.h" |
55 | 57 |
56 using display::ManagedDisplayInfo; | 58 using display::ManagedDisplayInfo; |
57 | 59 |
(...skipping 18 matching lines...) Expand all Loading... |
76 test_screenshot_delegate_(nullptr), | 78 test_screenshot_delegate_(nullptr), |
77 dbus_thread_manager_initialized_(false), | 79 dbus_thread_manager_initialized_(false), |
78 bluez_dbus_manager_initialized_(false) { | 80 bluez_dbus_manager_initialized_(false) { |
79 ui::test::EnableTestConfigForPlatformWindows(); | 81 ui::test::EnableTestConfigForPlatformWindows(); |
80 aura::test::InitializeAuraEventGeneratorDelegate(); | 82 aura::test::InitializeAuraEventGeneratorDelegate(); |
81 } | 83 } |
82 | 84 |
83 AshTestHelper::~AshTestHelper() {} | 85 AshTestHelper::~AshTestHelper() {} |
84 | 86 |
85 void AshTestHelper::SetUp(bool start_session) { | 87 void AshTestHelper::SetUp(bool start_session) { |
| 88 command_line_ = base::MakeUnique<base::test::ScopedCommandLine>(); |
| 89 // TODO(jamescook): Can we do this without changing command line? |
| 90 // Use the origin (1,1) so that it doesn't over |
| 91 // lap with the native mouse cursor. |
| 92 if (!command_line_->GetProcessCommandLine()->HasSwitch( |
| 93 ::switches::kHostWindowBounds)) { |
| 94 command_line_->GetProcessCommandLine()->AppendSwitchASCII( |
| 95 ::switches::kHostWindowBounds, "1+1-800x600"); |
| 96 } |
| 97 |
| 98 // TODO(wutao): We enabled a smooth screen rotation animation, which is using |
| 99 // an asynchronous method. However for some tests require to evaluate the |
| 100 // screen rotation immediately after the operation of setting display |
| 101 // rotation, we need to append a slow screen rotation animation flag to pass |
| 102 // the tests. When we remove the flag "ash-disable-smooth-screen-rotation", we |
| 103 // need to disable the screen rotation animation in the test. |
| 104 if (!command_line_->GetProcessCommandLine()->HasSwitch( |
| 105 switches::kAshDisableSmoothScreenRotation)) { |
| 106 command_line_->GetProcessCommandLine()->AppendSwitch( |
| 107 switches::kAshDisableSmoothScreenRotation); |
| 108 } |
| 109 |
86 if (config_ == Config::MUS) | 110 if (config_ == Config::MUS) |
87 input_device_client_ = base::MakeUnique<ui::InputDeviceClient>(); | 111 input_device_client_ = base::MakeUnique<ui::InputDeviceClient>(); |
88 | 112 |
89 display::ResetDisplayIdForTest(); | 113 display::ResetDisplayIdForTest(); |
90 if (config_ != Config::CLASSIC) | 114 if (config_ != Config::CLASSIC) |
91 aura::test::EnvTestHelper().SetAlwaysUseLastMouseLocation(true); | 115 aura::test::EnvTestHelper().SetAlwaysUseLastMouseLocation(true); |
92 // WindowManager creates WMState for mash. | 116 // WindowManager creates WMState for mash. |
93 if (config_ == Config::CLASSIC) | 117 if (config_ == Config::CLASSIC) |
94 wm_state_ = base::MakeUnique<::wm::WMState>(); | 118 wm_state_ = base::MakeUnique<::wm::WMState>(); |
95 test_views_delegate_ = ash_test_environment_->CreateViewsDelegate(); | 119 test_views_delegate_ = ash_test_environment_->CreateViewsDelegate(); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 ui::TerminateContextFactoryForTests(); | 243 ui::TerminateContextFactoryForTests(); |
220 | 244 |
221 ui::ShutdownInputMethodForTesting(); | 245 ui::ShutdownInputMethodForTesting(); |
222 zero_duration_mode_.reset(); | 246 zero_duration_mode_.reset(); |
223 | 247 |
224 test_views_delegate_.reset(); | 248 test_views_delegate_.reset(); |
225 wm_state_.reset(); | 249 wm_state_.reset(); |
226 | 250 |
227 input_device_client_.reset(); | 251 input_device_client_.reset(); |
228 | 252 |
| 253 command_line_.reset(); |
| 254 |
229 // WindowManager owns the CaptureController for mus/mash. | 255 // WindowManager owns the CaptureController for mus/mash. |
230 CHECK(config_ != Config::CLASSIC || !::wm::CaptureController::Get()); | 256 CHECK(config_ != Config::CLASSIC || !::wm::CaptureController::Get()); |
231 } | 257 } |
232 | 258 |
233 void AshTestHelper::RunAllPendingInMessageLoop() { | 259 void AshTestHelper::RunAllPendingInMessageLoop() { |
234 base::RunLoop run_loop; | 260 base::RunLoop run_loop; |
235 run_loop.RunUntilIdle(); | 261 run_loop.RunUntilIdle(); |
236 } | 262 } |
237 | 263 |
238 // static | 264 // static |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 std::set<RootWindowController*> roots = | 408 std::set<RootWindowController*> roots = |
383 window_manager_app_->window_manager()->GetRootWindowControllers(); | 409 window_manager_app_->window_manager()->GetRootWindowControllers(); |
384 std::vector<RootWindowController*> ordered_roots; | 410 std::vector<RootWindowController*> ordered_roots; |
385 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); | 411 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); |
386 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); | 412 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); |
387 return ordered_roots; | 413 return ordered_roots; |
388 } | 414 } |
389 | 415 |
390 } // namespace test | 416 } // namespace test |
391 } // namespace ash | 417 } // namespace ash |
OLD | NEW |