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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/win/scoped_handle.h" | 9 #include "base/win/scoped_handle.h" |
10 #include "base/win/scoped_process_information.h" | 10 #include "base/win/scoped_process_information.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 // Stops the worker. | 146 // Stops the worker. |
147 void StopWorker(); | 147 void StopWorker(); |
148 | 148 |
149 // Quits |message_loop_|. | 149 // Quits |message_loop_|. |
150 void QuitMainMessageLoop(); | 150 void QuitMainMessageLoop(); |
151 | 151 |
152 protected: | 152 protected: |
153 void DoLaunchProcess(); | 153 void DoLaunchProcess(); |
154 | 154 |
155 base::MessageLoop message_loop_; | 155 base::MessageLoopForIO message_loop_; |
156 scoped_refptr<AutoThreadTaskRunner> task_runner_; | 156 scoped_refptr<AutoThreadTaskRunner> task_runner_; |
157 | 157 |
158 // Receives messages sent to the worker process. | 158 // Receives messages sent to the worker process. |
159 MockWorkerListener client_listener_; | 159 MockWorkerListener client_listener_; |
160 | 160 |
161 // Receives messages sent from the worker process. | 161 // Receives messages sent from the worker process. |
162 MockIpcDelegate server_listener_; | 162 MockIpcDelegate server_listener_; |
163 | 163 |
164 // Implements WorkerProcessLauncher::Delegate. | 164 // Implements WorkerProcessLauncher::Delegate. |
165 scoped_ptr<MockProcessLauncherDelegate> launcher_delegate_; | 165 scoped_ptr<MockProcessLauncherDelegate> launcher_delegate_; |
166 | 166 |
167 // The name of the IPC channel. | 167 // The name of the IPC channel. |
168 std::string channel_name_; | 168 std::string channel_name_; |
169 | 169 |
170 // Client and server ends of the IPC channel. | 170 // Client and server ends of the IPC channel. |
171 scoped_ptr<IPC::ChannelProxy> channel_client_; | 171 scoped_ptr<IPC::ChannelProxy> channel_client_; |
172 scoped_ptr<IPC::ChannelProxy> channel_server_; | 172 scoped_ptr<IPC::ChannelProxy> channel_server_; |
173 | 173 |
174 WorkerProcessLauncher* event_handler_; | 174 WorkerProcessLauncher* event_handler_; |
175 | 175 |
176 // The worker process launcher. | 176 // The worker process launcher. |
177 scoped_ptr<WorkerProcessLauncher> launcher_; | 177 scoped_ptr<WorkerProcessLauncher> launcher_; |
178 | 178 |
179 // An event that is used to emulate the worker process's handle. | 179 // An event that is used to emulate the worker process's handle. |
180 ScopedHandle worker_process_; | 180 ScopedHandle worker_process_; |
181 }; | 181 }; |
182 | 182 |
183 WorkerProcessLauncherTest::WorkerProcessLauncherTest() | 183 WorkerProcessLauncherTest::WorkerProcessLauncherTest() : event_handler_(NULL) { |
184 : message_loop_(base::MessageLoop::TYPE_IO), | |
185 event_handler_(NULL) { | |
186 } | 184 } |
187 | 185 |
188 WorkerProcessLauncherTest::~WorkerProcessLauncherTest() { | 186 WorkerProcessLauncherTest::~WorkerProcessLauncherTest() { |
189 } | 187 } |
190 | 188 |
191 void WorkerProcessLauncherTest::SetUp() { | 189 void WorkerProcessLauncherTest::SetUp() { |
192 task_runner_ = new AutoThreadTaskRunner( | 190 task_runner_ = new AutoThreadTaskRunner( |
193 message_loop_.message_loop_proxy(), | 191 message_loop_.message_loop_proxy(), |
194 base::Bind(&WorkerProcessLauncherTest::QuitMainMessageLoop, | 192 base::Bind(&WorkerProcessLauncherTest::QuitMainMessageLoop, |
195 base::Unretained(this))); | 193 base::Unretained(this))); |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 EXPECT_CALL(client_listener_, OnCrash(_, _, _)) | 525 EXPECT_CALL(client_listener_, OnCrash(_, _, _)) |
528 .Times(1) | 526 .Times(1) |
529 .WillOnce(InvokeWithoutArgs( | 527 .WillOnce(InvokeWithoutArgs( |
530 this, &WorkerProcessLauncherTest::SendFakeMessageToLauncher)); | 528 this, &WorkerProcessLauncherTest::SendFakeMessageToLauncher)); |
531 | 529 |
532 StartWorker(); | 530 StartWorker(); |
533 message_loop_.Run(); | 531 message_loop_.Run(); |
534 } | 532 } |
535 | 533 |
536 } // namespace remoting | 534 } // namespace remoting |
OLD | NEW |