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/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "remoting/base/auto_thread_task_runner.h" | 6 #include "remoting/base/auto_thread_task_runner.h" |
7 #include "remoting/base/constants.h" | 7 #include "remoting/base/constants.h" |
8 #include "remoting/host/audio_capturer.h" | 8 #include "remoting/host/audio_capturer.h" |
9 #include "remoting/host/client_session.h" | 9 #include "remoting/host/client_session.h" |
10 #include "remoting/host/desktop_environment.h" | 10 #include "remoting/host/desktop_environment.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 DesktopEnvironment* CreateDesktopEnvironment(); | 74 DesktopEnvironment* CreateDesktopEnvironment(); |
75 | 75 |
76 // Returns |input_injector_| created and initialized by SetUp(), to mock | 76 // Returns |input_injector_| created and initialized by SetUp(), to mock |
77 // DesktopEnvironment::CreateInputInjector(). | 77 // DesktopEnvironment::CreateInputInjector(). |
78 InputInjector* CreateInputInjector(); | 78 InputInjector* CreateInputInjector(); |
79 | 79 |
80 // Creates a fake webrtc::ScreenCapturer, to mock | 80 // Creates a fake webrtc::ScreenCapturer, to mock |
81 // DesktopEnvironment::CreateVideoCapturer(). | 81 // DesktopEnvironment::CreateVideoCapturer(). |
82 webrtc::ScreenCapturer* CreateVideoCapturer(); | 82 webrtc::ScreenCapturer* CreateVideoCapturer(); |
83 | 83 |
| 84 // Creates a MockMouseCursorMonitor, to mock |
| 85 // DesktopEnvironment::CreateMouseCursorMonitor |
| 86 webrtc::MouseCursorMonitor* CreateMouseCursorMonitor(); |
| 87 |
84 // Notifies the client session that the client connection has been | 88 // Notifies the client session that the client connection has been |
85 // authenticated and channels have been connected. This effectively enables | 89 // authenticated and channels have been connected. This effectively enables |
86 // the input pipe line and starts video capturing. | 90 // the input pipe line and starts video capturing. |
87 void ConnectClientSession(); | 91 void ConnectClientSession(); |
88 | 92 |
89 // Invoked when the last reference to the AutoThreadTaskRunner has been | 93 // Invoked when the last reference to the AutoThreadTaskRunner has been |
90 // released and quits the message loop to finish the test. | 94 // released and quits the message loop to finish the test. |
91 void QuitMainMessageLoop(); | 95 void QuitMainMessageLoop(); |
92 | 96 |
93 // Message loop passed to |client_session_| to perform all functions on. | 97 // Message loop passed to |client_session_| to perform all functions on. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 DesktopEnvironment* ClientSessionTest::CreateDesktopEnvironment() { | 193 DesktopEnvironment* ClientSessionTest::CreateDesktopEnvironment() { |
190 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); | 194 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); |
191 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr()) | 195 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr()) |
192 .Times(0); | 196 .Times(0); |
193 EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr()) | 197 EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr()) |
194 .WillOnce(Invoke(this, &ClientSessionTest::CreateInputInjector)); | 198 .WillOnce(Invoke(this, &ClientSessionTest::CreateInputInjector)); |
195 EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr()) | 199 EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr()) |
196 .Times(AtMost(1)); | 200 .Times(AtMost(1)); |
197 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr()) | 201 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr()) |
198 .WillOnce(Invoke(this, &ClientSessionTest::CreateVideoCapturer)); | 202 .WillOnce(Invoke(this, &ClientSessionTest::CreateVideoCapturer)); |
| 203 EXPECT_CALL(*desktop_environment, CreateMouseCursorMonitorPtr()) |
| 204 .WillOnce(Invoke(this, &ClientSessionTest::CreateMouseCursorMonitor)); |
199 EXPECT_CALL(*desktop_environment, GetCapabilities()) | 205 EXPECT_CALL(*desktop_environment, GetCapabilities()) |
200 .Times(AtMost(1)); | 206 .Times(AtMost(1)); |
201 EXPECT_CALL(*desktop_environment, SetCapabilities(_)) | 207 EXPECT_CALL(*desktop_environment, SetCapabilities(_)) |
202 .Times(AtMost(1)); | 208 .Times(AtMost(1)); |
203 | 209 |
204 return desktop_environment; | 210 return desktop_environment; |
205 } | 211 } |
206 | 212 |
207 InputInjector* ClientSessionTest::CreateInputInjector() { | 213 InputInjector* ClientSessionTest::CreateInputInjector() { |
208 EXPECT_TRUE(input_injector_); | 214 EXPECT_TRUE(input_injector_); |
209 return input_injector_.release(); | 215 return input_injector_.release(); |
210 } | 216 } |
211 | 217 |
212 webrtc::ScreenCapturer* ClientSessionTest::CreateVideoCapturer() { | 218 webrtc::ScreenCapturer* ClientSessionTest::CreateVideoCapturer() { |
213 return new ScreenCapturerFake(); | 219 return new ScreenCapturerFake(); |
214 } | 220 } |
215 | 221 |
| 222 webrtc::MouseCursorMonitor* ClientSessionTest::CreateMouseCursorMonitor() { |
| 223 return new MockMouseCursorMonitor(); |
| 224 } |
| 225 |
216 void ClientSessionTest::ConnectClientSession() { | 226 void ClientSessionTest::ConnectClientSession() { |
217 client_session_->OnConnectionAuthenticated(client_session_->connection()); | 227 client_session_->OnConnectionAuthenticated(client_session_->connection()); |
218 client_session_->OnConnectionChannelsConnected(client_session_->connection()); | 228 client_session_->OnConnectionChannelsConnected(client_session_->connection()); |
219 } | 229 } |
220 | 230 |
221 void ClientSessionTest::QuitMainMessageLoop() { | 231 void ClientSessionTest::QuitMainMessageLoop() { |
222 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); | 232 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); |
223 } | 233 } |
224 | 234 |
225 MATCHER_P2(EqualsClipboardEvent, m, d, "") { | 235 MATCHER_P2(EqualsClipboardEvent, m, d, "") { |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 .After(connected) | 541 .After(connected) |
532 .WillOnce(DoAll( | 542 .WillOnce(DoAll( |
533 InvokeWithoutArgs(this, &ClientSessionTest::DisconnectClientSession), | 543 InvokeWithoutArgs(this, &ClientSessionTest::DisconnectClientSession), |
534 InvokeWithoutArgs(this, &ClientSessionTest::StopClientSession))); | 544 InvokeWithoutArgs(this, &ClientSessionTest::StopClientSession))); |
535 | 545 |
536 ConnectClientSession(); | 546 ConnectClientSession(); |
537 message_loop_.Run(); | 547 message_loop_.Run(); |
538 } | 548 } |
539 | 549 |
540 } // namespace remoting | 550 } // namespace remoting |
OLD | NEW |