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

Unified Diff: chrome/test/base/mojo_test_connector.cc

Issue 2420253002: Rename shell namespace to service_manager (Closed)
Patch Set: . Created 4 years, 2 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 | « chrome/test/base/mojo_test_connector.h ('k') | chrome/utility/chrome_content_utility_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e31121dba8d3b13e96cf762d77f686cc4b2f0b5e..ef490c79d4928247936c27211633eed7f989d322 100644
--- a/chrome/test/base/mojo_test_connector.cc
+++ b/chrome/test/base/mojo_test_connector.cc
@@ -29,8 +29,8 @@
#include "services/service_manager/service_manager.h"
#include "services/service_manager/switches.h"
-using shell::mojom::Service;
-using shell::mojom::ServicePtr;
+using service_manager::mojom::Service;
+using service_manager::mojom::ServicePtr;
namespace {
@@ -47,7 +47,7 @@ class BackgroundTestState {
// Prepares the command line and other setup for connecting the test to mojo.
// Must be paired with a call to ChildProcessLaunched().
void Connect(base::CommandLine* command_line,
- shell::ServiceManager* service_manager,
+ service_manager::ServiceManager* service_manager,
base::TestLauncher::LaunchOptions* test_launch_options) {
command_line->AppendSwitch(MojoTestConnector::kTestSwitch);
command_line->AppendSwitch(switches::kChildProcess);
@@ -65,18 +65,22 @@ class BackgroundTestState {
#else
#error "Unsupported"
#endif
- shell::mojom::ServicePtr service =
- shell::PassServiceRequestOnCommandLine(command_line, child_token_);
+ service_manager::mojom::ServicePtr service =
+ service_manager::PassServiceRequestOnCommandLine(command_line,
+ child_token_);
- std::unique_ptr<shell::ConnectParams> params(new shell::ConnectParams);
- params->set_source(shell::CreateServiceManagerIdentity());
+ std::unique_ptr<service_manager::ConnectParams> params(
+ new service_manager::ConnectParams);
+ params->set_source(service_manager::CreateServiceManagerIdentity());
// Use the default instance name (which should be "browser"). Otherwise a
// service (e.g. ash) that connects to the default "service:content_browser"
// will spawn a new instance.
- params->set_target(shell::Identity(kTestName, shell::mojom::kRootUserID));
+ params->set_target(service_manager::Identity(
+ kTestName, service_manager::mojom::kRootUserID));
- shell::mojom::ClientProcessConnectionPtr client_process_connection =
- shell::mojom::ClientProcessConnection::New();
+ service_manager::mojom::ClientProcessConnectionPtr
+ client_process_connection =
+ service_manager::mojom::ClientProcessConnection::New();
client_process_connection->service =
service.PassInterface().PassHandle();
client_process_connection->pid_receiver_request =
@@ -103,7 +107,7 @@ class BackgroundTestState {
mojo::edk::HandlePassingInformation handle_passing_info_;
- shell::mojom::PIDReceiverPtr pid_receiver_;
+ service_manager::mojom::PIDReceiverPtr pid_receiver_;
DISALLOW_COPY_AND_ASSIGN(BackgroundTestState);
};
@@ -111,20 +115,22 @@ class BackgroundTestState {
// Called used destroy BackgroundTestState on the background thread.
void DestroyBackgroundStateOnBackgroundThread(
std::unique_ptr<BackgroundTestState> state,
- shell::ServiceManager* service_manager) {}
+ service_manager::ServiceManager* service_manager) {}
// State created per test. Manages creation of the corresponding
// BackgroundTestState and making sure processing runs on the right threads.
class MojoTestState : public content::TestState {
public:
- explicit MojoTestState(shell::BackgroundShell* background_shell)
+ explicit MojoTestState(service_manager::BackgroundShell* background_shell)
: background_shell_(background_shell) {}
~MojoTestState() override {
DCHECK(background_state_);
// BackgroundState needs to be destroyed on the background thread. We're
- // guaranteed |background_shell_| has been created by the time we reach
- // here as Init() blocks until |background_shell_| has been created.
+ // guaranteed |background_shell_| has been created by the time we
+ // reach
+ // here as Init() blocks until |background_shell_| has been
+ // created.
background_shell_->ExecuteOnServiceManagerThread(
base::Bind(&DestroyBackgroundStateOnBackgroundThread,
base::Passed(&background_state_)));
@@ -160,7 +166,7 @@ class MojoTestState : public content::TestState {
base::ProcessHandle handle,
base::ProcessId pid,
base::WaitableEvent* signal,
- shell::ServiceManager* service_manager) {
+ service_manager::ServiceManager* service_manager) {
background_state_->ChildProcessLaunched(handle, pid);
signal->Signal();
}
@@ -169,14 +175,14 @@ class MojoTestState : public content::TestState {
base::WaitableEvent* signal,
base::CommandLine* command_line,
base::TestLauncher::LaunchOptions* test_launch_options,
- shell::ServiceManager* service_manager) {
+ service_manager::ServiceManager* service_manager) {
background_state_.reset(new BackgroundTestState);
background_state_->Connect(command_line, service_manager,
test_launch_options);
signal->Signal();
}
- shell::BackgroundShell* background_shell_;
+ service_manager::BackgroundShell* background_shell_;
std::unique_ptr<BackgroundTestState> background_state_;
DISALLOW_COPY_AND_ASSIGN(MojoTestState);
@@ -199,15 +205,15 @@ void RemoveMashFromBrowserTests(base::CommandLine* command_line) {
// NativeRunnerDelegate that makes exe:mash_browser_tests to exe:browser_tests,
// and removes '--run-in-mash'.
class MojoTestConnector::NativeRunnerDelegateImpl
- : public shell::NativeRunnerDelegate {
+ : public service_manager::NativeRunnerDelegate {
public:
NativeRunnerDelegateImpl() {}
~NativeRunnerDelegateImpl() override {}
private:
- // shell::NativeRunnerDelegate:
+ // service_manager::NativeRunnerDelegate:
void AdjustCommandLineArgumentsForTarget(
- const shell::Identity& target,
+ const service_manager::Identity& target,
base::CommandLine* command_line) override {
if (target.name() != kTestName) {
if (target.name() == kTestRunnerName)
@@ -234,11 +240,11 @@ const char MojoTestConnector::kMashApp[] = "mash-app";
MojoTestConnector::MojoTestConnector() {}
-shell::mojom::ServiceRequest MojoTestConnector::Init() {
+service_manager::mojom::ServiceRequest MojoTestConnector::Init() {
native_runner_delegate_ = base::MakeUnique<NativeRunnerDelegateImpl>();
- std::unique_ptr<shell::BackgroundShell::InitParams> init_params(
- new shell::BackgroundShell::InitParams);
+ std::unique_ptr<service_manager::BackgroundShell::InitParams> init_params(
+ new service_manager::BackgroundShell::InitParams);
// When running in single_process mode chrome initializes the edk.
init_params->init_edk = !base::CommandLine::ForCurrentProcess()->HasSwitch(
content::kSingleProcessTestsFlag);
« no previous file with comments | « chrome/test/base/mojo_test_connector.h ('k') | chrome/utility/chrome_content_utility_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698