| Index: ash/test/ash_test_helper.cc
|
| diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc
|
| index 5fd2ac1b8272c1afa7b98f86d58468d1b35649c9..936ba6f60ca267ab89bd457a6b9dc8de93b246c2 100644
|
| --- a/ash/test/ash_test_helper.cc
|
| +++ b/ash/test/ash_test_helper.cc
|
| @@ -11,8 +11,8 @@
|
| #include "ash/common/wm_shell.h"
|
| #include "ash/shell.h"
|
| #include "ash/shell_init_params.h"
|
| +#include "ash/test/ash_test_environment.h"
|
| #include "ash/test/ash_test_views_delegate.h"
|
| -#include "ash/test/content/test_shell_content_state.h"
|
| #include "ash/test/display_manager_test_api.h"
|
| #include "ash/test/shell_test_api.h"
|
| #include "ash/test/test_screenshot_delegate.h"
|
| @@ -20,7 +20,6 @@
|
| #include "ash/test/test_shell_delegate.h"
|
| #include "ash/test/test_system_tray_delegate.h"
|
| #include "base/run_loop.h"
|
| -#include "content/public/browser/browser_thread.h"
|
| #include "ui/aura/env.h"
|
| #include "ui/aura/input_state_lookup.h"
|
| #include "ui/aura/test/env_test_helper.h"
|
| @@ -38,6 +37,7 @@
|
| #if defined(OS_CHROMEOS)
|
| #include "chromeos/audio/cras_audio_handler.h"
|
| #include "chromeos/dbus/dbus_thread_manager.h"
|
| +#include "device/bluetooth/bluetooth_adapter_factory.h"
|
| #include "device/bluetooth/dbus/bluez_dbus_manager.h"
|
| #endif
|
|
|
| @@ -52,13 +52,10 @@
|
| namespace ash {
|
| namespace test {
|
|
|
| -AshTestHelper::AshTestHelper(base::MessageLoopForUI* message_loop)
|
| - : message_loop_(message_loop),
|
| +AshTestHelper::AshTestHelper(AshTestEnvironment* ash_test_environment)
|
| + : ash_test_environment_(ash_test_environment),
|
| test_shell_delegate_(nullptr),
|
| - test_screenshot_delegate_(nullptr),
|
| - content_state_(nullptr),
|
| - test_shell_content_state_(nullptr) {
|
| - CHECK(message_loop_);
|
| + test_screenshot_delegate_(nullptr) {
|
| #if defined(OS_CHROMEOS)
|
| dbus_thread_manager_initialized_ = false;
|
| bluez_dbus_manager_initialized_ = false;
|
| @@ -74,7 +71,7 @@ AshTestHelper::~AshTestHelper() {}
|
| void AshTestHelper::SetUp(bool start_session,
|
| MaterialDesignController::Mode material_mode) {
|
| display::ResetDisplayIdForTest();
|
| - views_delegate_.reset(new AshTestViewsDelegate);
|
| + views_delegate_ = ash_test_environment_->CreateViewsDelegate();
|
|
|
| // Disable animations during tests.
|
| zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode(
|
| @@ -112,13 +109,7 @@ void AshTestHelper::SetUp(bool start_session,
|
| // created in AshTestBase tests.
|
| chromeos::CrasAudioHandler::InitializeForTesting();
|
| #endif
|
| - ShellContentState* content_state = content_state_;
|
| - if (!content_state) {
|
| - test_shell_content_state_ = new TestShellContentState;
|
| - content_state = test_shell_content_state_;
|
| - }
|
| - ShellContentState::SetInstance(content_state);
|
| -
|
| + ash_test_environment_->SetUp();
|
| // Reset the global state for the cursor manager. This includes the
|
| // last cursor visibility state, etc.
|
| ::wm::CursorManager::ResetCursorVisibilityStateForTest();
|
| @@ -136,7 +127,7 @@ void AshTestHelper::SetUp(bool start_session,
|
| ShellInitParams init_params;
|
| init_params.delegate = test_shell_delegate_;
|
| init_params.context_factory = context_factory;
|
| - init_params.blocking_pool = content::BrowserThread::GetBlockingPool();
|
| + init_params.blocking_pool = ash_test_environment_->GetBlockingPool();
|
| Shell::CreateInstance(init_params);
|
| aura::test::EnvTestHelper(aura::Env::GetInstance())
|
| .SetInputStateLookup(std::unique_ptr<aura::InputStateLookup>());
|
| @@ -160,7 +151,7 @@ void AshTestHelper::TearDown() {
|
| Shell::DeleteInstance();
|
| material_design_state_.reset();
|
| test::MaterialDesignControllerTestAPI::Uninitialize();
|
| - ShellContentState::DestroyInstance();
|
| + ash_test_environment_->TearDown();
|
|
|
| test_screenshot_delegate_ = NULL;
|
|
|
| @@ -170,6 +161,7 @@ void AshTestHelper::TearDown() {
|
| #if defined(OS_CHROMEOS)
|
| chromeos::CrasAudioHandler::Shutdown();
|
| if (bluez_dbus_manager_initialized_) {
|
| + device::BluetoothAdapterFactory::Shutdown();
|
| bluez::BluezDBusManager::Shutdown();
|
| bluez_dbus_manager_initialized_ = false;
|
| }
|
| @@ -194,7 +186,6 @@ void AshTestHelper::TearDown() {
|
| }
|
|
|
| void AshTestHelper::RunAllPendingInMessageLoop() {
|
| - DCHECK(base::MessageLoopForUI::current() == message_loop_);
|
| base::RunLoop run_loop;
|
| run_loop.RunUntilIdle();
|
| }
|
|
|