| Index: chrome/test/base/mojo_test_connector.cc
|
| diff --git a/chrome/test/base/mojo_test_connector.cc b/chrome/test/base/mojo_test_connector.cc
|
| index 72a35d68ec1b858c851efef58d61f970bc0eb98d..cac5b9ebe9652fe128f797d11393dc7e96b807e5 100644
|
| --- a/chrome/test/base/mojo_test_connector.cc
|
| +++ b/chrome/test/base/mojo_test_connector.cc
|
| @@ -188,8 +188,8 @@ MojoTestConnector::MojoTestConnector(
|
| std::unique_ptr<base::Value> catalog_contents)
|
| : service_process_launcher_delegate_(
|
| new ServiceProcessLauncherDelegateImpl),
|
| - background_service_manager_(service_process_launcher_delegate_.get(),
|
| - std::move(catalog_contents)) {}
|
| + background_service_manager_(nullptr),
|
| + catalog_contents_(std::move(catalog_contents)) {}
|
|
|
| service_manager::mojom::ServiceRequest MojoTestConnector::Init() {
|
| // In single-process test mode, browser code will initialize the EDK and IPC.
|
| @@ -207,7 +207,15 @@ service_manager::mojom::ServiceRequest MojoTestConnector::Init() {
|
|
|
| service_manager::mojom::ServicePtr service;
|
| service_manager::mojom::ServiceRequest request(&service);
|
| - background_service_manager_.RegisterService(
|
| +
|
| + // BackgroundServiceManager must be created after mojo::edk::Init() as it
|
| + // attempts to create mojo pipes for the provided catalog on a separate
|
| + // thread.
|
| + background_service_manager_ =
|
| + base::MakeUnique<service_manager::BackgroundServiceManager>(
|
| + service_process_launcher_delegate_.get(),
|
| + std::move(catalog_contents_));
|
| + background_service_manager_->RegisterService(
|
| service_manager::Identity(kTestRunnerName,
|
| service_manager::mojom::kRootUserID),
|
| std::move(service), nullptr);
|
| @@ -220,7 +228,7 @@ std::unique_ptr<content::TestState> MojoTestConnector::PrepareForTest(
|
| base::CommandLine* command_line,
|
| base::TestLauncher::LaunchOptions* test_launch_options) {
|
| auto test_state =
|
| - base::MakeUnique<MojoTestState>(&background_service_manager_);
|
| + base::MakeUnique<MojoTestState>(background_service_manager_.get());
|
| test_state->Init(command_line, test_launch_options);
|
| return test_state;
|
| }
|
|
|