| 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/base/auto_thread_task_runner.h" | 8 #include "remoting/base/auto_thread_task_runner.h" |
| 9 #include "remoting/jingle_glue/mock_objects.h" | 9 #include "remoting/jingle_glue/mock_objects.h" |
| 10 #include "remoting/host/audio_capturer.h" | 10 #include "remoting/host/audio_capturer.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 .Times(AnyNumber()) | 138 .Times(AnyNumber()) |
| 139 .WillRepeatedly(Invoke(this, | 139 .WillRepeatedly(Invoke(this, |
| 140 &ChromotingHostTest::CreateDesktopEnvironment)); | 140 &ChromotingHostTest::CreateDesktopEnvironment)); |
| 141 | 141 |
| 142 session_manager_ = new protocol::MockSessionManager(); | 142 session_manager_ = new protocol::MockSessionManager(); |
| 143 | 143 |
| 144 host_ = new ChromotingHost( | 144 host_ = new ChromotingHost( |
| 145 &signal_strategy_, | 145 &signal_strategy_, |
| 146 desktop_environment_factory_.get(), | 146 desktop_environment_factory_.get(), |
| 147 scoped_ptr<protocol::SessionManager>(session_manager_), | 147 scoped_ptr<protocol::SessionManager>(session_manager_), |
| 148 context_.audio_task_runner(), |
| 148 context_.capture_task_runner(), | 149 context_.capture_task_runner(), |
| 149 context_.encode_task_runner(), | 150 context_.encode_task_runner(), |
| 150 context_.network_task_runner()); | 151 context_.network_task_runner()); |
| 151 host_->AddStatusObserver(&host_status_observer_); | 152 host_->AddStatusObserver(&host_status_observer_); |
| 152 | 153 |
| 153 disconnect_window_ = new MockDisconnectWindow(); | 154 disconnect_window_ = new MockDisconnectWindow(); |
| 154 continue_window_ = new MockContinueWindow(); | 155 continue_window_ = new MockContinueWindow(); |
| 155 local_input_monitor_ = new MockLocalInputMonitor(); | 156 local_input_monitor_ = new MockLocalInputMonitor(); |
| 156 it2me_host_user_interface_.reset( | 157 it2me_host_user_interface_.reset( |
| 157 new MockIt2MeHostUserInterface(context_.network_task_runner(), | 158 new MockIt2MeHostUserInterface(context_.network_task_runner(), |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 245 |
| 245 // Helper method to pretend a client is connected to ChromotingHost. | 246 // Helper method to pretend a client is connected to ChromotingHost. |
| 246 void SimulateClientConnection(int connection_index, bool authenticate, | 247 void SimulateClientConnection(int connection_index, bool authenticate, |
| 247 bool reject) { | 248 bool reject) { |
| 248 scoped_ptr<protocol::ConnectionToClient> connection = | 249 scoped_ptr<protocol::ConnectionToClient> connection = |
| 249 ((connection_index == 0) ? owned_connection1_ : owned_connection2_). | 250 ((connection_index == 0) ? owned_connection1_ : owned_connection2_). |
| 250 PassAs<protocol::ConnectionToClient>(); | 251 PassAs<protocol::ConnectionToClient>(); |
| 251 protocol::ConnectionToClient* connection_ptr = connection.get(); | 252 protocol::ConnectionToClient* connection_ptr = connection.get(); |
| 252 scoped_refptr<ClientSession> client = new ClientSession( | 253 scoped_refptr<ClientSession> client = new ClientSession( |
| 253 host_.get(), | 254 host_.get(), |
| 255 context_.audio_task_runner(), |
| 254 context_.capture_task_runner(), | 256 context_.capture_task_runner(), |
| 255 context_.encode_task_runner(), | 257 context_.encode_task_runner(), |
| 256 context_.network_task_runner(), | 258 context_.network_task_runner(), |
| 257 connection.Pass(), | 259 connection.Pass(), |
| 258 desktop_environment_factory_.get(), | 260 desktop_environment_factory_.get(), |
| 259 base::TimeDelta()); | 261 base::TimeDelta()); |
| 260 connection_ptr->set_host_stub(client); | 262 connection_ptr->set_host_stub(client); |
| 261 connection_ptr->set_input_stub( | 263 connection_ptr->set_input_stub( |
| 262 client->desktop_environment()->event_executor()); | 264 client->desktop_environment()->event_executor()); |
| 263 | 265 |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 ExpectClientDisconnected(0, true, video_packet_sent, | 705 ExpectClientDisconnected(0, true, video_packet_sent, |
| 704 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); | 706 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); |
| 705 EXPECT_CALL(host_status_observer_, OnShutdown()); | 707 EXPECT_CALL(host_status_observer_, OnShutdown()); |
| 706 | 708 |
| 707 host_->Start(xmpp_login_); | 709 host_->Start(xmpp_login_); |
| 708 SimulateClientConnection(0, true, false); | 710 SimulateClientConnection(0, true, false); |
| 709 message_loop_.Run(); | 711 message_loop_.Run(); |
| 710 } | 712 } |
| 711 | 713 |
| 712 } // namespace remoting | 714 } // namespace remoting |
| OLD | NEW |