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 14 matching lines...) Expand all Loading... |
25 IPCTestBase::IPCTestBase() | 25 IPCTestBase::IPCTestBase() |
26 : client_process_(base::kNullProcessHandle) { | 26 : client_process_(base::kNullProcessHandle) { |
27 } | 27 } |
28 | 28 |
29 IPCTestBase::~IPCTestBase() { | 29 IPCTestBase::~IPCTestBase() { |
30 } | 30 } |
31 | 31 |
32 void IPCTestBase::SetUp() { | 32 void IPCTestBase::SetUp() { |
33 MultiProcessTest::SetUp(); | 33 MultiProcessTest::SetUp(); |
34 | 34 |
35 // Construct a fresh IO Message loop for the duration of each test. | 35 // Construct a fresh Message loop for the duration of each test. |
36 DCHECK(!message_loop_.get()); | 36 DCHECK(!message_loop_.get()); |
37 message_loop_.reset(new base::MessageLoopForIO()); | 37 message_loop_.reset(new base::MessageLoopForIO()); |
38 } | 38 } |
39 | 39 |
40 void IPCTestBase::TearDown() { | 40 void IPCTestBase::TearDown() { |
41 DCHECK(message_loop_.get()); | 41 DCHECK(message_loop_.get()); |
42 message_loop_.reset(); | 42 message_loop_.reset(); |
43 MultiProcessTest::TearDown(); | 43 MultiProcessTest::TearDown(); |
44 } | 44 } |
45 | 45 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 bool IPCTestBase::WaitForClientShutdown() { | 123 bool IPCTestBase::WaitForClientShutdown() { |
124 DCHECK(client_process_ != base::kNullProcessHandle); | 124 DCHECK(client_process_ != base::kNullProcessHandle); |
125 | 125 |
126 bool rv = base::WaitForSingleProcess(client_process_, | 126 bool rv = base::WaitForSingleProcess(client_process_, |
127 base::TimeDelta::FromSeconds(5)); | 127 base::TimeDelta::FromSeconds(5)); |
128 base::CloseProcessHandle(client_process_); | 128 base::CloseProcessHandle(client_process_); |
129 client_process_ = base::kNullProcessHandle; | 129 client_process_ = base::kNullProcessHandle; |
130 return rv; | 130 return rv; |
131 } | 131 } |
132 | 132 |
133 scoped_refptr<base::TaskRunner> IPCTestBase::io_thread_task_runner() { | 133 scoped_refptr<base::TaskRunner> IPCTestBase::task_runner() { |
134 return message_loop_->message_loop_proxy(); | 134 return message_loop_->message_loop_proxy(); |
135 } | 135 } |
| 136 |
| 137 void IPCTestBase::set_message_loop(scoped_ptr<base::MessageLoop> loop) { |
| 138 message_loop_ = loop.Pass(); |
| 139 } |
OLD | NEW |