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