Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2763)

Unified Diff: ash/mus/window_manager_application.cc

Issue 2772513003: Makes AshTestHelper shutdown ChromeOS NetworkHandler (Closed)
Patch Set: comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/mus/window_manager_application.h ('k') | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/window_manager_application.cc
diff --git a/ash/mus/window_manager_application.cc b/ash/mus/window_manager_application.cc
index c3dbcf58f3767b43a26762b77312395bebfe22a1..4f1e76a778507ce2d6c591a72505ba9f348b9492 100644
--- a/ash/mus/window_manager_application.cc
+++ b/ash/mus/window_manager_application.cc
@@ -58,11 +58,12 @@ WindowManagerApplication::~WindowManagerApplication() {
void WindowManagerApplication::InitWindowManager(
std::unique_ptr<aura::WindowTreeClient> window_tree_client,
- const scoped_refptr<base::SequencedWorkerPool>& blocking_pool) {
+ const scoped_refptr<base::SequencedWorkerPool>& blocking_pool,
+ bool init_network_handler) {
// Tests may have already set the WindowTreeClient.
if (!aura::Env::GetInstance()->HasWindowTreeClient())
aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client.get());
- InitializeComponents();
+ InitializeComponents(init_network_handler);
// TODO(jamescook): Refactor StatisticsProvider so we can get just the data
// we need in ash. Right now StatisticsProviderImpl launches the crossystem
@@ -75,7 +76,7 @@ void WindowManagerApplication::InitWindowManager(
window_manager_->Init(std::move(window_tree_client), blocking_pool);
}
-void WindowManagerApplication::InitializeComponents() {
+void WindowManagerApplication::InitializeComponents(bool init_network_handler) {
message_center::MessageCenter::Initialize();
// Must occur after mojo::ApplicationRunner has initialized AtExitManager, but
@@ -87,7 +88,8 @@ void WindowManagerApplication::InitializeComponents() {
bluez::BluezDBusManager::Initialize(
chromeos::DBusThreadManager::Get()->GetSystemBus(),
chromeos::DBusThreadManager::Get()->IsUsingFakes());
- chromeos::NetworkHandler::Initialize();
+ if (init_network_handler)
+ chromeos::NetworkHandler::Initialize();
network_connect_delegate_.reset(new NetworkConnectDelegateMus());
chromeos::NetworkConnect::Initialize(network_connect_delegate_.get());
// TODO(jamescook): Initialize real audio handler.
@@ -99,7 +101,9 @@ void WindowManagerApplication::ShutdownComponents() {
chromeos::CrasAudioHandler::Shutdown();
chromeos::NetworkConnect::Shutdown();
network_connect_delegate_.reset();
- chromeos::NetworkHandler::Shutdown();
+ // We may not have started the NetworkHandler.
+ if (chromeos::NetworkHandler::IsInitialized())
+ chromeos::NetworkHandler::Shutdown();
device::BluetoothAdapterFactory::Shutdown();
bluez::BluezDBusManager::Shutdown();
chromeos::DBusThreadManager::Shutdown();
@@ -124,7 +128,9 @@ void WindowManagerApplication::OnStart() {
const char kThreadNamePrefix[] = "MashBlocking";
blocking_pool_ = new base::SequencedWorkerPool(
kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE);
- InitWindowManager(std::move(window_tree_client), blocking_pool_);
+ const bool init_network_handler = true;
+ InitWindowManager(std::move(window_tree_client), blocking_pool_,
+ init_network_handler);
}
bool WindowManagerApplication::OnConnect(
« no previous file with comments | « ash/mus/window_manager_application.h ('k') | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698