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 |
147 bool rv = client_process_.WaitForExitWithTimeout( | 151 bool rv = client_process_.WaitForExitWithTimeout( |
148 base::TimeDelta::FromSeconds(5), &exit_code); | 152 base::TimeDelta::FromSeconds(5), &exit_code); |
| 153 #endif // defined(OS_ANDROID) |
149 client_process_.Close(); | 154 client_process_.Close(); |
150 return rv; | 155 return rv; |
151 } | 156 } |
152 | 157 |
153 IPC::ChannelHandle IPCTestBase::GetTestChannelHandle() { | 158 IPC::ChannelHandle IPCTestBase::GetTestChannelHandle() { |
154 return GetChannelName(test_client_name_); | 159 return GetChannelName(test_client_name_); |
155 } | 160 } |
156 | 161 |
157 scoped_refptr<base::SequencedTaskRunner> IPCTestBase::task_runner() { | 162 scoped_refptr<base::SequencedTaskRunner> IPCTestBase::task_runner() { |
158 return message_loop_->task_runner(); | 163 return message_loop_->task_runner(); |
159 } | 164 } |
160 | 165 |
161 std::unique_ptr<IPC::ChannelFactory> IPCTestBase::CreateChannelFactory( | 166 std::unique_ptr<IPC::ChannelFactory> IPCTestBase::CreateChannelFactory( |
162 const IPC::ChannelHandle& handle, | 167 const IPC::ChannelHandle& handle, |
163 base::SequencedTaskRunner* runner) { | 168 base::SequencedTaskRunner* runner) { |
164 return IPC::ChannelFactory::Create(handle, IPC::Channel::MODE_SERVER); | 169 return IPC::ChannelFactory::Create(handle, IPC::Channel::MODE_SERVER); |
165 } | 170 } |
OLD | NEW |