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/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
8 #include "remoting/base/auto_thread_task_runner.h" | 8 #include "remoting/base/auto_thread_task_runner.h" |
9 #include "remoting/jingle_glue/mock_objects.h" | 9 #include "remoting/jingle_glue/mock_objects.h" |
10 #include "remoting/host/audio_capturer.h" | 10 #include "remoting/host/audio_capturer.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 local_input_monitor_ = new MockLocalInputMonitor(); | 155 local_input_monitor_ = new MockLocalInputMonitor(); |
156 it2me_host_user_interface_.reset( | 156 it2me_host_user_interface_.reset( |
157 new MockIt2MeHostUserInterface(context_.network_task_runner(), | 157 new MockIt2MeHostUserInterface(context_.network_task_runner(), |
158 context_.ui_task_runner())); | 158 context_.ui_task_runner())); |
159 it2me_host_user_interface_->InitFrom( | 159 it2me_host_user_interface_->InitFrom( |
160 scoped_ptr<DisconnectWindow>(disconnect_window_), | 160 scoped_ptr<DisconnectWindow>(disconnect_window_), |
161 scoped_ptr<ContinueWindow>(continue_window_), | 161 scoped_ptr<ContinueWindow>(continue_window_), |
162 scoped_ptr<LocalInputMonitor>(local_input_monitor_)); | 162 scoped_ptr<LocalInputMonitor>(local_input_monitor_)); |
163 | 163 |
164 it2me_host_user_interface_->Start( | 164 it2me_host_user_interface_->Start( |
165 host_, base::Bind(&ChromotingHost::Shutdown, host_, base::Closure())); | 165 host_.get(), |
| 166 base::Bind(&ChromotingHost::Shutdown, host_, base::Closure())); |
166 | 167 |
167 xmpp_login_ = "host@domain"; | 168 xmpp_login_ = "host@domain"; |
168 session1_ = new MockSession(); | 169 session1_ = new MockSession(); |
169 session2_ = new MockSession(); | 170 session2_ = new MockSession(); |
170 session_unowned1_.reset(new MockSession()); | 171 session_unowned1_.reset(new MockSession()); |
171 session_unowned2_.reset(new MockSession()); | 172 session_unowned2_.reset(new MockSession()); |
172 session_config1_ = SessionConfig::ForTest(); | 173 session_config1_ = SessionConfig::ForTest(); |
173 session_jid1_ = "user@domain/rest-of-jid"; | 174 session_jid1_ = "user@domain/rest-of-jid"; |
174 session_config2_ = SessionConfig::ForTest(); | 175 session_config2_ = SessionConfig::ForTest(); |
175 session_jid2_ = "user2@domain/rest-of-jid"; | 176 session_jid2_ = "user2@domain/rest-of-jid"; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 PassAs<protocol::ConnectionToClient>(); | 251 PassAs<protocol::ConnectionToClient>(); |
251 protocol::ConnectionToClient* connection_ptr = connection.get(); | 252 protocol::ConnectionToClient* connection_ptr = connection.get(); |
252 scoped_refptr<ClientSession> client = new ClientSession( | 253 scoped_refptr<ClientSession> client = new ClientSession( |
253 host_.get(), | 254 host_.get(), |
254 context_.capture_task_runner(), | 255 context_.capture_task_runner(), |
255 context_.encode_task_runner(), | 256 context_.encode_task_runner(), |
256 context_.network_task_runner(), | 257 context_.network_task_runner(), |
257 connection.Pass(), | 258 connection.Pass(), |
258 desktop_environment_factory_.get(), | 259 desktop_environment_factory_.get(), |
259 base::TimeDelta()); | 260 base::TimeDelta()); |
260 connection_ptr->set_host_stub(client); | 261 connection_ptr->set_host_stub(client.get()); |
261 connection_ptr->set_input_stub( | 262 connection_ptr->set_input_stub( |
262 client->desktop_environment()->event_executor()); | 263 client->desktop_environment()->event_executor()); |
263 | 264 |
264 context_.network_task_runner()->PostTask( | 265 context_.network_task_runner()->PostTask( |
265 FROM_HERE, base::Bind(&ChromotingHostTest::AddClientToHost, | 266 FROM_HERE, base::Bind(&ChromotingHostTest::AddClientToHost, |
266 host_, client)); | 267 host_, client)); |
267 | 268 |
268 if (authenticate) { | 269 if (authenticate) { |
269 context_.network_task_runner()->PostTask( | 270 context_.network_task_runner()->PostTask( |
270 FROM_HERE, base::Bind(&ClientSession::OnConnectionAuthenticated, | 271 FROM_HERE, base::Bind(&ClientSession::OnConnectionAuthenticated, |
271 client, connection_ptr)); | 272 client, connection_ptr)); |
272 if (!reject) { | 273 if (!reject) { |
273 context_.network_task_runner()->PostTask( | 274 context_.network_task_runner()->PostTask( |
274 FROM_HERE, | 275 FROM_HERE, |
275 base::Bind(&ClientSession::OnConnectionChannelsConnected, | 276 base::Bind(&ClientSession::OnConnectionChannelsConnected, |
276 client, connection_ptr)); | 277 client, connection_ptr)); |
277 } | 278 } |
278 } else { | 279 } else { |
279 context_.network_task_runner()->PostTask( | 280 context_.network_task_runner()->PostTask( |
280 FROM_HERE, base::Bind(&ClientSession::OnConnectionClosed, | 281 FROM_HERE, base::Bind(&ClientSession::OnConnectionClosed, |
281 client, connection_ptr, | 282 client, connection_ptr, |
282 protocol::AUTHENTICATION_FAILED)); | 283 protocol::AUTHENTICATION_FAILED)); |
283 } | 284 } |
284 | 285 |
285 get_client(connection_index) = client; | 286 get_client(connection_index) = client.get(); |
286 } | 287 } |
287 | 288 |
288 virtual void TearDown() OVERRIDE { | 289 virtual void TearDown() OVERRIDE { |
289 // Make sure that the host has been properly deleted. | 290 // Make sure that the host has been properly deleted. |
290 DCHECK(host_.get() == NULL); | 291 DCHECK(host_.get() == NULL); |
291 } | 292 } |
292 | 293 |
293 // Change the session route for |client1_|. | 294 // Change the session route for |client1_|. |
294 void ChangeSessionRoute(const std::string& channel_name, | 295 void ChangeSessionRoute(const std::string& channel_name, |
295 const protocol::TransportRoute& route) { | 296 const protocol::TransportRoute& route) { |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 ExpectClientDisconnected(0, true, video_packet_sent, | 704 ExpectClientDisconnected(0, true, video_packet_sent, |
704 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); | 705 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); |
705 EXPECT_CALL(host_status_observer_, OnShutdown()); | 706 EXPECT_CALL(host_status_observer_, OnShutdown()); |
706 | 707 |
707 host_->Start(xmpp_login_); | 708 host_->Start(xmpp_login_); |
708 SimulateClientConnection(0, true, false); | 709 SimulateClientConnection(0, true, false); |
709 message_loop_.Run(); | 710 message_loop_.Run(); |
710 } | 711 } |
711 | 712 |
712 } // namespace remoting | 713 } // namespace remoting |
OLD | NEW |