OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ipc/ipc_test_base.h" | 5 #include "ipc/ipc_test_base.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 client_process_ = SpawnChild(GetTestMainName()); | 137 client_process_ = SpawnChild(GetTestMainName()); |
138 return DidStartClient(); | 138 return DidStartClient(); |
139 } | 139 } |
140 | 140 |
141 #endif | 141 #endif |
142 | 142 |
143 bool IPCTestBase::WaitForClientShutdown() { | 143 bool IPCTestBase::WaitForClientShutdown() { |
144 DCHECK(client_process_.IsValid()); | 144 DCHECK(client_process_.IsValid()); |
145 | 145 |
146 int exit_code; | 146 int exit_code; |
147 #if defined(OS_ANDROID) | |
148 bool rv = AndroidWaitForChildExitWithTimeout( | |
149 client_process_, base::TimeDelta::FromSeconds(5), &exit_code); | |
150 #else | |
151 bool rv = client_process_.WaitForExitWithTimeout( | 147 bool rv = client_process_.WaitForExitWithTimeout( |
152 base::TimeDelta::FromSeconds(5), &exit_code); | 148 base::TimeDelta::FromSeconds(5), &exit_code); |
153 #endif // defined(OS_ANDROID) | |
154 client_process_.Close(); | 149 client_process_.Close(); |
155 return rv; | 150 return rv; |
156 } | 151 } |
157 | 152 |
158 IPC::ChannelHandle IPCTestBase::GetTestChannelHandle() { | 153 IPC::ChannelHandle IPCTestBase::GetTestChannelHandle() { |
159 return GetChannelName(test_client_name_); | 154 return GetChannelName(test_client_name_); |
160 } | 155 } |
161 | 156 |
162 scoped_refptr<base::SequencedTaskRunner> IPCTestBase::task_runner() { | 157 scoped_refptr<base::SequencedTaskRunner> IPCTestBase::task_runner() { |
163 return message_loop_->task_runner(); | 158 return message_loop_->task_runner(); |
164 } | 159 } |
165 | 160 |
166 std::unique_ptr<IPC::ChannelFactory> IPCTestBase::CreateChannelFactory( | 161 std::unique_ptr<IPC::ChannelFactory> IPCTestBase::CreateChannelFactory( |
167 const IPC::ChannelHandle& handle, | 162 const IPC::ChannelHandle& handle, |
168 base::SequencedTaskRunner* runner) { | 163 base::SequencedTaskRunner* runner) { |
169 return IPC::ChannelFactory::Create(handle, IPC::Channel::MODE_SERVER); | 164 return IPC::ChannelFactory::Create(handle, IPC::Channel::MODE_SERVER); |
170 } | 165 } |
OLD | NEW |