| 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 "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
| 9 #include "remoting/base/auto_thread_task_runner.h" | 9 #include "remoting/base/auto_thread_task_runner.h" |
| 10 #include "remoting/host/audio_capturer.h" | 10 #include "remoting/host/audio_capturer.h" |
| 11 #include "remoting/host/chromoting_host.h" | 11 #include "remoting/host/chromoting_host.h" |
| 12 #include "remoting/host/chromoting_host_context.h" | 12 #include "remoting/host/chromoting_host_context.h" |
| 13 #include "remoting/host/desktop_environment.h" | 13 #include "remoting/host/desktop_environment.h" |
| 14 #include "remoting/host/extension.h" |
| 14 #include "remoting/host/host_mock_objects.h" | 15 #include "remoting/host/host_mock_objects.h" |
| 15 #include "remoting/host/screen_capturer_fake.h" | 16 #include "remoting/host/screen_capturer_fake.h" |
| 16 #include "remoting/jingle_glue/mock_objects.h" | 17 #include "remoting/jingle_glue/mock_objects.h" |
| 17 #include "remoting/proto/video.pb.h" | 18 #include "remoting/proto/video.pb.h" |
| 18 #include "remoting/protocol/errors.h" | 19 #include "remoting/protocol/errors.h" |
| 19 #include "remoting/protocol/protocol_mock_objects.h" | 20 #include "remoting/protocol/protocol_mock_objects.h" |
| 20 #include "remoting/protocol/session_config.h" | 21 #include "remoting/protocol/session_config.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
| 22 #include "testing/gmock_mutant.h" | 23 #include "testing/gmock_mutant.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 host_.get(), | 189 host_.get(), |
| 189 task_runner_, // Audio | 190 task_runner_, // Audio |
| 190 task_runner_, // Input | 191 task_runner_, // Input |
| 191 task_runner_, // Video capture | 192 task_runner_, // Video capture |
| 192 task_runner_, // Video encode | 193 task_runner_, // Video encode |
| 193 task_runner_, // Network | 194 task_runner_, // Network |
| 194 task_runner_, // UI | 195 task_runner_, // UI |
| 195 connection.Pass(), | 196 connection.Pass(), |
| 196 desktop_environment_factory_.get(), | 197 desktop_environment_factory_.get(), |
| 197 base::TimeDelta(), | 198 base::TimeDelta(), |
| 198 NULL)); | 199 NULL, |
| 200 &extensions_)); |
| 199 | 201 |
| 200 connection_ptr->set_host_stub(client.get()); | 202 connection_ptr->set_host_stub(client.get()); |
| 201 | 203 |
| 202 if (authenticate) { | 204 if (authenticate) { |
| 203 task_runner_->PostTask( | 205 task_runner_->PostTask( |
| 204 FROM_HERE, | 206 FROM_HERE, |
| 205 base::Bind(&ClientSession::OnConnectionAuthenticated, | 207 base::Bind(&ClientSession::OnConnectionAuthenticated, |
| 206 base::Unretained(client.get()), connection_ptr)); | 208 base::Unretained(client.get()), connection_ptr)); |
| 207 if (!reject) { | 209 if (!reject) { |
| 208 task_runner_->PostTask( | 210 task_runner_->PostTask( |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 scoped_ptr<MockSession> session_unowned1_; // Not owned by a connection. | 428 scoped_ptr<MockSession> session_unowned1_; // Not owned by a connection. |
| 427 SessionConfig session_unowned_config1_; | 429 SessionConfig session_unowned_config1_; |
| 428 std::string session_unowned_jid1_; | 430 std::string session_unowned_jid1_; |
| 429 scoped_ptr<MockSession> session_unowned2_; // Not owned by a connection. | 431 scoped_ptr<MockSession> session_unowned2_; // Not owned by a connection. |
| 430 SessionConfig session_unowned_config2_; | 432 SessionConfig session_unowned_config2_; |
| 431 std::string session_unowned_jid2_; | 433 std::string session_unowned_jid2_; |
| 432 protocol::Session::EventHandler* session_unowned1_event_handler_; | 434 protocol::Session::EventHandler* session_unowned1_event_handler_; |
| 433 protocol::Session::EventHandler* session_unowned2_event_handler_; | 435 protocol::Session::EventHandler* session_unowned2_event_handler_; |
| 434 scoped_ptr<protocol::CandidateSessionConfig> empty_candidate_config_; | 436 scoped_ptr<protocol::CandidateSessionConfig> empty_candidate_config_; |
| 435 scoped_ptr<protocol::CandidateSessionConfig> default_candidate_config_; | 437 scoped_ptr<protocol::CandidateSessionConfig> default_candidate_config_; |
| 438 ExtensionList extensions_; |
| 436 | 439 |
| 437 MockConnectionToClient*& get_connection(int connection_index) { | 440 MockConnectionToClient*& get_connection(int connection_index) { |
| 438 return (connection_index == 0) ? connection1_ : connection2_; | 441 return (connection_index == 0) ? connection1_ : connection2_; |
| 439 } | 442 } |
| 440 | 443 |
| 441 // Returns the cached client pointers client1_ or client2_. | 444 // Returns the cached client pointers client1_ or client2_. |
| 442 ClientSession*& get_client(int connection_index) { | 445 ClientSession*& get_client(int connection_index) { |
| 443 return (connection_index == 0) ? client1_ : client2_; | 446 return (connection_index == 0) ? client1_ : client2_; |
| 444 } | 447 } |
| 445 | 448 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 ExpectClientDisconnected(0, true, video_packet_sent, | 703 ExpectClientDisconnected(0, true, video_packet_sent, |
| 701 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); | 704 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); |
| 702 EXPECT_CALL(host_status_observer_, OnShutdown()); | 705 EXPECT_CALL(host_status_observer_, OnShutdown()); |
| 703 | 706 |
| 704 host_->Start(xmpp_login_); | 707 host_->Start(xmpp_login_); |
| 705 SimulateClientConnection(0, true, false); | 708 SimulateClientConnection(0, true, false); |
| 706 message_loop_.Run(); | 709 message_loop_.Run(); |
| 707 } | 710 } |
| 708 | 711 |
| 709 } // namespace remoting | 712 } // namespace remoting |
| OLD | NEW |