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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 // Helper method to pretend a client is connected to ChromotingHost. | 125 // Helper method to pretend a client is connected to ChromotingHost. |
126 void SimulateClientConnection(int connection_index, bool authenticate, | 126 void SimulateClientConnection(int connection_index, bool authenticate, |
127 bool reject) { | 127 bool reject) { |
128 std::unique_ptr<protocol::ConnectionToClient> connection = std::move( | 128 std::unique_ptr<protocol::ConnectionToClient> connection = std::move( |
129 (connection_index == 0) ? owned_connection1_ : owned_connection2_); | 129 (connection_index == 0) ? owned_connection1_ : owned_connection2_); |
130 protocol::ConnectionToClient* connection_ptr = connection.get(); | 130 protocol::ConnectionToClient* connection_ptr = connection.get(); |
131 std::unique_ptr<ClientSession> client(new ClientSession( | 131 std::unique_ptr<ClientSession> client(new ClientSession( |
132 host_.get(), std::move(connection), desktop_environment_factory_.get(), | 132 host_.get(), std::move(connection), desktop_environment_factory_.get(), |
133 DesktopEnvironmentOptions::CreateDefault(), base::TimeDelta(), nullptr, | 133 DesktopEnvironmentOptions::CreateDefault(), base::TimeDelta(), nullptr, |
134 std::vector<HostExtension*>())); | 134 std::vector<std::unique_ptr<HostExtension>>())); |
135 ClientSession* client_ptr = client.get(); | 135 ClientSession* client_ptr = client.get(); |
136 | 136 |
137 connection_ptr->set_host_stub(client.get()); | 137 connection_ptr->set_host_stub(client.get()); |
138 get_client(connection_index) = client_ptr; | 138 get_client(connection_index) = client_ptr; |
139 | 139 |
140 // |host| is responsible for deleting |client| from now on. | 140 // |host| is responsible for deleting |client| from now on. |
141 host_->clients_.push_back(std::move(client)); | 141 host_->clients_.push_back(std::move(client)); |
142 | 142 |
143 if (authenticate) { | 143 if (authenticate) { |
144 client_ptr->OnConnectionAuthenticated(); | 144 client_ptr->OnConnectionAuthenticated(); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 SimulateClientConnection(0, true, false); | 375 SimulateClientConnection(0, true, false); |
376 | 376 |
377 std::string channel_name("ChannelName"); | 377 std::string channel_name("ChannelName"); |
378 protocol::TransportRoute route; | 378 protocol::TransportRoute route; |
379 EXPECT_CALL(host_status_observer_, | 379 EXPECT_CALL(host_status_observer_, |
380 OnClientRouteChange(session_jid1_, channel_name, _)); | 380 OnClientRouteChange(session_jid1_, channel_name, _)); |
381 host_->OnSessionRouteChange(get_client(0), channel_name, route); | 381 host_->OnSessionRouteChange(get_client(0), channel_name, route); |
382 } | 382 } |
383 | 383 |
384 } // namespace remoting | 384 } // namespace remoting |
OLD | NEW |