| 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/jingle_glue/mock_objects.h" | 8 #include "remoting/jingle_glue/mock_objects.h" |
| 9 #include "remoting/host/capturer_fake.h" | 9 #include "remoting/host/capturer_fake.h" |
| 10 #include "remoting/host/chromoting_host.h" | 10 #include "remoting/host/chromoting_host.h" |
| 11 #include "remoting/host/chromoting_host_context.h" | 11 #include "remoting/host/chromoting_host_context.h" |
| 12 #include "remoting/host/host_mock_objects.h" | 12 #include "remoting/host/host_mock_objects.h" |
| 13 #include "remoting/host/in_memory_host_config.h" | |
| 14 #include "remoting/host/it2me_host_user_interface.h" | 13 #include "remoting/host/it2me_host_user_interface.h" |
| 15 #include "remoting/proto/video.pb.h" | 14 #include "remoting/proto/video.pb.h" |
| 16 #include "remoting/protocol/protocol_mock_objects.h" | 15 #include "remoting/protocol/protocol_mock_objects.h" |
| 17 #include "remoting/protocol/session_config.h" | 16 #include "remoting/protocol/session_config.h" |
| 18 #include "testing/gmock_mutant.h" | 17 #include "testing/gmock_mutant.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 20 |
| 22 using ::remoting::protocol::MockClientStub; | 21 using ::remoting::protocol::MockClientStub; |
| 23 using ::remoting::protocol::MockConnectionToClient; | 22 using ::remoting::protocol::MockConnectionToClient; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 62 |
| 64 } // namespace | 63 } // namespace |
| 65 | 64 |
| 66 class ChromotingHostTest : public testing::Test { | 65 class ChromotingHostTest : public testing::Test { |
| 67 public: | 66 public: |
| 68 ChromotingHostTest() { | 67 ChromotingHostTest() { |
| 69 } | 68 } |
| 70 | 69 |
| 71 virtual void SetUp() OVERRIDE { | 70 virtual void SetUp() OVERRIDE { |
| 72 message_loop_proxy_ = base::MessageLoopProxy::current(); | 71 message_loop_proxy_ = base::MessageLoopProxy::current(); |
| 73 config_ = new InMemoryHostConfig(); | |
| 74 ON_CALL(context_, main_message_loop()) | 72 ON_CALL(context_, main_message_loop()) |
| 75 .WillByDefault(Return(&message_loop_)); | 73 .WillByDefault(Return(&message_loop_)); |
| 76 ON_CALL(context_, encode_message_loop()) | 74 ON_CALL(context_, encode_message_loop()) |
| 77 .WillByDefault(Return(&message_loop_)); | 75 .WillByDefault(Return(&message_loop_)); |
| 78 ON_CALL(context_, network_message_loop()) | 76 ON_CALL(context_, network_message_loop()) |
| 79 .WillByDefault(Return(message_loop_proxy_.get())); | 77 .WillByDefault(Return(message_loop_proxy_.get())); |
| 80 ON_CALL(context_, ui_message_loop()) | 78 ON_CALL(context_, ui_message_loop()) |
| 81 .WillByDefault(Return(message_loop_proxy_.get())); | 79 .WillByDefault(Return(message_loop_proxy_.get())); |
| 82 EXPECT_CALL(context_, main_message_loop()) | 80 EXPECT_CALL(context_, main_message_loop()) |
| 83 .Times(AnyNumber()); | 81 .Times(AnyNumber()); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } | 224 } |
| 227 | 225 |
| 228 protected: | 226 protected: |
| 229 MessageLoop message_loop_; | 227 MessageLoop message_loop_; |
| 230 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 228 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
| 231 MockConnectionToClientEventHandler handler_; | 229 MockConnectionToClientEventHandler handler_; |
| 232 MockSignalStrategy signal_strategy_; | 230 MockSignalStrategy signal_strategy_; |
| 233 scoped_ptr<DesktopEnvironment> desktop_environment_; | 231 scoped_ptr<DesktopEnvironment> desktop_environment_; |
| 234 scoped_ptr<It2MeHostUserInterface> it2me_host_user_interface_; | 232 scoped_ptr<It2MeHostUserInterface> it2me_host_user_interface_; |
| 235 scoped_refptr<ChromotingHost> host_; | 233 scoped_refptr<ChromotingHost> host_; |
| 236 scoped_refptr<InMemoryHostConfig> config_; | |
| 237 MockChromotingHostContext context_; | 234 MockChromotingHostContext context_; |
| 238 MockConnectionToClient* connection_; | 235 MockConnectionToClient* connection_; |
| 239 scoped_ptr<MockConnectionToClient> owned_connection_; | 236 scoped_ptr<MockConnectionToClient> owned_connection_; |
| 240 ClientSession* client_; | 237 ClientSession* client_; |
| 241 std::string session_jid_; | 238 std::string session_jid_; |
| 242 MockSession* session_; // Owned by |connection_|. | 239 MockSession* session_; // Owned by |connection_|. |
| 243 SessionConfig session_config_; | 240 SessionConfig session_config_; |
| 244 MockVideoStub video_stub_; | 241 MockVideoStub video_stub_; |
| 245 MockClientStub client_stub_; | 242 MockClientStub client_stub_; |
| 246 MockHostStub host_stub_; | 243 MockHostStub host_stub_; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 EXPECT_CALL(*connection_, Disconnect()) | 374 EXPECT_CALL(*connection_, Disconnect()) |
| 378 .RetiresOnSaturation(); | 375 .RetiresOnSaturation(); |
| 379 EXPECT_CALL(*connection2_, Disconnect()) | 376 EXPECT_CALL(*connection2_, Disconnect()) |
| 380 .RetiresOnSaturation(); | 377 .RetiresOnSaturation(); |
| 381 | 378 |
| 382 SimulateClientConnection(0, true); | 379 SimulateClientConnection(0, true); |
| 383 message_loop_.Run(); | 380 message_loop_.Run(); |
| 384 } | 381 } |
| 385 | 382 |
| 386 } // namespace remoting | 383 } // namespace remoting |
| OLD | NEW |