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_proxy.h" | 8 #include "base/message_loop_proxy.h" |
9 #include "media/video/capture/screen/screen_capturer_fake.h" | 9 #include "media/video/capture/screen/screen_capturer_fake.h" |
10 #include "remoting/base/auto_thread_task_runner.h" | 10 #include "remoting/base/auto_thread_task_runner.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 using ::remoting::protocol::MockClientStub; | 26 using ::remoting::protocol::MockClientStub; |
27 using ::remoting::protocol::MockConnectionToClient; | 27 using ::remoting::protocol::MockConnectionToClient; |
28 using ::remoting::protocol::MockConnectionToClientEventHandler; | 28 using ::remoting::protocol::MockConnectionToClientEventHandler; |
29 using ::remoting::protocol::MockHostStub; | 29 using ::remoting::protocol::MockHostStub; |
30 using ::remoting::protocol::MockSession; | 30 using ::remoting::protocol::MockSession; |
31 using ::remoting::protocol::MockVideoStub; | 31 using ::remoting::protocol::MockVideoStub; |
32 using ::remoting::protocol::SessionConfig; | 32 using ::remoting::protocol::SessionConfig; |
33 | 33 |
34 using testing::_; | 34 using testing::_; |
35 using testing::AnyNumber; | 35 using testing::AnyNumber; |
| 36 using testing::AtMost; |
36 using testing::AtLeast; | 37 using testing::AtLeast; |
37 using testing::CreateFunctor; | 38 using testing::CreateFunctor; |
38 using testing::DeleteArg; | 39 using testing::DeleteArg; |
39 using testing::DoAll; | 40 using testing::DoAll; |
40 using testing::Expectation; | 41 using testing::Expectation; |
41 using testing::InSequence; | 42 using testing::InSequence; |
42 using testing::Invoke; | 43 using testing::Invoke; |
43 using testing::InvokeArgument; | 44 using testing::InvokeArgument; |
44 using testing::InvokeWithoutArgs; | 45 using testing::InvokeWithoutArgs; |
45 using testing::Return; | 46 using testing::Return; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 host_->OnSessionRouteChange(get_client(0), channel_name, route); | 277 host_->OnSessionRouteChange(get_client(0), channel_name, route); |
277 } | 278 } |
278 | 279 |
279 // Creates a DesktopEnvironment with a fake media::ScreenCapturer, to mock | 280 // Creates a DesktopEnvironment with a fake media::ScreenCapturer, to mock |
280 // DesktopEnvironmentFactory::Create(). | 281 // DesktopEnvironmentFactory::Create(). |
281 DesktopEnvironment* CreateDesktopEnvironment() { | 282 DesktopEnvironment* CreateDesktopEnvironment() { |
282 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); | 283 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); |
283 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr()) | 284 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr()) |
284 .Times(0); | 285 .Times(0); |
285 EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr()) | 286 EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr()) |
286 .Times(AnyNumber()) | 287 .Times(AtMost(1)) |
287 .WillRepeatedly(Invoke(this, &ChromotingHostTest::CreateInputInjector)); | 288 .WillOnce(Invoke(this, &ChromotingHostTest::CreateInputInjector)); |
288 EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr()) | 289 EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr()) |
289 .Times(AnyNumber()); | 290 .Times(AtMost(1)); |
290 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr()) | 291 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr()) |
291 .Times(AnyNumber()) | 292 .Times(AtMost(1)) |
292 .WillRepeatedly(Invoke(this, &ChromotingHostTest::CreateVideoCapturer)); | 293 .WillOnce(Invoke(this, &ChromotingHostTest::CreateVideoCapturer)); |
| 294 EXPECT_CALL(*desktop_environment, GetCapabilities()) |
| 295 .Times(AtMost(1)); |
| 296 EXPECT_CALL(*desktop_environment, SetCapabilities(_)) |
| 297 .Times(AtMost(1)); |
293 | 298 |
294 return desktop_environment; | 299 return desktop_environment; |
295 } | 300 } |
296 | 301 |
297 // Creates a dummy InputInjector, to mock | 302 // Creates a dummy InputInjector, to mock |
298 // DesktopEnvironment::CreateInputInjector(). | 303 // DesktopEnvironment::CreateInputInjector(). |
299 InputInjector* CreateInputInjector() { | 304 InputInjector* CreateInputInjector() { |
300 MockInputInjector* input_injector = new MockInputInjector(); | 305 MockInputInjector* input_injector = new MockInputInjector(); |
301 EXPECT_CALL(*input_injector, StartPtr(_)); | 306 EXPECT_CALL(*input_injector, StartPtr(_)); |
302 return input_injector; | 307 return input_injector; |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 ExpectClientDisconnected(0, true, video_packet_sent, | 711 ExpectClientDisconnected(0, true, video_packet_sent, |
707 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); | 712 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); |
708 EXPECT_CALL(host_status_observer_, OnShutdown()); | 713 EXPECT_CALL(host_status_observer_, OnShutdown()); |
709 | 714 |
710 host_->Start(xmpp_login_); | 715 host_->Start(xmpp_login_); |
711 SimulateClientConnection(0, true, false); | 716 SimulateClientConnection(0, true, false); |
712 message_loop_.Run(); | 717 message_loop_.Run(); |
713 } | 718 } |
714 | 719 |
715 } // namespace remoting | 720 } // namespace remoting |
OLD | NEW |