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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
9 #include "remoting/base/auto_thread_task_runner.h" | 9 #include "remoting/base/auto_thread_task_runner.h" |
10 #include "remoting/host/audio_capturer.h" | 10 #include "remoting/host/audio_capturer.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 host_.get(), | 189 host_.get(), |
190 task_runner_, // Audio | 190 task_runner_, // Audio |
191 task_runner_, // Input | 191 task_runner_, // Input |
192 task_runner_, // Video capture | 192 task_runner_, // Video capture |
193 task_runner_, // Video encode | 193 task_runner_, // Video encode |
194 task_runner_, // Network | 194 task_runner_, // Network |
195 task_runner_, // UI | 195 task_runner_, // UI |
196 connection.Pass(), | 196 connection.Pass(), |
197 desktop_environment_factory_.get(), | 197 desktop_environment_factory_.get(), |
198 base::TimeDelta(), | 198 base::TimeDelta(), |
199 NULL, | 199 nullptr, |
200 std::vector<HostExtension*>())); | 200 std::vector<HostExtension*>())); |
201 | 201 |
202 connection_ptr->set_host_stub(client.get()); | 202 connection_ptr->set_host_stub(client.get()); |
203 | 203 |
204 if (authenticate) { | 204 if (authenticate) { |
205 task_runner_->PostTask( | 205 task_runner_->PostTask( |
206 FROM_HERE, | 206 FROM_HERE, |
207 base::Bind(&ClientSession::OnConnectionAuthenticated, | 207 base::Bind(&ClientSession::OnConnectionAuthenticated, |
208 base::Unretained(client.get()), connection_ptr)); | 208 base::Unretained(client.get()), connection_ptr)); |
209 if (!reject) { | 209 if (!reject) { |
(...skipping 10 matching lines...) Expand all Loading... |
220 } | 220 } |
221 | 221 |
222 get_client(connection_index) = client.get(); | 222 get_client(connection_index) = client.get(); |
223 | 223 |
224 // |host| is responsible for deleting |client| from now on. | 224 // |host| is responsible for deleting |client| from now on. |
225 host_->clients_.push_back(client.release()); | 225 host_->clients_.push_back(client.release()); |
226 } | 226 } |
227 | 227 |
228 void TearDown() override { | 228 void TearDown() override { |
229 // Make sure that the host has been properly deleted. | 229 // Make sure that the host has been properly deleted. |
230 DCHECK(host_.get() == NULL); | 230 DCHECK(host_.get() == nullptr); |
231 } | 231 } |
232 | 232 |
233 // Change the session route for |client1_|. | 233 // Change the session route for |client1_|. |
234 void ChangeSessionRoute(const std::string& channel_name, | 234 void ChangeSessionRoute(const std::string& channel_name, |
235 const protocol::TransportRoute& route) { | 235 const protocol::TransportRoute& route) { |
236 host_->OnSessionRouteChange(get_client(0), channel_name, route); | 236 host_->OnSessionRouteChange(get_client(0), channel_name, route); |
237 } | 237 } |
238 | 238 |
239 // Creates a DesktopEnvironment with a fake webrtc::DesktopCapturer, to mock | 239 // Creates a DesktopEnvironment with a fake webrtc::DesktopCapturer, to mock |
240 // DesktopEnvironmentFactory::Create(). | 240 // DesktopEnvironmentFactory::Create(). |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 315 |
316 void ShutdownHost() { | 316 void ShutdownHost() { |
317 task_runner_->PostTask( | 317 task_runner_->PostTask( |
318 FROM_HERE, | 318 FROM_HERE, |
319 base::Bind(&ChromotingHostTest::StopAndReleaseTaskRunner, | 319 base::Bind(&ChromotingHostTest::StopAndReleaseTaskRunner, |
320 base::Unretained(this))); | 320 base::Unretained(this))); |
321 } | 321 } |
322 | 322 |
323 void StopAndReleaseTaskRunner() { | 323 void StopAndReleaseTaskRunner() { |
324 host_.reset(); | 324 host_.reset(); |
325 task_runner_ = NULL; | 325 task_runner_ = nullptr; |
326 desktop_environment_factory_.reset(); | 326 desktop_environment_factory_.reset(); |
327 } | 327 } |
328 | 328 |
329 void QuitMainMessageLoop() { | 329 void QuitMainMessageLoop() { |
330 PostQuitTask(&message_loop_); | 330 PostQuitTask(&message_loop_); |
331 } | 331 } |
332 | 332 |
333 // Expect the host and session manager to start, and return the expectation | 333 // Expect the host and session manager to start, and return the expectation |
334 // that the session manager has started. | 334 // that the session manager has started. |
335 Expectation ExpectHostAndSessionManagerStart() { | 335 Expectation ExpectHostAndSessionManagerStart() { |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 ExpectClientDisconnected(0, true, video_packet_sent, | 711 ExpectClientDisconnected(0, true, video_packet_sent, |
712 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); | 712 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); |
713 EXPECT_CALL(host_status_observer_, OnShutdown()); | 713 EXPECT_CALL(host_status_observer_, OnShutdown()); |
714 | 714 |
715 host_->Start(xmpp_login_); | 715 host_->Start(xmpp_login_); |
716 SimulateClientConnection(0, true, false); | 716 SimulateClientConnection(0, true, false); |
717 message_loop_.Run(); | 717 message_loop_.Run(); |
718 } | 718 } |
719 | 719 |
720 } // namespace remoting | 720 } // namespace remoting |
OLD | NEW |