| 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 "remoting/host/chromoting_host.h" | 5 #include "remoting/host/chromoting_host.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 connection2_->set_client_stub(&client_stub2_); | 120 connection2_->set_client_stub(&client_stub2_); |
| 121 } | 121 } |
| 122 | 122 |
| 123 // Helper method to pretend a client is connected to ChromotingHost. | 123 // Helper method to pretend a client is connected to ChromotingHost. |
| 124 void SimulateClientConnection(int connection_index, bool authenticate, | 124 void SimulateClientConnection(int connection_index, bool authenticate, |
| 125 bool reject) { | 125 bool reject) { |
| 126 std::unique_ptr<protocol::ConnectionToClient> connection = std::move( | 126 std::unique_ptr<protocol::ConnectionToClient> connection = std::move( |
| 127 (connection_index == 0) ? owned_connection1_ : owned_connection2_); | 127 (connection_index == 0) ? owned_connection1_ : owned_connection2_); |
| 128 protocol::ConnectionToClient* connection_ptr = connection.get(); | 128 protocol::ConnectionToClient* connection_ptr = connection.get(); |
| 129 std::unique_ptr<ClientSession> client(new ClientSession( | 129 std::unique_ptr<ClientSession> client(new ClientSession( |
| 130 host_.get(), task_runner_ /* audio_task_runner */, | 130 host_.get(), std::move(connection), desktop_environment_factory_.get(), |
| 131 std::move(connection), desktop_environment_factory_.get(), | |
| 132 base::TimeDelta(), nullptr, std::vector<HostExtension*>())); | 131 base::TimeDelta(), nullptr, std::vector<HostExtension*>())); |
| 133 ClientSession* client_ptr = client.get(); | 132 ClientSession* client_ptr = client.get(); |
| 134 | 133 |
| 135 connection_ptr->set_host_stub(client.get()); | 134 connection_ptr->set_host_stub(client.get()); |
| 136 get_client(connection_index) = client_ptr; | 135 get_client(connection_index) = client_ptr; |
| 137 | 136 |
| 138 // |host| is responsible for deleting |client| from now on. | 137 // |host| is responsible for deleting |client| from now on. |
| 139 host_->clients_.push_back(client.release()); | 138 host_->clients_.push_back(client.release()); |
| 140 | 139 |
| 141 if (authenticate) { | 140 if (authenticate) { |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 | 390 |
| 392 ExpectClientConnected(0); | 391 ExpectClientConnected(0); |
| 393 SimulateClientConnection(0, true, false); | 392 SimulateClientConnection(0, true, false); |
| 394 | 393 |
| 395 ExpectClientDisconnected(0); | 394 ExpectClientDisconnected(0); |
| 396 DisconnectAllClients(); | 395 DisconnectAllClients(); |
| 397 testing::Mock::VerifyAndClearExpectations(&host_status_observer_); | 396 testing::Mock::VerifyAndClearExpectations(&host_status_observer_); |
| 398 } | 397 } |
| 399 | 398 |
| 400 } // namespace remoting | 399 } // namespace remoting |
| OLD | NEW |