| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 AshTestHelper::~AshTestHelper() {} | 82 AshTestHelper::~AshTestHelper() {} |
| 83 | 83 |
| 84 void AshTestHelper::SetUp(bool start_session) { | 84 void AshTestHelper::SetUp(bool start_session) { |
| 85 display::ResetDisplayIdForTest(); | 85 display::ResetDisplayIdForTest(); |
| 86 if (config_ != Config::CLASSIC) | 86 if (config_ != Config::CLASSIC) |
| 87 aura::test::EnvTestHelper().SetAlwaysUseLastMouseLocation(true); | 87 aura::test::EnvTestHelper().SetAlwaysUseLastMouseLocation(true); |
| 88 // WindowManager creates WMState for mash. | 88 // WindowManager creates WMState for mash. |
| 89 if (config_ == Config::CLASSIC) | 89 if (config_ == Config::CLASSIC) |
| 90 wm_state_ = base::MakeUnique<::wm::WMState>(); | 90 wm_state_ = base::MakeUnique<::wm::WMState>(); |
| 91 views_delegate_ = ash_test_environment_->CreateViewsDelegate(); | 91 test_views_delegate_ = ash_test_environment_->CreateViewsDelegate(); |
| 92 | 92 |
| 93 // Disable animations during tests. | 93 // Disable animations during tests. |
| 94 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( | 94 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( |
| 95 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); | 95 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); |
| 96 ui::InitializeInputMethodForTesting(); | 96 ui::InitializeInputMethodForTesting(); |
| 97 | 97 |
| 98 // Creates Shell and hook with Desktop. | 98 // Creates Shell and hook with Desktop. |
| 99 if (!test_shell_delegate_) | 99 if (!test_shell_delegate_) |
| 100 test_shell_delegate_ = new TestShellDelegate; | 100 test_shell_delegate_ = new TestShellDelegate; |
| 101 | 101 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 if (dbus_thread_manager_initialized_) { | 210 if (dbus_thread_manager_initialized_) { |
| 211 chromeos::DBusThreadManager::Shutdown(); | 211 chromeos::DBusThreadManager::Shutdown(); |
| 212 dbus_thread_manager_initialized_ = false; | 212 dbus_thread_manager_initialized_ = false; |
| 213 } | 213 } |
| 214 | 214 |
| 215 ui::TerminateContextFactoryForTests(); | 215 ui::TerminateContextFactoryForTests(); |
| 216 | 216 |
| 217 ui::ShutdownInputMethodForTesting(); | 217 ui::ShutdownInputMethodForTesting(); |
| 218 zero_duration_mode_.reset(); | 218 zero_duration_mode_.reset(); |
| 219 | 219 |
| 220 views_delegate_.reset(); | 220 test_views_delegate_.reset(); |
| 221 wm_state_.reset(); | 221 wm_state_.reset(); |
| 222 | 222 |
| 223 // WindowManager owns the CaptureController for mus/mash. | 223 // WindowManager owns the CaptureController for mus/mash. |
| 224 CHECK(config_ != Config::CLASSIC || !::wm::CaptureController::Get()); | 224 CHECK(config_ != Config::CLASSIC || !::wm::CaptureController::Get()); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void AshTestHelper::RunAllPendingInMessageLoop() { | 227 void AshTestHelper::RunAllPendingInMessageLoop() { |
| 228 base::RunLoop run_loop; | 228 base::RunLoop run_loop; |
| 229 run_loop.RunUntilIdle(); | 229 run_loop.RunUntilIdle(); |
| 230 } | 230 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 std::set<RootWindowController*> roots = | 376 std::set<RootWindowController*> roots = |
| 377 window_manager_app_->window_manager()->GetRootWindowControllers(); | 377 window_manager_app_->window_manager()->GetRootWindowControllers(); |
| 378 std::vector<RootWindowController*> ordered_roots; | 378 std::vector<RootWindowController*> ordered_roots; |
| 379 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); | 379 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); |
| 380 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); | 380 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); |
| 381 return ordered_roots; | 381 return ordered_roots; |
| 382 } | 382 } |
| 383 | 383 |
| 384 } // namespace test | 384 } // namespace test |
| 385 } // namespace ash | 385 } // namespace ash |
| OLD | NEW |