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/fake_desktop_capturer.h" |
14 #include "remoting/host/fake_mouse_cursor_monitor.h" | 15 #include "remoting/host/fake_mouse_cursor_monitor.h" |
15 #include "remoting/host/fake_screen_capturer.h" | |
16 #include "remoting/host/host_mock_objects.h" | 16 #include "remoting/host/host_mock_objects.h" |
17 #include "remoting/proto/video.pb.h" | 17 #include "remoting/proto/video.pb.h" |
18 #include "remoting/protocol/errors.h" | 18 #include "remoting/protocol/errors.h" |
19 #include "remoting/protocol/protocol_mock_objects.h" | 19 #include "remoting/protocol/protocol_mock_objects.h" |
20 #include "remoting/protocol/session_config.h" | 20 #include "remoting/protocol/session_config.h" |
21 #include "remoting/signaling/mock_signal_strategy.h" | 21 #include "remoting/signaling/mock_signal_strategy.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "testing/gmock_mutant.h" | 23 #include "testing/gmock_mutant.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 | 25 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 // Make sure that the host has been properly deleted. | 229 // Make sure that the host has been properly deleted. |
230 DCHECK(host_.get() == NULL); | 230 DCHECK(host_.get() == NULL); |
231 } | 231 } |
232 | 232 |
233 // Change the session route for |client1_|. | 233 // Change the session route for |client1_|. |
234 void ChangeSessionRoute(const std::string& channel_name, | 234 void ChangeSessionRoute(const std::string& channel_name, |
235 const protocol::TransportRoute& route) { | 235 const protocol::TransportRoute& route) { |
236 host_->OnSessionRouteChange(get_client(0), channel_name, route); | 236 host_->OnSessionRouteChange(get_client(0), channel_name, route); |
237 } | 237 } |
238 | 238 |
239 // Creates a DesktopEnvironment with a fake webrtc::ScreenCapturer, to mock | 239 // Creates a DesktopEnvironment with a fake webrtc::DesktopCapturer, to mock |
240 // DesktopEnvironmentFactory::Create(). | 240 // DesktopEnvironmentFactory::Create(). |
241 DesktopEnvironment* CreateDesktopEnvironment() { | 241 DesktopEnvironment* CreateDesktopEnvironment() { |
242 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); | 242 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); |
243 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr()) | 243 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr()) |
244 .Times(0); | 244 .Times(0); |
245 EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr()) | 245 EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr()) |
246 .Times(AtMost(1)) | 246 .Times(AtMost(1)) |
247 .WillOnce(Invoke(this, &ChromotingHostTest::CreateInputInjector)); | 247 .WillOnce(Invoke(this, &ChromotingHostTest::CreateInputInjector)); |
248 EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr()) | 248 EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr()) |
249 .Times(AtMost(1)); | 249 .Times(AtMost(1)); |
(...skipping 12 matching lines...) Expand all Loading... |
262 } | 262 } |
263 | 263 |
264 // Creates a dummy InputInjector, to mock | 264 // Creates a dummy InputInjector, to mock |
265 // DesktopEnvironment::CreateInputInjector(). | 265 // DesktopEnvironment::CreateInputInjector(). |
266 InputInjector* CreateInputInjector() { | 266 InputInjector* CreateInputInjector() { |
267 MockInputInjector* input_injector = new MockInputInjector(); | 267 MockInputInjector* input_injector = new MockInputInjector(); |
268 EXPECT_CALL(*input_injector, StartPtr(_)); | 268 EXPECT_CALL(*input_injector, StartPtr(_)); |
269 return input_injector; | 269 return input_injector; |
270 } | 270 } |
271 | 271 |
272 // Creates a fake webrtc::ScreenCapturer, to mock | 272 // Creates a fake webrtc::DesktopCapturer, to mock |
273 // DesktopEnvironment::CreateVideoCapturer(). | 273 // DesktopEnvironment::CreateVideoCapturer(). |
274 webrtc::ScreenCapturer* CreateVideoCapturer() { | 274 webrtc::DesktopCapturer* CreateVideoCapturer() { |
275 return new FakeScreenCapturer(); | 275 return new FakeDesktopCapturer(); |
276 } | 276 } |
277 | 277 |
278 // Creates a MockMouseCursorMonitor, to mock | 278 // Creates a MockMouseCursorMonitor, to mock |
279 // DesktopEnvironment::CreateMouseCursorMonitor(). | 279 // DesktopEnvironment::CreateMouseCursorMonitor(). |
280 webrtc::MouseCursorMonitor* CreateMouseCursorMonitor() { | 280 webrtc::MouseCursorMonitor* CreateMouseCursorMonitor() { |
281 return new FakeMouseCursorMonitor(); | 281 return new FakeMouseCursorMonitor(); |
282 } | 282 } |
283 | 283 |
284 void DisconnectAllClients() { | 284 void DisconnectAllClients() { |
285 host_->DisconnectAllClients(); | 285 host_->DisconnectAllClients(); |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 ExpectClientDisconnected(0, true, video_packet_sent, | 711 ExpectClientDisconnected(0, true, video_packet_sent, |
712 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); | 712 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); |
713 EXPECT_CALL(host_status_observer_, OnShutdown()); | 713 EXPECT_CALL(host_status_observer_, OnShutdown()); |
714 | 714 |
715 host_->Start(xmpp_login_); | 715 host_->Start(xmpp_login_); |
716 SimulateClientConnection(0, true, false); | 716 SimulateClientConnection(0, true, false); |
717 message_loop_.Run(); | 717 message_loop_.Run(); |
718 } | 718 } |
719 | 719 |
720 } // namespace remoting | 720 } // namespace remoting |
OLD | NEW |