OLD | NEW |
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 "chrome/test/base/mojo_test_connector.h" | 5 #include "chrome/test/base/mojo_test_connector.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // will spawn a new instance. | 74 // will spawn a new instance. |
75 params->set_target(service_manager::Identity( | 75 params->set_target(service_manager::Identity( |
76 kTestName, service_manager::mojom::kRootUserID)); | 76 kTestName, service_manager::mojom::kRootUserID)); |
77 | 77 |
78 service_manager::mojom::ClientProcessConnectionPtr | 78 service_manager::mojom::ClientProcessConnectionPtr |
79 client_process_connection = | 79 client_process_connection = |
80 service_manager::mojom::ClientProcessConnection::New(); | 80 service_manager::mojom::ClientProcessConnection::New(); |
81 client_process_connection->service = | 81 client_process_connection->service = |
82 service.PassInterface().PassHandle(); | 82 service.PassInterface().PassHandle(); |
83 client_process_connection->pid_receiver_request = | 83 client_process_connection->pid_receiver_request = |
84 mojo::GetProxy(&pid_receiver_).PassMessagePipe(); | 84 mojo::MakeRequest(&pid_receiver_).PassMessagePipe(); |
85 params->set_client_process_connection(std::move(client_process_connection)); | 85 params->set_client_process_connection(std::move(client_process_connection)); |
86 service_manager->Connect(std::move(params)); | 86 service_manager->Connect(std::move(params)); |
87 } | 87 } |
88 | 88 |
89 // Called after the test process has launched. Completes the registration done | 89 // Called after the test process has launched. Completes the registration done |
90 // in Connect(). | 90 // in Connect(). |
91 void ChildProcessLaunched(base::ProcessHandle handle, base::ProcessId pid) { | 91 void ChildProcessLaunched(base::ProcessHandle handle, base::ProcessId pid) { |
92 pid_receiver_->SetPID(pid); | 92 pid_receiver_->SetPID(pid); |
93 mojo_ipc_channel_->ChildProcessLaunched(); | 93 mojo_ipc_channel_->ChildProcessLaunched(); |
94 mojo::edk::ChildProcessLaunched( | 94 mojo::edk::ChildProcessLaunched( |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 MojoTestConnector::~MojoTestConnector() {} | 260 MojoTestConnector::~MojoTestConnector() {} |
261 | 261 |
262 std::unique_ptr<content::TestState> MojoTestConnector::PrepareForTest( | 262 std::unique_ptr<content::TestState> MojoTestConnector::PrepareForTest( |
263 base::CommandLine* command_line, | 263 base::CommandLine* command_line, |
264 base::TestLauncher::LaunchOptions* test_launch_options) { | 264 base::TestLauncher::LaunchOptions* test_launch_options) { |
265 std::unique_ptr<MojoTestState> test_state( | 265 std::unique_ptr<MojoTestState> test_state( |
266 new MojoTestState(&background_service_manager_)); | 266 new MojoTestState(&background_service_manager_)); |
267 test_state->Init(command_line, test_launch_options); | 267 test_state->Init(command_line, test_launch_options); |
268 return std::move(test_state); | 268 return std::move(test_state); |
269 } | 269 } |
OLD | NEW |