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 "remoting/host/desktop_process.h" | 5 #include "remoting/host/desktop_process.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 return input_injector; | 218 return input_injector; |
219 } | 219 } |
220 | 220 |
221 webrtc::DesktopCapturer* DesktopProcessTest::CreateVideoCapturer() { | 221 webrtc::DesktopCapturer* DesktopProcessTest::CreateVideoCapturer() { |
222 return new FakeDesktopCapturer(); | 222 return new FakeDesktopCapturer(); |
223 } | 223 } |
224 | 224 |
225 void DesktopProcessTest::DisconnectChannels() { | 225 void DesktopProcessTest::DisconnectChannels() { |
226 daemon_channel_.reset(); | 226 daemon_channel_.reset(); |
227 network_channel_.reset(); | 227 network_channel_.reset(); |
228 io_task_runner_ = NULL; | 228 io_task_runner_ = nullptr; |
229 } | 229 } |
230 | 230 |
231 void DesktopProcessTest::PostDisconnectChannels() { | 231 void DesktopProcessTest::PostDisconnectChannels() { |
232 message_loop_.PostTask(FROM_HERE, base::Bind( | 232 message_loop_.PostTask(FROM_HERE, base::Bind( |
233 &DesktopProcessTest::DisconnectChannels, base::Unretained(this))); | 233 &DesktopProcessTest::DisconnectChannels, base::Unretained(this))); |
234 } | 234 } |
235 | 235 |
236 void DesktopProcessTest::RunDesktopProcess() { | 236 void DesktopProcessTest::RunDesktopProcess() { |
237 base::RunLoop run_loop; | 237 base::RunLoop run_loop; |
238 base::Closure quit_ui_task_runner = base::Bind( | 238 base::Closure quit_ui_task_runner = base::Bind( |
(...skipping 18 matching lines...) Expand all Loading... |
257 .Times(AnyNumber()) | 257 .Times(AnyNumber()) |
258 .WillRepeatedly(Invoke(this, | 258 .WillRepeatedly(Invoke(this, |
259 &DesktopProcessTest::CreateDesktopEnvironment)); | 259 &DesktopProcessTest::CreateDesktopEnvironment)); |
260 EXPECT_CALL(*desktop_environment_factory, SupportsAudioCapture()) | 260 EXPECT_CALL(*desktop_environment_factory, SupportsAudioCapture()) |
261 .Times(AnyNumber()) | 261 .Times(AnyNumber()) |
262 .WillRepeatedly(Return(false)); | 262 .WillRepeatedly(Return(false)); |
263 | 263 |
264 DesktopProcess desktop_process(ui_task_runner, io_task_runner_, channel_name); | 264 DesktopProcess desktop_process(ui_task_runner, io_task_runner_, channel_name); |
265 EXPECT_TRUE(desktop_process.Start(desktop_environment_factory.Pass())); | 265 EXPECT_TRUE(desktop_process.Start(desktop_environment_factory.Pass())); |
266 | 266 |
267 ui_task_runner = NULL; | 267 ui_task_runner = nullptr; |
268 run_loop.Run(); | 268 run_loop.Run(); |
269 } | 269 } |
270 | 270 |
271 void DesktopProcessTest::RunDeathTest() { | 271 void DesktopProcessTest::RunDeathTest() { |
272 InSequence s; | 272 InSequence s; |
273 EXPECT_CALL(daemon_listener_, OnChannelConnected(_)); | 273 EXPECT_CALL(daemon_listener_, OnChannelConnected(_)); |
274 EXPECT_CALL(daemon_listener_, OnDesktopAttached(_)) | 274 EXPECT_CALL(daemon_listener_, OnDesktopAttached(_)) |
275 .WillOnce(DoAll( | 275 .WillOnce(DoAll( |
276 Invoke(this, &DesktopProcessTest::OnDesktopAttached), | 276 Invoke(this, &DesktopProcessTest::OnDesktopAttached), |
277 InvokeWithoutArgs(this, &DesktopProcessTest::SendCrashRequest))); | 277 InvokeWithoutArgs(this, &DesktopProcessTest::SendCrashRequest))); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 } | 336 } |
337 | 337 |
338 // Run the desktop process and ask it to crash. | 338 // Run the desktop process and ask it to crash. |
339 TEST_F(DesktopProcessTest, DeathTest) { | 339 TEST_F(DesktopProcessTest, DeathTest) { |
340 testing::GTEST_FLAG(death_test_style) = "threadsafe"; | 340 testing::GTEST_FLAG(death_test_style) = "threadsafe"; |
341 | 341 |
342 EXPECT_DEATH(RunDeathTest(), ""); | 342 EXPECT_DEATH(RunDeathTest(), ""); |
343 } | 343 } |
344 | 344 |
345 } // namespace remoting | 345 } // namespace remoting |
OLD | NEW |