Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: remoting/host/desktop_process_unittest.cc

Issue 1673723002: Use IpcVideoFrameCapturer on network thread instead of capturer thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/host/desktop_process_main.cc ('k') | remoting/host/desktop_session_agent.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "remoting/host/desktop_process.h" 5 #include "remoting/host/desktop_process.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "ipc/ipc_channel.h" 20 #include "ipc/ipc_channel.h"
21 #include "ipc/ipc_channel_proxy.h" 21 #include "ipc/ipc_channel_proxy.h"
22 #include "ipc/ipc_listener.h" 22 #include "ipc/ipc_listener.h"
23 #include "ipc/ipc_message.h" 23 #include "ipc/ipc_message.h"
24 #include "remoting/base/auto_thread.h" 24 #include "remoting/base/auto_thread.h"
25 #include "remoting/base/auto_thread_task_runner.h" 25 #include "remoting/base/auto_thread_task_runner.h"
26 #include "remoting/host/chromoting_messages.h" 26 #include "remoting/host/chromoting_messages.h"
27 #include "remoting/host/desktop_process.h" 27 #include "remoting/host/desktop_process.h"
28 #include "remoting/host/fake_mouse_cursor_monitor.h"
28 #include "remoting/host/host_exit_codes.h" 29 #include "remoting/host/host_exit_codes.h"
29 #include "remoting/host/host_mock_objects.h" 30 #include "remoting/host/host_mock_objects.h"
30 #include "remoting/host/screen_resolution.h" 31 #include "remoting/host/screen_resolution.h"
31 #include "remoting/protocol/fake_desktop_capturer.h" 32 #include "remoting/protocol/fake_desktop_capturer.h"
32 #include "remoting/protocol/protocol_mock_objects.h" 33 #include "remoting/protocol/protocol_mock_objects.h"
33 #include "testing/gmock/include/gmock/gmock.h" 34 #include "testing/gmock/include/gmock/gmock.h"
34 #include "testing/gmock_mutant.h" 35 #include "testing/gmock_mutant.h"
35 #include "testing/gtest/include/gtest/gtest.h" 36 #include "testing/gtest/include/gtest/gtest.h"
36 37
37 using testing::_; 38 using testing::_;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 DesktopEnvironment* CreateDesktopEnvironment(); 117 DesktopEnvironment* CreateDesktopEnvironment();
117 118
118 // Creates a dummy InputInjector, to mock 119 // Creates a dummy InputInjector, to mock
119 // DesktopEnvironment::CreateInputInjector(). 120 // DesktopEnvironment::CreateInputInjector().
120 InputInjector* CreateInputInjector(); 121 InputInjector* CreateInputInjector();
121 122
122 // Creates a fake webrtc::DesktopCapturer, to mock 123 // Creates a fake webrtc::DesktopCapturer, to mock
123 // DesktopEnvironment::CreateVideoCapturer(). 124 // DesktopEnvironment::CreateVideoCapturer().
124 webrtc::DesktopCapturer* CreateVideoCapturer(); 125 webrtc::DesktopCapturer* CreateVideoCapturer();
125 126
127 // Creates a fake webrtc::MouseCursorMonitor, to mock
128 // DesktopEnvironment::CreateMouseCursorMonitor().
129 webrtc::MouseCursorMonitor* CreateMouseCursorMonitor();
130
126 // Disconnects the daemon-to-desktop channel causing the desktop process to 131 // Disconnects the daemon-to-desktop channel causing the desktop process to
127 // exit. 132 // exit.
128 void DisconnectChannels(); 133 void DisconnectChannels();
129 134
130 // Posts DisconnectChannels() to |message_loop_|. 135 // Posts DisconnectChannels() to |message_loop_|.
131 void PostDisconnectChannels(); 136 void PostDisconnectChannels();
132 137
133 // Runs the desktop process code in a separate thread. 138 // Runs the desktop process code in a separate thread.
134 void RunDesktopProcess(); 139 void RunDesktopProcess();
135 140
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr()) 205 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr())
201 .Times(0); 206 .Times(0);
202 EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr()) 207 EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr())
203 .Times(AtMost(1)) 208 .Times(AtMost(1))
204 .WillOnce(Invoke(this, &DesktopProcessTest::CreateInputInjector)); 209 .WillOnce(Invoke(this, &DesktopProcessTest::CreateInputInjector));
205 EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr()) 210 EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr())
206 .Times(AtMost(1)); 211 .Times(AtMost(1));
207 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr()) 212 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr())
208 .Times(AtMost(1)) 213 .Times(AtMost(1))
209 .WillOnce(Invoke(this, &DesktopProcessTest::CreateVideoCapturer)); 214 .WillOnce(Invoke(this, &DesktopProcessTest::CreateVideoCapturer));
215 EXPECT_CALL(*desktop_environment, CreateMouseCursorMonitorPtr())
216 .Times(AtMost(1))
217 .WillOnce(Invoke(this, &DesktopProcessTest::CreateMouseCursorMonitor));
210 EXPECT_CALL(*desktop_environment, GetCapabilities()) 218 EXPECT_CALL(*desktop_environment, GetCapabilities())
211 .Times(AtMost(1)); 219 .Times(AtMost(1));
212 EXPECT_CALL(*desktop_environment, SetCapabilities(_)) 220 EXPECT_CALL(*desktop_environment, SetCapabilities(_))
213 .Times(AtMost(1)); 221 .Times(AtMost(1));
214 222
215 // Notify the test that the desktop environment has been created. 223 // Notify the test that the desktop environment has been created.
216 network_listener_.OnDesktopEnvironmentCreated(); 224 network_listener_.OnDesktopEnvironmentCreated();
217 return desktop_environment; 225 return desktop_environment;
218 } 226 }
219 227
220 InputInjector* DesktopProcessTest::CreateInputInjector() { 228 InputInjector* DesktopProcessTest::CreateInputInjector() {
221 MockInputInjector* input_injector = new MockInputInjector(); 229 MockInputInjector* input_injector = new MockInputInjector();
222 EXPECT_CALL(*input_injector, StartPtr(_)); 230 EXPECT_CALL(*input_injector, StartPtr(_));
223 return input_injector; 231 return input_injector;
224 } 232 }
225 233
226 webrtc::DesktopCapturer* DesktopProcessTest::CreateVideoCapturer() { 234 webrtc::DesktopCapturer* DesktopProcessTest::CreateVideoCapturer() {
227 return new protocol::FakeDesktopCapturer(); 235 return new protocol::FakeDesktopCapturer();
228 } 236 }
229 237
238 webrtc::MouseCursorMonitor* DesktopProcessTest::CreateMouseCursorMonitor() {
239 return new FakeMouseCursorMonitor();
240 }
241
230 void DesktopProcessTest::DisconnectChannels() { 242 void DesktopProcessTest::DisconnectChannels() {
231 daemon_channel_.reset(); 243 daemon_channel_.reset();
232 network_channel_.reset(); 244 network_channel_.reset();
233 io_task_runner_ = nullptr; 245 io_task_runner_ = nullptr;
234 } 246 }
235 247
236 void DesktopProcessTest::PostDisconnectChannels() { 248 void DesktopProcessTest::PostDisconnectChannels() {
237 message_loop_.PostTask(FROM_HERE, base::Bind( 249 message_loop_.PostTask(FROM_HERE, base::Bind(
238 &DesktopProcessTest::DisconnectChannels, base::Unretained(this))); 250 &DesktopProcessTest::DisconnectChannels, base::Unretained(this)));
239 } 251 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 352 }
341 353
342 // Run the desktop process and ask it to crash. 354 // Run the desktop process and ask it to crash.
343 TEST_F(DesktopProcessTest, DeathTest) { 355 TEST_F(DesktopProcessTest, DeathTest) {
344 testing::GTEST_FLAG(death_test_style) = "threadsafe"; 356 testing::GTEST_FLAG(death_test_style) = "threadsafe";
345 357
346 EXPECT_DEATH(RunDeathTest(), ""); 358 EXPECT_DEATH(RunDeathTest(), "");
347 } 359 }
348 360
349 } // namespace remoting 361 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/desktop_process_main.cc ('k') | remoting/host/desktop_session_agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698