| Index: ipc/ipc_test_base.cc
|
| diff --git a/ipc/ipc_test_base.cc b/ipc/ipc_test_base.cc
|
| index 6abef0f1470b47b721dbf16ad7de8a188e9d2204..9c59b787828dba3194c24ed81fb238c9787d211f 100644
|
| --- a/ipc/ipc_test_base.cc
|
| +++ b/ipc/ipc_test_base.cc
|
| @@ -52,8 +52,7 @@ void IPCTestBase::InitWithCustomMessageLoop(
|
| }
|
|
|
| void IPCTestBase::CreateChannel(IPC::Listener* listener) {
|
| - CreateChannelFromChannelHandle(
|
| - GetChannelName(test_client_name_), listener);
|
| + CreateChannelFromChannelHandle(GetTestChannelHandle(), listener);
|
| }
|
|
|
| bool IPCTestBase::ConnectChannel() {
|
| @@ -90,8 +89,7 @@ void IPCTestBase::CreateChannelProxy(
|
| CHECK(!channel_.get());
|
| CHECK(!channel_proxy_.get());
|
| channel_proxy_ = IPC::ChannelProxy::Create(
|
| - CreateChannelFactory(GetChannelName(test_client_name_),
|
| - ipc_task_runner.get()),
|
| + CreateChannelFactory(GetTestChannelHandle(), ipc_task_runner.get()),
|
| listener,
|
| ipc_task_runner);
|
| }
|
| @@ -102,6 +100,19 @@ void IPCTestBase::DestroyChannelProxy() {
|
| }
|
|
|
| bool IPCTestBase::StartClient() {
|
| + CHECK(channel_ || channel_proxy_);
|
| +#if defined(OS_WIN)
|
| + return StartClient(0);
|
| +#elif defined(OS_POSIX)
|
| + return StartClient(channel_ ? channel_->GetClientFileDescriptor()
|
| + : channel_proxy_->GetClientFileDescriptor());
|
| +#else
|
| + NOTREACHED();
|
| + return false;
|
| +#endif
|
| +}
|
| +
|
| +bool IPCTestBase::StartClient(int ipcfd) {
|
| DCHECK(client_process_ == base::kNullProcessHandle);
|
|
|
| std::string test_main = test_client_name_ + "TestClientMain";
|
| @@ -110,9 +121,6 @@ bool IPCTestBase::StartClient() {
|
| client_process_ = SpawnChild(test_main);
|
| #elif defined(OS_POSIX)
|
| base::FileHandleMappingVector fds_to_map;
|
| - const int ipcfd = channel_.get()
|
| - ? channel_->GetClientFileDescriptor()
|
| - : channel_proxy_->GetClientFileDescriptor();
|
| if (ipcfd > -1)
|
| fds_to_map.push_back(std::pair<int, int>(ipcfd,
|
| kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
|
| @@ -121,6 +129,11 @@ bool IPCTestBase::StartClient() {
|
| client_process_ = SpawnChildWithOptions(test_main, options);
|
| #endif
|
|
|
| + if (channel_)
|
| + channel_->OnClientLaunched(client_process_);
|
| + if (channel_proxy_)
|
| + channel_proxy_->OnClientLaunched(client_process_);
|
| +
|
| return client_process_ != base::kNullProcessHandle;
|
| }
|
|
|
| @@ -134,6 +147,10 @@ bool IPCTestBase::WaitForClientShutdown() {
|
| return rv;
|
| }
|
|
|
| +IPC::ChannelHandle IPCTestBase::GetTestChannelHandle() {
|
| + return GetChannelName(test_client_name_);
|
| +}
|
| +
|
| scoped_refptr<base::TaskRunner> IPCTestBase::task_runner() {
|
| return message_loop_->message_loop_proxy();
|
| }
|
|
|