OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/host/capturer_fake.h" | 9 #include "remoting/host/capturer_fake.h" |
9 #include "remoting/host/chromoting_host.h" | 10 #include "remoting/host/chromoting_host.h" |
10 #include "remoting/host/chromoting_host_context.h" | 11 #include "remoting/host/chromoting_host_context.h" |
11 #include "remoting/host/host_mock_objects.h" | 12 #include "remoting/host/host_mock_objects.h" |
12 #include "remoting/host/in_memory_host_config.h" | 13 #include "remoting/host/in_memory_host_config.h" |
13 #include "remoting/host/it2me_host_user_interface.h" | 14 #include "remoting/host/it2me_host_user_interface.h" |
14 #include "remoting/proto/video.pb.h" | 15 #include "remoting/proto/video.pb.h" |
15 #include "remoting/protocol/protocol_mock_objects.h" | 16 #include "remoting/protocol/protocol_mock_objects.h" |
16 #include "remoting/protocol/session_config.h" | 17 #include "remoting/protocol/session_config.h" |
17 #include "testing/gmock_mutant.h" | 18 #include "testing/gmock_mutant.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 EXPECT_CALL(context_, network_message_loop()) | 86 EXPECT_CALL(context_, network_message_loop()) |
86 .Times(AnyNumber()); | 87 .Times(AnyNumber()); |
87 EXPECT_CALL(context_, ui_message_loop()) | 88 EXPECT_CALL(context_, ui_message_loop()) |
88 .Times(AnyNumber()); | 89 .Times(AnyNumber()); |
89 | 90 |
90 Capturer* capturer = new CapturerFake(); | 91 Capturer* capturer = new CapturerFake(); |
91 event_executor_ = new MockEventExecutor(); | 92 event_executor_ = new MockEventExecutor(); |
92 desktop_environment_.reset( | 93 desktop_environment_.reset( |
93 new DesktopEnvironment(&context_, capturer, event_executor_)); | 94 new DesktopEnvironment(&context_, capturer, event_executor_)); |
94 | 95 |
95 host_ = ChromotingHost::Create( | 96 host_ = new ChromotingHost( |
96 &context_, config_,desktop_environment_.get(), false); | 97 &context_, config_, &signal_strategy_, |
| 98 desktop_environment_.get(), false); |
97 | 99 |
98 disconnect_window_ = new MockDisconnectWindow(); | 100 disconnect_window_ = new MockDisconnectWindow(); |
99 continue_window_ = new MockContinueWindow(); | 101 continue_window_ = new MockContinueWindow(); |
100 local_input_monitor_ = new MockLocalInputMonitor(); | 102 local_input_monitor_ = new MockLocalInputMonitor(); |
101 it2me_host_user_interface_.reset(new It2MeHostUserInterface(host_, | 103 it2me_host_user_interface_.reset(new It2MeHostUserInterface(host_, |
102 &context_)); | 104 &context_)); |
103 it2me_host_user_interface_->InitFrom(disconnect_window_, continue_window_, | 105 it2me_host_user_interface_->InitFrom(disconnect_window_, continue_window_, |
104 local_input_monitor_); | 106 local_input_monitor_); |
105 host_->AddStatusObserver(it2me_host_user_interface_.get()); | 107 host_->AddStatusObserver(it2me_host_user_interface_.get()); |
106 | 108 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 void ShutdownHost() { | 213 void ShutdownHost() { |
212 message_loop_.PostTask( | 214 message_loop_.PostTask( |
213 FROM_HERE, base::Bind(&ChromotingHost::Shutdown, host_, | 215 FROM_HERE, base::Bind(&ChromotingHost::Shutdown, host_, |
214 base::Bind(&PostQuitTask, &message_loop_))); | 216 base::Bind(&PostQuitTask, &message_loop_))); |
215 } | 217 } |
216 | 218 |
217 protected: | 219 protected: |
218 MessageLoop message_loop_; | 220 MessageLoop message_loop_; |
219 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 221 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
220 MockConnectionToClientEventHandler handler_; | 222 MockConnectionToClientEventHandler handler_; |
| 223 MockSignalStrategy signal_strategy_; |
221 scoped_ptr<DesktopEnvironment> desktop_environment_; | 224 scoped_ptr<DesktopEnvironment> desktop_environment_; |
222 scoped_ptr<It2MeHostUserInterface> it2me_host_user_interface_; | 225 scoped_ptr<It2MeHostUserInterface> it2me_host_user_interface_; |
223 scoped_refptr<ChromotingHost> host_; | 226 scoped_refptr<ChromotingHost> host_; |
224 scoped_refptr<InMemoryHostConfig> config_; | 227 scoped_refptr<InMemoryHostConfig> config_; |
225 MockChromotingHostContext context_; | 228 MockChromotingHostContext context_; |
226 MockConnectionToClient* connection_; | 229 MockConnectionToClient* connection_; |
227 scoped_ptr<MockConnectionToClient> owned_connection_; | 230 scoped_ptr<MockConnectionToClient> owned_connection_; |
228 ClientSession* client_; | 231 ClientSession* client_; |
229 std::string session_jid_; | 232 std::string session_jid_; |
230 MockSession* session_; // Owned by |connection_|. | 233 MockSession* session_; // Owned by |connection_|. |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 EXPECT_CALL(*connection_, Disconnect()) | 368 EXPECT_CALL(*connection_, Disconnect()) |
366 .RetiresOnSaturation(); | 369 .RetiresOnSaturation(); |
367 EXPECT_CALL(*connection2_, Disconnect()) | 370 EXPECT_CALL(*connection2_, Disconnect()) |
368 .RetiresOnSaturation(); | 371 .RetiresOnSaturation(); |
369 | 372 |
370 SimulateClientConnection(0, true); | 373 SimulateClientConnection(0, true); |
371 message_loop_.Run(); | 374 message_loop_.Run(); |
372 } | 375 } |
373 | 376 |
374 } // namespace remoting | 377 } // namespace remoting |
OLD | NEW |