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