| 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" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr()) | 238 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr()) |
| 239 .Times(0); | 239 .Times(0); |
| 240 EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr()) | 240 EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr()) |
| 241 .Times(AtMost(1)) | 241 .Times(AtMost(1)) |
| 242 .WillOnce(Invoke(this, &ChromotingHostTest::CreateInputInjector)); | 242 .WillOnce(Invoke(this, &ChromotingHostTest::CreateInputInjector)); |
| 243 EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr()) | 243 EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr()) |
| 244 .Times(AtMost(1)); | 244 .Times(AtMost(1)); |
| 245 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr()) | 245 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr()) |
| 246 .Times(AtMost(1)) | 246 .Times(AtMost(1)) |
| 247 .WillOnce(Invoke(this, &ChromotingHostTest::CreateVideoCapturer)); | 247 .WillOnce(Invoke(this, &ChromotingHostTest::CreateVideoCapturer)); |
| 248 EXPECT_CALL(*desktop_environment, CreateMouseCursorMonitorPtr()) | |
| 249 .Times(AtMost(1)) | |
| 250 .WillOnce(Invoke(this, &ChromotingHostTest::CreateMouseCursorMonitor)); | |
| 251 EXPECT_CALL(*desktop_environment, GetCapabilities()) | 248 EXPECT_CALL(*desktop_environment, GetCapabilities()) |
| 252 .Times(AtMost(1)); | 249 .Times(AtMost(1)); |
| 253 EXPECT_CALL(*desktop_environment, SetCapabilities(_)) | 250 EXPECT_CALL(*desktop_environment, SetCapabilities(_)) |
| 254 .Times(AtMost(1)); | 251 .Times(AtMost(1)); |
| 255 | 252 |
| 256 return desktop_environment; | 253 return desktop_environment; |
| 257 } | 254 } |
| 258 | 255 |
| 259 // Creates a dummy InputInjector, to mock | 256 // Creates a dummy InputInjector, to mock |
| 260 // DesktopEnvironment::CreateInputInjector(). | 257 // DesktopEnvironment::CreateInputInjector(). |
| 261 InputInjector* CreateInputInjector() { | 258 InputInjector* CreateInputInjector() { |
| 262 MockInputInjector* input_injector = new MockInputInjector(); | 259 MockInputInjector* input_injector = new MockInputInjector(); |
| 263 EXPECT_CALL(*input_injector, StartPtr(_)); | 260 EXPECT_CALL(*input_injector, StartPtr(_)); |
| 264 return input_injector; | 261 return input_injector; |
| 265 } | 262 } |
| 266 | 263 |
| 267 // Creates a fake webrtc::ScreenCapturer, to mock | 264 // Creates a fake webrtc::ScreenCapturer, to mock |
| 268 // DesktopEnvironment::CreateVideoCapturer(). | 265 // DesktopEnvironment::CreateVideoCapturer(). |
| 269 webrtc::ScreenCapturer* CreateVideoCapturer() { | 266 webrtc::ScreenCapturer* CreateVideoCapturer() { |
| 270 return new ScreenCapturerFake(); | 267 return new ScreenCapturerFake(); |
| 271 } | 268 } |
| 272 | 269 |
| 273 // Creates a MockMouseCursorMonitor, to mock | |
| 274 // DesktopEnvironment::CreateMouseCursorMonitor(). | |
| 275 webrtc::MouseCursorMonitor* CreateMouseCursorMonitor() { | |
| 276 return new MockMouseCursorMonitor(); | |
| 277 } | |
| 278 | |
| 279 void DisconnectAllClients() { | 270 void DisconnectAllClients() { |
| 280 host_->DisconnectAllClients(); | 271 host_->DisconnectAllClients(); |
| 281 } | 272 } |
| 282 | 273 |
| 283 // Helper method to disconnect client 1 from the host. | 274 // Helper method to disconnect client 1 from the host. |
| 284 void DisconnectClient1() { | 275 void DisconnectClient1() { |
| 285 NotifyClientSessionClosed(0); | 276 NotifyClientSessionClosed(0); |
| 286 } | 277 } |
| 287 | 278 |
| 288 // Notify |host_| that the authenticating client has been rejected. | 279 // Notify |host_| that the authenticating client has been rejected. |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 ExpectClientDisconnected(0, true, video_packet_sent, | 646 ExpectClientDisconnected(0, true, video_packet_sent, |
| 656 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); | 647 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); |
| 657 EXPECT_CALL(host_status_observer_, OnShutdown()); | 648 EXPECT_CALL(host_status_observer_, OnShutdown()); |
| 658 | 649 |
| 659 host_->Start(xmpp_login_); | 650 host_->Start(xmpp_login_); |
| 660 SimulateClientConnection(0, true, false); | 651 SimulateClientConnection(0, true, false); |
| 661 message_loop_.Run(); | 652 message_loop_.Run(); |
| 662 } | 653 } |
| 663 | 654 |
| 664 } // namespace remoting | 655 } // namespace remoting |
| OLD | NEW |