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

Side by Side Diff: services/shell/tests/util.cc

Issue 2118083002: ShellClient -> Service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mus2
Patch Set: . Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « services/shell/tests/shutdown/shutdown_service_app.cc ('k') | services/tracing/tracing_app.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/shell/tests/util.h" 5 #include "services/shell/tests/util.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/base_switches.h" 8 #include "base/base_switches.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/process/process.h" 15 #include "base/process/process.h"
16 #include "base/run_loop.h" 16 #include "base/run_loop.h"
17 #include "mojo/edk/embedder/embedder.h" 17 #include "mojo/edk/embedder/embedder.h"
18 #include "mojo/edk/embedder/platform_channel_pair.h" 18 #include "mojo/edk/embedder/platform_channel_pair.h"
19 #include "mojo/edk/embedder/scoped_platform_handle.h" 19 #include "mojo/edk/embedder/scoped_platform_handle.h"
20 #include "services/shell/public/cpp/connection.h" 20 #include "services/shell/public/cpp/connection.h"
21 #include "services/shell/public/cpp/connector.h" 21 #include "services/shell/public/cpp/connector.h"
22 #include "services/shell/public/interfaces/connector.mojom.h" 22 #include "services/shell/public/interfaces/connector.mojom.h"
23 #include "services/shell/public/interfaces/shell_client_factory.mojom.h" 23 #include "services/shell/public/interfaces/service_factory.mojom.h"
24 #include "services/shell/runner/common/switches.h" 24 #include "services/shell/runner/common/switches.h"
25 25
26 namespace shell { 26 namespace shell {
27 namespace test { 27 namespace test {
28 28
29 namespace { 29 namespace {
30 30
31 void QuitLoop(base::RunLoop* loop) { 31 void QuitLoop(base::RunLoop* loop) {
32 loop->Quit(); 32 loop->Quit();
33 } 33 }
(...skipping 28 matching lines...) Expand all
62 // and pass that as well. 62 // and pass that as well.
63 std::string primordial_pipe_token = mojo::edk::GenerateRandomToken(); 63 std::string primordial_pipe_token = mojo::edk::GenerateRandomToken();
64 child_command_line.AppendSwitchASCII(switches::kPrimordialPipeToken, 64 child_command_line.AppendSwitchASCII(switches::kPrimordialPipeToken,
65 primordial_pipe_token); 65 primordial_pipe_token);
66 66
67 // Allocate the pipe locally. 67 // Allocate the pipe locally.
68 std::string child_token = mojo::edk::GenerateRandomToken(); 68 std::string child_token = mojo::edk::GenerateRandomToken();
69 mojo::ScopedMessagePipeHandle pipe = 69 mojo::ScopedMessagePipeHandle pipe =
70 mojo::edk::CreateParentMessagePipe(primordial_pipe_token, child_token); 70 mojo::edk::CreateParentMessagePipe(primordial_pipe_token, child_token);
71 71
72 shell::mojom::ShellClientPtr client; 72 shell::mojom::ServicePtr client;
73 client.Bind( 73 client.Bind(
74 mojo::InterfacePtrInfo<shell::mojom::ShellClient>(std::move(pipe), 0u)); 74 mojo::InterfacePtrInfo<shell::mojom::Service>(std::move(pipe), 0u));
75 shell::mojom::PIDReceiverPtr receiver; 75 shell::mojom::PIDReceiverPtr receiver;
76 76
77 shell::Connector::ConnectParams params(target); 77 shell::Connector::ConnectParams params(target);
78 params.set_client_process_connection(std::move(client), GetProxy(&receiver)); 78 params.set_client_process_connection(std::move(client), GetProxy(&receiver));
79 std::unique_ptr<shell::Connection> connection = connector->Connect(&params); 79 std::unique_ptr<shell::Connection> connection = connector->Connect(&params);
80 { 80 {
81 base::RunLoop loop; 81 base::RunLoop loop;
82 connection->AddConnectionCompletedClosure(base::Bind(&QuitLoop, &loop)); 82 connection->AddConnectionCompletedClosure(base::Bind(&QuitLoop, &loop));
83 base::MessageLoop::ScopedNestableTaskAllower allow( 83 base::MessageLoop::ScopedNestableTaskAllower allow(
84 base::MessageLoop::current()); 84 base::MessageLoop::current());
(...skipping 10 matching lines...) Expand all
95 DCHECK(process->IsValid()); 95 DCHECK(process->IsValid());
96 receiver->SetPID(process->Pid()); 96 receiver->SetPID(process->Pid());
97 mojo::edk::ChildProcessLaunched(process->Handle(), 97 mojo::edk::ChildProcessLaunched(process->Handle(),
98 platform_channel_pair.PassServerHandle(), 98 platform_channel_pair.PassServerHandle(),
99 child_token); 99 child_token);
100 return connection; 100 return connection;
101 } 101 }
102 102
103 } // namespace test 103 } // namespace test
104 } // namespace shell 104 } // namespace shell
OLDNEW
« no previous file with comments | « services/shell/tests/shutdown/shutdown_service_app.cc ('k') | services/tracing/tracing_app.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698