| 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 <utility> | 7 #include <utility> | 
| 8 | 8 | 
| 9 #include "base/bind.h" | 9 #include "base/bind.h" | 
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" | 
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" | 
| 12 #include "remoting/base/auto_thread_task_runner.h" | 12 #include "remoting/base/auto_thread_task_runner.h" | 
| 13 #include "remoting/host/audio_capturer.h" | 13 #include "remoting/host/audio_capturer.h" | 
| 14 #include "remoting/host/chromoting_host_context.h" | 14 #include "remoting/host/chromoting_host_context.h" | 
| 15 #include "remoting/host/fake_desktop_environment.h" | 15 #include "remoting/host/fake_desktop_environment.h" | 
| 16 #include "remoting/host/fake_mouse_cursor_monitor.h" | 16 #include "remoting/host/fake_mouse_cursor_monitor.h" | 
| 17 #include "remoting/host/host_mock_objects.h" | 17 #include "remoting/host/host_mock_objects.h" | 
| 18 #include "remoting/proto/video.pb.h" | 18 #include "remoting/proto/video.pb.h" | 
| 19 #include "remoting/protocol/errors.h" | 19 #include "remoting/protocol/errors.h" | 
| 20 #include "remoting/protocol/fake_connection_to_client.h" | 20 #include "remoting/protocol/fake_connection_to_client.h" | 
| 21 #include "remoting/protocol/fake_desktop_capturer.h" | 21 #include "remoting/protocol/fake_desktop_capturer.h" | 
| 22 #include "remoting/protocol/protocol_mock_objects.h" | 22 #include "remoting/protocol/protocol_mock_objects.h" | 
| 23 #include "remoting/protocol/session_config.h" | 23 #include "remoting/protocol/session_config.h" | 
|  | 24 #include "remoting/protocol/transport_context.h" | 
| 24 #include "testing/gmock/include/gmock/gmock.h" | 25 #include "testing/gmock/include/gmock/gmock.h" | 
| 25 #include "testing/gmock_mutant.h" | 26 #include "testing/gmock_mutant.h" | 
| 26 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" | 
| 27 | 28 | 
| 28 using ::remoting::protocol::MockClientStub; | 29 using ::remoting::protocol::MockClientStub; | 
| 29 using ::remoting::protocol::MockConnectionToClientEventHandler; | 30 using ::remoting::protocol::MockConnectionToClientEventHandler; | 
| 30 using ::remoting::protocol::MockHostStub; | 31 using ::remoting::protocol::MockHostStub; | 
| 31 using ::remoting::protocol::MockSession; | 32 using ::remoting::protocol::MockSession; | 
| 32 using ::remoting::protocol::MockVideoStub; | 33 using ::remoting::protocol::MockVideoStub; | 
| 33 using ::remoting::protocol::Session; | 34 using ::remoting::protocol::Session; | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 46 using testing::InvokeWithoutArgs; | 47 using testing::InvokeWithoutArgs; | 
| 47 using testing::Return; | 48 using testing::Return; | 
| 48 using testing::ReturnRef; | 49 using testing::ReturnRef; | 
| 49 using testing::SaveArg; | 50 using testing::SaveArg; | 
| 50 using testing::Sequence; | 51 using testing::Sequence; | 
| 51 | 52 | 
| 52 namespace remoting { | 53 namespace remoting { | 
| 53 | 54 | 
| 54 class ChromotingHostTest : public testing::Test { | 55 class ChromotingHostTest : public testing::Test { | 
| 55  public: | 56  public: | 
| 56   ChromotingHostTest() { | 57   ChromotingHostTest() {} | 
| 57   } |  | 
| 58 | 58 | 
| 59   void SetUp() override { | 59   void SetUp() override { | 
| 60     task_runner_ = new AutoThreadTaskRunner(message_loop_.task_runner(), | 60     task_runner_ = new AutoThreadTaskRunner(message_loop_.task_runner(), | 
| 61                                             base::Bind(&base::DoNothing)); | 61                                             base::Bind(&base::DoNothing)); | 
| 62 | 62 | 
| 63     desktop_environment_factory_.reset(new FakeDesktopEnvironmentFactory()); | 63     desktop_environment_factory_.reset(new FakeDesktopEnvironmentFactory()); | 
| 64     session_manager_ = new protocol::MockSessionManager(); | 64     session_manager_ = new protocol::MockSessionManager(); | 
| 65 | 65 | 
| 66     host_.reset(new ChromotingHost(desktop_environment_factory_.get(), | 66     host_.reset(new ChromotingHost( | 
| 67                                    make_scoped_ptr(session_manager_), | 67         desktop_environment_factory_.get(), make_scoped_ptr(session_manager_), | 
| 68                                    task_runner_,    // Audio | 68         protocol::TransportContext::ForTests(protocol::TransportRole::SERVER), | 
| 69                                    task_runner_,    // Input | 69         task_runner_,    // Audio | 
| 70                                    task_runner_,    // Video capture | 70         task_runner_,    // Input | 
| 71                                    task_runner_,    // Video encode | 71         task_runner_,    // Video capture | 
| 72                                    task_runner_,    // Network | 72         task_runner_,    // Video encode | 
| 73                                    task_runner_));  // UI | 73         task_runner_,    // Network | 
|  | 74         task_runner_));  // UI | 
| 74     host_->AddStatusObserver(&host_status_observer_); | 75     host_->AddStatusObserver(&host_status_observer_); | 
| 75 | 76 | 
| 76     xmpp_login_ = "host@domain"; | 77     xmpp_login_ = "host@domain"; | 
| 77     session1_ = new MockSession(); | 78     session1_ = new MockSession(); | 
| 78     session2_ = new MockSession(); | 79     session2_ = new MockSession(); | 
| 79     session_unowned1_.reset(new MockSession()); | 80     session_unowned1_.reset(new MockSession()); | 
| 80     session_unowned2_.reset(new MockSession()); | 81     session_unowned2_.reset(new MockSession()); | 
| 81     session_config1_ = SessionConfig::ForTest(); | 82     session_config1_ = SessionConfig::ForTest(); | 
| 82     session_jid1_ = "user@domain/rest-of-jid"; | 83     session_jid1_ = "user@domain/rest-of-jid"; | 
| 83     session_config2_ = SessionConfig::ForTest(); | 84     session_config2_ = SessionConfig::ForTest(); | 
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 398 | 399 | 
| 399   ExpectClientConnected(0); | 400   ExpectClientConnected(0); | 
| 400   SimulateClientConnection(0, true, false); | 401   SimulateClientConnection(0, true, false); | 
| 401 | 402 | 
| 402   ExpectClientDisconnected(0); | 403   ExpectClientDisconnected(0); | 
| 403   DisconnectAllClients(); | 404   DisconnectAllClients(); | 
| 404   testing::Mock::VerifyAndClearExpectations(&host_status_observer_); | 405   testing::Mock::VerifyAndClearExpectations(&host_status_observer_); | 
| 405 } | 406 } | 
| 406 | 407 | 
| 407 }  // namespace remoting | 408 }  // namespace remoting | 
| OLD | NEW | 
|---|