| 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/capturer_fake.h" | 9 #include "remoting/host/capturer_fake.h" |
| 10 #include "remoting/host/chromoting_host.h" | 10 #include "remoting/host/chromoting_host.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // Run message loop before destroying because protocol::Session is | 172 // Run message loop before destroying because protocol::Session is |
| 173 // destroyed asynchronously. | 173 // destroyed asynchronously. |
| 174 message_loop_.RunAllPending(); | 174 message_loop_.RunAllPending(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 // Helper method to pretend a client is connected to ChromotingHost. | 177 // Helper method to pretend a client is connected to ChromotingHost. |
| 178 void SimulateClientConnection(int connection_index, bool authenticate) { | 178 void SimulateClientConnection(int connection_index, bool authenticate) { |
| 179 protocol::ConnectionToClient* connection = (connection_index == 0) ? | 179 protocol::ConnectionToClient* connection = (connection_index == 0) ? |
| 180 owned_connection_.release() : owned_connection2_.release(); | 180 owned_connection_.release() : owned_connection2_.release(); |
| 181 ClientSession* client = new ClientSession( | 181 ClientSession* client = new ClientSession( |
| 182 host_.get(), connection, event_executor_, | 182 host_.get(), connection, event_executor_, event_executor_, |
| 183 desktop_environment_->capturer()); | 183 desktop_environment_->capturer()); |
| 184 connection->set_host_stub(client); | 184 connection->set_host_stub(client); |
| 185 | 185 |
| 186 context_.network_message_loop()->PostTask( | 186 context_.network_message_loop()->PostTask( |
| 187 FROM_HERE, base::Bind(&ChromotingHostTest::AddClientToHost, | 187 FROM_HERE, base::Bind(&ChromotingHostTest::AddClientToHost, |
| 188 host_, client)); | 188 host_, client)); |
| 189 if (authenticate) { | 189 if (authenticate) { |
| 190 context_.network_message_loop()->PostTask( | 190 context_.network_message_loop()->PostTask( |
| 191 FROM_HERE, base::Bind(&ClientSession::OnConnectionOpened, | 191 FROM_HERE, base::Bind(&ClientSession::OnConnectionOpened, |
| 192 base::Unretained(client), connection)); | 192 base::Unretained(client), connection)); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 EXPECT_CALL(*connection_, Disconnect()) | 367 EXPECT_CALL(*connection_, Disconnect()) |
| 368 .RetiresOnSaturation(); | 368 .RetiresOnSaturation(); |
| 369 EXPECT_CALL(*connection2_, Disconnect()) | 369 EXPECT_CALL(*connection2_, Disconnect()) |
| 370 .RetiresOnSaturation(); | 370 .RetiresOnSaturation(); |
| 371 | 371 |
| 372 SimulateClientConnection(0, true); | 372 SimulateClientConnection(0, true); |
| 373 message_loop_.Run(); | 373 message_loop_.Run(); |
| 374 } | 374 } |
| 375 | 375 |
| 376 } // namespace remoting | 376 } // namespace remoting |
| OLD | NEW |