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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "ipc/ipc_test_base.h" | 7 #include "ipc/ipc_test_base.h" |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/process/kill.h" | 10 #include "base/process/kill.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 void IPCTestBase::CreateChannel(IPC::Listener* listener) { | 52 void IPCTestBase::CreateChannel(IPC::Listener* listener) { |
53 return CreateChannelFromChannelHandle(GetChannelName(test_client_name_), | 53 return CreateChannelFromChannelHandle(GetChannelName(test_client_name_), |
54 listener); | 54 listener); |
55 } | 55 } |
56 | 56 |
57 bool IPCTestBase::ConnectChannel() { | 57 bool IPCTestBase::ConnectChannel() { |
58 CHECK(channel_.get()); | 58 CHECK(channel_.get()); |
59 return channel_->Connect(); | 59 return channel_->Connect(); |
60 } | 60 } |
61 | 61 |
| 62 scoped_ptr<IPC::Channel> IPCTestBase::ReleaseChannel() { |
| 63 return channel_.Pass(); |
| 64 } |
| 65 |
| 66 void IPCTestBase::SetChannel(scoped_ptr<IPC::Channel> channel) { |
| 67 channel_ = channel.Pass(); |
| 68 } |
| 69 |
| 70 |
62 void IPCTestBase::DestroyChannel() { | 71 void IPCTestBase::DestroyChannel() { |
63 DCHECK(channel_.get()); | 72 DCHECK(channel_.get()); |
64 channel_.reset(); | 73 channel_.reset(); |
65 } | 74 } |
66 | 75 |
67 void IPCTestBase::CreateChannelFromChannelHandle( | 76 void IPCTestBase::CreateChannelFromChannelHandle( |
68 const IPC::ChannelHandle& channel_handle, | 77 const IPC::ChannelHandle& channel_handle, |
69 IPC::Listener* listener) { | 78 IPC::Listener* listener) { |
70 CHECK(!channel_.get()); | 79 CHECK(!channel_.get()); |
71 CHECK(!channel_proxy_.get()); | 80 CHECK(!channel_proxy_.get()); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 122 |
114 bool IPCTestBase::WaitForClientShutdown() { | 123 bool IPCTestBase::WaitForClientShutdown() { |
115 DCHECK(client_process_ != base::kNullProcessHandle); | 124 DCHECK(client_process_ != base::kNullProcessHandle); |
116 | 125 |
117 bool rv = base::WaitForSingleProcess(client_process_, | 126 bool rv = base::WaitForSingleProcess(client_process_, |
118 base::TimeDelta::FromSeconds(5)); | 127 base::TimeDelta::FromSeconds(5)); |
119 base::CloseProcessHandle(client_process_); | 128 base::CloseProcessHandle(client_process_); |
120 client_process_ = base::kNullProcessHandle; | 129 client_process_ = base::kNullProcessHandle; |
121 return rv; | 130 return rv; |
122 } | 131 } |
| 132 |
| 133 scoped_refptr<base::TaskRunner> IPCTestBase::io_thread_task_runner() { |
| 134 return message_loop_->message_loop_proxy(); |
| 135 } |
OLD | NEW |