| 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/common/ash_switches.h" | 8 #include "ash/common/ash_switches.h" |
| 9 #include "ash/common/display/display_info.h" | 9 #include "ash/common/display/display_info.h" |
| 10 #include "ash/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
| 11 #include "ash/common/wm_shell.h" |
| 11 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 12 #include "ash/shell_init_params.h" | 13 #include "ash/shell_init_params.h" |
| 13 #include "ash/test/ash_test_views_delegate.h" | 14 #include "ash/test/ash_test_views_delegate.h" |
| 14 #include "ash/test/content/test_shell_content_state.h" | 15 #include "ash/test/content/test_shell_content_state.h" |
| 15 #include "ash/test/display_manager_test_api.h" | 16 #include "ash/test/display_manager_test_api.h" |
| 16 #include "ash/test/material_design_controller_test_api.h" | 17 #include "ash/test/material_design_controller_test_api.h" |
| 17 #include "ash/test/shell_test_api.h" | 18 #include "ash/test/shell_test_api.h" |
| 18 #include "ash/test/test_screenshot_delegate.h" | 19 #include "ash/test/test_screenshot_delegate.h" |
| 19 #include "ash/test/test_session_state_delegate.h" | 20 #include "ash/test/test_session_state_delegate.h" |
| 20 #include "ash/test/test_shell_delegate.h" | 21 #include "ash/test/test_shell_delegate.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 124 |
| 124 // ContentTestSuiteBase might have already initialized | 125 // ContentTestSuiteBase might have already initialized |
| 125 // MaterialDesignController in unit_tests suite. | 126 // MaterialDesignController in unit_tests suite. |
| 126 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); | 127 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); |
| 127 ui::MaterialDesignController::Initialize(); | 128 ui::MaterialDesignController::Initialize(); |
| 128 ash::MaterialDesignController::Initialize(); | 129 ash::MaterialDesignController::Initialize(); |
| 129 ShellInitParams init_params; | 130 ShellInitParams init_params; |
| 130 init_params.delegate = test_shell_delegate_; | 131 init_params.delegate = test_shell_delegate_; |
| 131 init_params.context_factory = context_factory; | 132 init_params.context_factory = context_factory; |
| 132 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); | 133 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); |
| 133 ash::Shell::CreateInstance(init_params); | 134 Shell::CreateInstance(init_params); |
| 134 aura::test::EnvTestHelper(aura::Env::GetInstance()) | 135 aura::test::EnvTestHelper(aura::Env::GetInstance()) |
| 135 .SetInputStateLookup(std::unique_ptr<aura::InputStateLookup>()); | 136 .SetInputStateLookup(std::unique_ptr<aura::InputStateLookup>()); |
| 136 | 137 |
| 137 Shell* shell = Shell::GetInstance(); | 138 Shell* shell = Shell::GetInstance(); |
| 138 if (start_session) { | 139 if (start_session) { |
| 139 GetTestSessionStateDelegate()->SetActiveUserSessionStarted(true); | 140 GetTestSessionStateDelegate()->SetActiveUserSessionStarted(true); |
| 140 GetTestSessionStateDelegate()->SetHasActiveUser(true); | 141 GetTestSessionStateDelegate()->SetHasActiveUser(true); |
| 141 } | 142 } |
| 142 | 143 |
| 143 test::DisplayManagerTestApi().DisableChangeDisplayUponHostResize(); | 144 test::DisplayManagerTestApi().DisableChangeDisplayUponHostResize(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 187 } |
| 187 | 188 |
| 188 void AshTestHelper::RunAllPendingInMessageLoop() { | 189 void AshTestHelper::RunAllPendingInMessageLoop() { |
| 189 DCHECK(base::MessageLoopForUI::current() == message_loop_); | 190 DCHECK(base::MessageLoopForUI::current() == message_loop_); |
| 190 base::RunLoop run_loop; | 191 base::RunLoop run_loop; |
| 191 run_loop.RunUntilIdle(); | 192 run_loop.RunUntilIdle(); |
| 192 } | 193 } |
| 193 | 194 |
| 194 // static | 195 // static |
| 195 TestSessionStateDelegate* AshTestHelper::GetTestSessionStateDelegate() { | 196 TestSessionStateDelegate* AshTestHelper::GetTestSessionStateDelegate() { |
| 196 CHECK(Shell::HasInstance()); | 197 CHECK(WmShell::HasInstance()); |
| 197 return static_cast<TestSessionStateDelegate*>( | 198 return static_cast<TestSessionStateDelegate*>( |
| 198 Shell::GetInstance()->session_state_delegate()); | 199 WmShell::Get()->GetSessionStateDelegate()); |
| 199 } | 200 } |
| 200 | 201 |
| 201 aura::Window* AshTestHelper::CurrentContext() { | 202 aura::Window* AshTestHelper::CurrentContext() { |
| 202 aura::Window* root_window = Shell::GetTargetRootWindow(); | 203 aura::Window* root_window = Shell::GetTargetRootWindow(); |
| 203 if (!root_window) | 204 if (!root_window) |
| 204 root_window = Shell::GetPrimaryRootWindow(); | 205 root_window = Shell::GetPrimaryRootWindow(); |
| 205 DCHECK(root_window); | 206 DCHECK(root_window); |
| 206 return root_window; | 207 return root_window; |
| 207 } | 208 } |
| 208 | 209 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 219 bool AshTestHelper::SupportsHostWindowResize() { | 220 bool AshTestHelper::SupportsHostWindowResize() { |
| 220 #if defined(OS_WIN) | 221 #if defined(OS_WIN) |
| 221 return false; | 222 return false; |
| 222 #else | 223 #else |
| 223 return true; | 224 return true; |
| 224 #endif | 225 #endif |
| 225 } | 226 } |
| 226 | 227 |
| 227 } // namespace test | 228 } // namespace test |
| 228 } // namespace ash | 229 } // namespace ash |
| OLD | NEW |