| Index: ipc/ipc_test_base.cc
|
| diff --git a/ipc/ipc_test_base.cc b/ipc/ipc_test_base.cc
|
| index 8bc6bfc7c81e8e6bd29ce6895a9d62e3009e35d6..84ccae53e12726f9b4c6169b538a54270b4163e5 100644
|
| --- a/ipc/ipc_test_base.cc
|
| +++ b/ipc/ipc_test_base.cc
|
| @@ -170,15 +170,50 @@ std::unique_ptr<IPC::ChannelFactory> IPCTestBase::CreateChannelFactory(
|
| base::SingleThreadTaskRunner* runner) {
|
| return IPC::ChannelFactory::Create(handle, IPC::Channel::MODE_SERVER, runner);
|
| }
|
| +
|
| +IPCChannelMojoTestBase::ClientHandle::ClientHandle() = default;
|
| +
|
| +IPCChannelMojoTestBase::ClientHandle::~ClientHandle() = default;
|
| +
|
| +void IPCChannelMojoTestBase::ClientHandle::Init(
|
| + const std::string& test_client_name) {
|
| + pipe_ = helper_.StartChild(test_client_name);
|
| +}
|
| +
|
| +void IPCChannelMojoTestBase::ClientHandle::CreateChannel(
|
| + IPC::Listener* listener) {
|
| + channel_ =
|
| + IPC::ChannelMojo::Create(TakeHandle(), IPC::Channel::MODE_SERVER,
|
| + listener, base::ThreadTaskRunnerHandle::Get());
|
| +}
|
| +
|
| +bool IPCChannelMojoTestBase::ClientHandle::ConnectChannel() {
|
| + return channel_->Connect();
|
| +}
|
| +
|
| +void IPCChannelMojoTestBase::ClientHandle::DestroyChannel() {
|
| + channel_.reset();
|
| +}
|
| +
|
| +bool IPCChannelMojoTestBase::ClientHandle::WaitForShutdown() {
|
| + return helper_.WaitForChildTestShutdown();
|
| +}
|
| +
|
| +mojo::ScopedMessagePipeHandle
|
| +IPCChannelMojoTestBase::ClientHandle::TakeHandle() {
|
| + return std::move(pipe_);
|
| +}
|
| +
|
| IPCChannelMojoTestBase::IPCChannelMojoTestBase() = default;
|
| +
|
| IPCChannelMojoTestBase::~IPCChannelMojoTestBase() = default;
|
|
|
| void IPCChannelMojoTestBase::Init(const std::string& test_client_name) {
|
| - handle_ = helper_.StartChild(test_client_name);
|
| + primary_client_.Init(test_client_name);
|
| }
|
|
|
| bool IPCChannelMojoTestBase::WaitForClientShutdown() {
|
| - return helper_.WaitForChildTestShutdown();
|
| + return primary_client_.WaitForShutdown();
|
| }
|
|
|
| void IPCChannelMojoTestBase::TearDown() {
|
| @@ -186,21 +221,19 @@ void IPCChannelMojoTestBase::TearDown() {
|
| }
|
|
|
| void IPCChannelMojoTestBase::CreateChannel(IPC::Listener* listener) {
|
| - channel_ =
|
| - IPC::ChannelMojo::Create(TakeHandle(), IPC::Channel::MODE_SERVER,
|
| - listener, base::ThreadTaskRunnerHandle::Get());
|
| + primary_client_.CreateChannel(listener);
|
| }
|
|
|
| bool IPCChannelMojoTestBase::ConnectChannel() {
|
| - return channel_->Connect();
|
| + return primary_client_.ConnectChannel();
|
| }
|
|
|
| void IPCChannelMojoTestBase::DestroyChannel() {
|
| - channel_.reset();
|
| + return primary_client_.DestroyChannel();
|
| }
|
|
|
| mojo::ScopedMessagePipeHandle IPCChannelMojoTestBase::TakeHandle() {
|
| - return std::move(handle_);
|
| + return primary_client_.TakeHandle();
|
| }
|
|
|
| IpcChannelMojoTestClient::IpcChannelMojoTestClient() = default;
|
|
|