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