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