Commit 56b183a2 authored by Jonathan's avatar Jonathan Committed by Commit Bot

Don't try to init mash_service in mus_browser_tests

The mash_service is not available/used when running chrome --mus
The mus_browser_tests were still trying to launch the service, leading to spammy
logs of the failure to launch the service.

This updates MojoTestState to only launch the service in --run-in-mash mode.

TBR=sky@chromium.org
TEST=mash_browser_tests, mus_browser_tests

Bug: 740655
Change-Id: I1f7618f5db5106b6f92e34647b6b79f5395dc857
Reviewed-on: https://chromium-review.googlesource.com/565171Reviewed-by: default avatarJonathan Ross <jonross@chromium.org>
Commit-Queue: Jonathan Ross <jonross@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485400}
parent e6016d73
......@@ -47,14 +47,18 @@ class MojoTestState : public content::TestState {
MojoTestState(MojoTestConnector* connector,
base::CommandLine* command_line,
base::TestLauncher::LaunchOptions* test_launch_options,
const std::string& mus_config_switch)
MojoTestConnector::Config config)
: connector_(connector),
background_service_manager_(nullptr),
platform_channel_(base::MakeUnique<mojo::edk::PlatformChannelPair>()),
main_task_runner_(base::ThreadTaskRunnerHandle::Get()),
config_(config),
weak_factory_(this) {
command_line->AppendSwitch(MojoTestConnector::kTestSwitch);
command_line->AppendSwitchASCII(switches::kMusConfig, mus_config_switch);
command_line->AppendSwitchASCII(switches::kMusConfig,
config_ == MojoTestConnector::Config::MASH
? switches::kMash
: switches::kMus);
platform_channel_->PrepareToPassClientHandleToChildProcess(
command_line, &handle_passing_info_);
......@@ -115,9 +119,11 @@ class MojoTestState : public content::TestState {
pid_receiver_->SetPID(pid);
pid_receiver_.reset();
background_service_manager_->StartService(
service_manager::Identity(mash::session::mojom::kServiceName,
service_manager::mojom::kRootUserID));
if (config_ == MojoTestConnector::Config::MASH) {
background_service_manager_->StartService(
service_manager::Identity(mash::session::mojom::kServiceName,
service_manager::mojom::kRootUserID));
}
}
mojo::edk::OutgoingBrokerClientInvitation broker_client_invitation_;
......@@ -138,6 +144,8 @@ class MojoTestState : public content::TestState {
service_manager::mojom::PIDReceiverPtr pid_receiver_;
const scoped_refptr<base::TaskRunner> main_task_runner_;
const MojoTestConnector::Config config_;
base::WeakPtrFactory<MojoTestState> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(MojoTestState);
......@@ -260,10 +268,8 @@ MojoTestConnector::~MojoTestConnector() {}
std::unique_ptr<content::TestState> MojoTestConnector::PrepareForTest(
base::CommandLine* command_line,
base::TestLauncher::LaunchOptions* test_launch_options) {
return base::MakeUnique<MojoTestState>(
this, command_line, test_launch_options,
config_ == MojoTestConnector::Config::MASH ? switches::kMash
: switches::kMus);
return base::MakeUnique<MojoTestState>(this, command_line,
test_launch_options, config_);
}
void MojoTestConnector::StartService(const std::string& service_name) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment