| 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/aura/shell_port_classic.h" | 8 #include "ash/aura/shell_port_classic.h" |
| 9 #include "ash/mus/bridge/shell_port_mash.h" | 9 #include "ash/mus/bridge/shell_port_mash.h" |
| 10 #include "ash/mus/screen_mus.h" | 10 #include "ash/mus/screen_mus.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "ash/wm_window.h" | 25 #include "ash/wm_window.h" |
| 26 #include "base/memory/ptr_util.h" | 26 #include "base/memory/ptr_util.h" |
| 27 #include "base/run_loop.h" | 27 #include "base/run_loop.h" |
| 28 #include "base/strings/string_split.h" | 28 #include "base/strings/string_split.h" |
| 29 #include "base/test/sequenced_worker_pool_owner.h" | 29 #include "base/test/sequenced_worker_pool_owner.h" |
| 30 #include "chromeos/audio/cras_audio_handler.h" | 30 #include "chromeos/audio/cras_audio_handler.h" |
| 31 #include "chromeos/dbus/dbus_thread_manager.h" | 31 #include "chromeos/dbus/dbus_thread_manager.h" |
| 32 #include "chromeos/network/network_handler.h" | 32 #include "chromeos/network/network_handler.h" |
| 33 #include "device/bluetooth/bluetooth_adapter_factory.h" | 33 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 34 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 34 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| 35 #include "services/ui/public/cpp/input_devices/input_device_client.h" |
| 35 #include "ui/aura/env.h" | 36 #include "ui/aura/env.h" |
| 36 #include "ui/aura/input_state_lookup.h" | 37 #include "ui/aura/input_state_lookup.h" |
| 37 #include "ui/aura/mus/window_tree_client.h" | 38 #include "ui/aura/mus/window_tree_client.h" |
| 38 #include "ui/aura/test/env_test_helper.h" | 39 #include "ui/aura/test/env_test_helper.h" |
| 39 #include "ui/aura/test/event_generator_delegate_aura.h" | 40 #include "ui/aura/test/event_generator_delegate_aura.h" |
| 40 #include "ui/aura/test/mus/window_tree_client_private.h" | 41 #include "ui/aura/test/mus/window_tree_client_private.h" |
| 41 #include "ui/base/ime/input_method_initializer.h" | 42 #include "ui/base/ime/input_method_initializer.h" |
| 42 #include "ui/base/material_design/material_design_controller.h" | 43 #include "ui/base/material_design/material_design_controller.h" |
| 43 #include "ui/base/platform_window_defaults.h" | 44 #include "ui/base/platform_window_defaults.h" |
| 44 #include "ui/base/test/material_design_controller_test_api.h" | 45 #include "ui/base/test/material_design_controller_test_api.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 75 test_screenshot_delegate_(nullptr), | 76 test_screenshot_delegate_(nullptr), |
| 76 dbus_thread_manager_initialized_(false), | 77 dbus_thread_manager_initialized_(false), |
| 77 bluez_dbus_manager_initialized_(false) { | 78 bluez_dbus_manager_initialized_(false) { |
| 78 ui::test::EnableTestConfigForPlatformWindows(); | 79 ui::test::EnableTestConfigForPlatformWindows(); |
| 79 aura::test::InitializeAuraEventGeneratorDelegate(); | 80 aura::test::InitializeAuraEventGeneratorDelegate(); |
| 80 } | 81 } |
| 81 | 82 |
| 82 AshTestHelper::~AshTestHelper() {} | 83 AshTestHelper::~AshTestHelper() {} |
| 83 | 84 |
| 84 void AshTestHelper::SetUp(bool start_session) { | 85 void AshTestHelper::SetUp(bool start_session) { |
| 86 if (config_ == Config::MUS) |
| 87 input_device_client_ = base::MakeUnique<ui::InputDeviceClient>(); |
| 88 |
| 85 display::ResetDisplayIdForTest(); | 89 display::ResetDisplayIdForTest(); |
| 86 if (config_ != Config::CLASSIC) | 90 if (config_ != Config::CLASSIC) |
| 87 aura::test::EnvTestHelper().SetAlwaysUseLastMouseLocation(true); | 91 aura::test::EnvTestHelper().SetAlwaysUseLastMouseLocation(true); |
| 88 // WindowManager creates WMState for mash. | 92 // WindowManager creates WMState for mash. |
| 89 if (config_ == Config::CLASSIC) | 93 if (config_ == Config::CLASSIC) |
| 90 wm_state_ = base::MakeUnique<::wm::WMState>(); | 94 wm_state_ = base::MakeUnique<::wm::WMState>(); |
| 91 test_views_delegate_ = ash_test_environment_->CreateViewsDelegate(); | 95 test_views_delegate_ = ash_test_environment_->CreateViewsDelegate(); |
| 92 | 96 |
| 93 // Disable animations during tests. | 97 // Disable animations during tests. |
| 94 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( | 98 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } | 217 } |
| 214 | 218 |
| 215 ui::TerminateContextFactoryForTests(); | 219 ui::TerminateContextFactoryForTests(); |
| 216 | 220 |
| 217 ui::ShutdownInputMethodForTesting(); | 221 ui::ShutdownInputMethodForTesting(); |
| 218 zero_duration_mode_.reset(); | 222 zero_duration_mode_.reset(); |
| 219 | 223 |
| 220 test_views_delegate_.reset(); | 224 test_views_delegate_.reset(); |
| 221 wm_state_.reset(); | 225 wm_state_.reset(); |
| 222 | 226 |
| 227 input_device_client_.reset(); |
| 228 |
| 223 // WindowManager owns the CaptureController for mus/mash. | 229 // WindowManager owns the CaptureController for mus/mash. |
| 224 CHECK(config_ != Config::CLASSIC || !::wm::CaptureController::Get()); | 230 CHECK(config_ != Config::CLASSIC || !::wm::CaptureController::Get()); |
| 225 } | 231 } |
| 226 | 232 |
| 227 void AshTestHelper::RunAllPendingInMessageLoop() { | 233 void AshTestHelper::RunAllPendingInMessageLoop() { |
| 228 base::RunLoop run_loop; | 234 base::RunLoop run_loop; |
| 229 run_loop.RunUntilIdle(); | 235 run_loop.RunUntilIdle(); |
| 230 } | 236 } |
| 231 | 237 |
| 232 // static | 238 // static |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 std::set<RootWindowController*> roots = | 382 std::set<RootWindowController*> roots = |
| 377 window_manager_app_->window_manager()->GetRootWindowControllers(); | 383 window_manager_app_->window_manager()->GetRootWindowControllers(); |
| 378 std::vector<RootWindowController*> ordered_roots; | 384 std::vector<RootWindowController*> ordered_roots; |
| 379 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); | 385 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); |
| 380 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); | 386 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); |
| 381 return ordered_roots; | 387 return ordered_roots; |
| 382 } | 388 } |
| 383 | 389 |
| 384 } // namespace test | 390 } // namespace test |
| 385 } // namespace ash | 391 } // namespace ash |
| OLD | NEW |