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/jingle_glue/mock_objects.h" | 8 #include "remoting/jingle_glue/mock_objects.h" |
9 #include "remoting/host/audio_capturer.h" | 9 #include "remoting/host/audio_capturer.h" |
10 #include "remoting/host/chromoting_host_context.h" | 10 #include "remoting/host/chromoting_host_context.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 187 } |
188 | 188 |
189 // Helper method to pretend a client is connected to ChromotingHost. | 189 // Helper method to pretend a client is connected to ChromotingHost. |
190 void SimulateClientConnection(int connection_index, bool authenticate, | 190 void SimulateClientConnection(int connection_index, bool authenticate, |
191 bool reject) { | 191 bool reject) { |
192 scoped_ptr<protocol::ConnectionToClient> connection = | 192 scoped_ptr<protocol::ConnectionToClient> connection = |
193 ((connection_index == 0) ? owned_connection1_ : owned_connection2_). | 193 ((connection_index == 0) ? owned_connection1_ : owned_connection2_). |
194 PassAs<protocol::ConnectionToClient>(); | 194 PassAs<protocol::ConnectionToClient>(); |
195 protocol::ConnectionToClient* connection_ptr = connection.get(); | 195 protocol::ConnectionToClient* connection_ptr = connection.get(); |
196 ClientSession* client = new ClientSession( | 196 ClientSession* client = new ClientSession( |
197 host_.get(), connection.Pass(), desktop_environment_->event_executor(), | 197 host_.get(), |
198 desktop_environment_->capturer(), base::TimeDelta()); | 198 connection.Pass(), |
| 199 desktop_environment_->event_executor(), |
| 200 desktop_environment_->event_executor(), |
| 201 desktop_environment_->capturer(), |
| 202 base::TimeDelta()); |
199 connection_ptr->set_host_stub(client); | 203 connection_ptr->set_host_stub(client); |
200 | 204 |
201 context_.network_task_runner()->PostTask( | 205 context_.network_task_runner()->PostTask( |
202 FROM_HERE, base::Bind(&ChromotingHostTest::AddClientToHost, | 206 FROM_HERE, base::Bind(&ChromotingHostTest::AddClientToHost, |
203 host_, client)); | 207 host_, client)); |
204 | 208 |
205 if (authenticate) { | 209 if (authenticate) { |
206 context_.network_task_runner()->PostTask( | 210 context_.network_task_runner()->PostTask( |
207 FROM_HERE, base::Bind(&ClientSession::OnConnectionAuthenticated, | 211 FROM_HERE, base::Bind(&ClientSession::OnConnectionAuthenticated, |
208 base::Unretained(client), connection_ptr)); | 212 base::Unretained(client), connection_ptr)); |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 ExpectClientDisconnected(0, true, video_packet_sent, | 629 ExpectClientDisconnected(0, true, video_packet_sent, |
626 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); | 630 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); |
627 EXPECT_CALL(host_status_observer_, OnShutdown()); | 631 EXPECT_CALL(host_status_observer_, OnShutdown()); |
628 | 632 |
629 host_->Start(); | 633 host_->Start(); |
630 SimulateClientConnection(0, true, false); | 634 SimulateClientConnection(0, true, false); |
631 message_loop_.Run(); | 635 message_loop_.Run(); |
632 } | 636 } |
633 | 637 |
634 } // namespace remoting | 638 } // namespace remoting |
OLD | NEW |