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

Side by Side Diff: chrome/test/base/mojo_test_connector.cc

Issue 2738853002: Connections now take a ConnectionParams instead of a pipe handle. (Closed)
Patch Set: Fix Win release build. Created 3 years, 9 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
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 "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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // ChildProcessLaunched may be called on an arbitrary thread, so track the 80 // ChildProcessLaunched may be called on an arbitrary thread, so track the
81 // current TaskRunner and post back to it when we want to send the PID. 81 // current TaskRunner and post back to it when we want to send the PID.
82 main_task_runner_ = base::ThreadTaskRunnerHandle::Get(); 82 main_task_runner_ = base::ThreadTaskRunnerHandle::Get();
83 } 83 }
84 84
85 private: 85 private:
86 // content::TestState: 86 // content::TestState:
87 void ChildProcessLaunched(base::ProcessHandle handle, 87 void ChildProcessLaunched(base::ProcessHandle handle,
88 base::ProcessId pid) override { 88 base::ProcessId pid) override {
89 platform_channel_->ChildProcessLaunched(); 89 platform_channel_->ChildProcessLaunched();
90 process_connection_.Connect(handle, platform_channel_->PassServerHandle()); 90 process_connection_.Connect(
91 handle,
92 mojo::edk::ConnectionParams(platform_channel_->PassServerHandle()));
91 93
92 main_task_runner_->PostTask( 94 main_task_runner_->PostTask(
93 FROM_HERE, 95 FROM_HERE,
94 base::Bind(&MojoTestState::SetPID, weak_factory_.GetWeakPtr(), pid)); 96 base::Bind(&MojoTestState::SetPID, weak_factory_.GetWeakPtr(), pid));
95 } 97 }
96 98
97 // Called on the main thread only. 99 // Called on the main thread only.
98 void SetPID(base::ProcessId pid) { 100 void SetPID(base::ProcessId pid) {
99 DCHECK(pid_receiver_.is_bound()); 101 DCHECK(pid_receiver_.is_bound());
100 pid_receiver_->SetPID(pid); 102 pid_receiver_->SetPID(pid);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 MojoTestConnector::~MojoTestConnector() {} 205 MojoTestConnector::~MojoTestConnector() {}
204 206
205 std::unique_ptr<content::TestState> MojoTestConnector::PrepareForTest( 207 std::unique_ptr<content::TestState> MojoTestConnector::PrepareForTest(
206 base::CommandLine* command_line, 208 base::CommandLine* command_line,
207 base::TestLauncher::LaunchOptions* test_launch_options) { 209 base::TestLauncher::LaunchOptions* test_launch_options) {
208 auto test_state = 210 auto test_state =
209 base::MakeUnique<MojoTestState>(&background_service_manager_); 211 base::MakeUnique<MojoTestState>(&background_service_manager_);
210 test_state->Init(command_line, test_launch_options); 212 test_state->Init(command_line, test_launch_options);
211 return test_state; 213 return test_state;
212 } 214 }
OLDNEW
« no previous file with comments | « chrome/service/service_utility_process_host.cc ('k') | chrome/utility/importer/firefox_importer_unittest_utils_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698