| 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.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/test/display_manager_test_api.h" | 10 #include "ash/test/display_manager_test_api.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 CHECK(message_loop_); | 45 CHECK(message_loop_); |
| 46 #if defined(USE_X11) | 46 #if defined(USE_X11) |
| 47 aura::test::SetUseOverrideRedirectWindowByDefault(true); | 47 aura::test::SetUseOverrideRedirectWindowByDefault(true); |
| 48 #endif | 48 #endif |
| 49 } | 49 } |
| 50 | 50 |
| 51 AshTestHelper::~AshTestHelper() { | 51 AshTestHelper::~AshTestHelper() { |
| 52 } | 52 } |
| 53 | 53 |
| 54 void AshTestHelper::SetUp(bool start_session) { | 54 void AshTestHelper::SetUp(bool start_session) { |
| 55 wm_state_.reset(new views::corewm::WMState); | 55 wm_state_.reset(new wm::WMState); |
| 56 | 56 |
| 57 // Disable animations during tests. | 57 // Disable animations during tests. |
| 58 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( | 58 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( |
| 59 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); | 59 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); |
| 60 ui::InitializeInputMethodForTesting(); | 60 ui::InitializeInputMethodForTesting(); |
| 61 | 61 |
| 62 bool enable_pixel_output = false; | 62 bool enable_pixel_output = false; |
| 63 ui::InitializeContextFactoryForTests(enable_pixel_output); | 63 ui::InitializeContextFactoryForTests(enable_pixel_output); |
| 64 | 64 |
| 65 // Creates Shell and hook with Desktop. | 65 // Creates Shell and hook with Desktop. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 aura::Env::DeleteInstance(); | 120 aura::Env::DeleteInstance(); |
| 121 ui::TerminateContextFactoryForTests(); | 121 ui::TerminateContextFactoryForTests(); |
| 122 | 122 |
| 123 // Need to reset the initial login status. | 123 // Need to reset the initial login status. |
| 124 TestSystemTrayDelegate::SetInitialLoginStatus(user::LOGGED_IN_USER); | 124 TestSystemTrayDelegate::SetInitialLoginStatus(user::LOGGED_IN_USER); |
| 125 | 125 |
| 126 ui::ShutdownInputMethodForTesting(); | 126 ui::ShutdownInputMethodForTesting(); |
| 127 zero_duration_mode_.reset(); | 127 zero_duration_mode_.reset(); |
| 128 | 128 |
| 129 CHECK(!views::corewm::ScopedCaptureClient::IsActive()); | 129 CHECK(!wm::ScopedCaptureClient::IsActive()); |
| 130 | 130 |
| 131 wm_state_.reset(); | 131 wm_state_.reset(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void AshTestHelper::RunAllPendingInMessageLoop() { | 134 void AshTestHelper::RunAllPendingInMessageLoop() { |
| 135 DCHECK(base::MessageLoopForUI::current() == message_loop_); | 135 DCHECK(base::MessageLoopForUI::current() == message_loop_); |
| 136 aura::Env::CreateInstance(); | 136 aura::Env::CreateInstance(); |
| 137 base::RunLoop run_loop; | 137 base::RunLoop run_loop; |
| 138 run_loop.RunUntilIdle(); | 138 run_loop.RunUntilIdle(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 aura::Window* AshTestHelper::CurrentContext() { | 141 aura::Window* AshTestHelper::CurrentContext() { |
| 142 aura::Window* root_window = Shell::GetTargetRootWindow(); | 142 aura::Window* root_window = Shell::GetTargetRootWindow(); |
| 143 if (!root_window) | 143 if (!root_window) |
| 144 root_window = Shell::GetPrimaryRootWindow(); | 144 root_window = Shell::GetPrimaryRootWindow(); |
| 145 DCHECK(root_window); | 145 DCHECK(root_window); |
| 146 return root_window; | 146 return root_window; |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace test | 149 } // namespace test |
| 150 } // namespace ash | 150 } // namespace ash |
| OLD | NEW |