| 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/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "remoting/base/auto_thread_task_runner.h" | 8 #include "remoting/base/auto_thread_task_runner.h" |
| 9 #include "remoting/host/audio_capturer.h" | 9 #include "remoting/host/audio_capturer.h" |
| 10 #include "remoting/host/chromoting_host.h" | 10 #include "remoting/host/chromoting_host.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 owned_connection2_.reset( | 114 owned_connection2_.reset( |
| 115 new protocol::FakeConnectionToClient(make_scoped_ptr(session2_))); | 115 new protocol::FakeConnectionToClient(make_scoped_ptr(session2_))); |
| 116 owned_connection2_->set_host_stub(&host_stub2_); | 116 owned_connection2_->set_host_stub(&host_stub2_); |
| 117 connection2_ = owned_connection2_.get(); | 117 connection2_ = owned_connection2_.get(); |
| 118 connection2_->set_client_stub(&client_stub2_); | 118 connection2_->set_client_stub(&client_stub2_); |
| 119 } | 119 } |
| 120 | 120 |
| 121 // Helper method to pretend a client is connected to ChromotingHost. | 121 // Helper method to pretend a client is connected to ChromotingHost. |
| 122 void SimulateClientConnection(int connection_index, bool authenticate, | 122 void SimulateClientConnection(int connection_index, bool authenticate, |
| 123 bool reject) { | 123 bool reject) { |
| 124 scoped_ptr<protocol::ConnectionToClient> connection = | 124 scoped_ptr<protocol::ConnectionToClient> connection = std::move( |
| 125 ((connection_index == 0) ? owned_connection1_ : owned_connection2_) | 125 (connection_index == 0) ? owned_connection1_ : owned_connection2_); |
| 126 .Pass(); | |
| 127 protocol::ConnectionToClient* connection_ptr = connection.get(); | 126 protocol::ConnectionToClient* connection_ptr = connection.get(); |
| 128 scoped_ptr<ClientSession> client(new ClientSession( | 127 scoped_ptr<ClientSession> client(new ClientSession( |
| 129 host_.get(), | 128 host_.get(), |
| 130 task_runner_, // Audio | 129 task_runner_, // Audio |
| 131 task_runner_, // Input | 130 task_runner_, // Input |
| 132 task_runner_, // Video capture | 131 task_runner_, // Video capture |
| 133 task_runner_, // Video encode | 132 task_runner_, // Video encode |
| 134 task_runner_, // Network | 133 task_runner_, // Network |
| 135 task_runner_, // UI | 134 task_runner_, // UI |
| 136 connection.Pass(), | 135 std::move(connection), |
| 137 desktop_environment_factory_.get(), | 136 desktop_environment_factory_.get(), |
| 138 base::TimeDelta(), | 137 base::TimeDelta(), |
| 139 nullptr, | 138 nullptr, |
| 140 std::vector<HostExtension*>())); | 139 std::vector<HostExtension*>())); |
| 141 ClientSession* client_ptr = client.get(); | 140 ClientSession* client_ptr = client.get(); |
| 142 | 141 |
| 143 connection_ptr->set_host_stub(client.get()); | 142 connection_ptr->set_host_stub(client.get()); |
| 144 get_client(connection_index) = client_ptr; | 143 get_client(connection_index) = client_ptr; |
| 145 | 144 |
| 146 // |host| is responsible for deleting |client| from now on. | 145 // |host| is responsible for deleting |client| from now on. |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 | 398 |
| 400 ExpectClientConnected(0); | 399 ExpectClientConnected(0); |
| 401 SimulateClientConnection(0, true, false); | 400 SimulateClientConnection(0, true, false); |
| 402 | 401 |
| 403 ExpectClientDisconnected(0); | 402 ExpectClientDisconnected(0); |
| 404 DisconnectAllClients(); | 403 DisconnectAllClients(); |
| 405 testing::Mock::VerifyAndClearExpectations(&host_status_observer_); | 404 testing::Mock::VerifyAndClearExpectations(&host_status_observer_); |
| 406 } | 405 } |
| 407 | 406 |
| 408 } // namespace remoting | 407 } // namespace remoting |
| OLD | NEW |