OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/callback.h" | 7 #include "base/callback.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 remote_input_injector_ = nullptr; | 414 remote_input_injector_ = nullptr; |
415 } | 415 } |
416 | 416 |
417 void IpcDesktopEnvironmentTest::OnDisconnectCallback() { | 417 void IpcDesktopEnvironmentTest::OnDisconnectCallback() { |
418 DeleteDesktopEnvironment(); | 418 DeleteDesktopEnvironment(); |
419 } | 419 } |
420 | 420 |
421 void IpcDesktopEnvironmentTest::OnDesktopAttached( | 421 void IpcDesktopEnvironmentTest::OnDesktopAttached( |
422 IPC::PlatformFileForTransit desktop_pipe) { | 422 IPC::PlatformFileForTransit desktop_pipe) { |
423 | 423 |
| 424 base::ProcessHandle process_handle = base::GetCurrentProcessHandle(); |
| 425 #if defined(OS_WIN) |
| 426 ASSERT_NE(FALSE, ::DuplicateHandle(GetCurrentProcess(), process_handle, |
| 427 GetCurrentProcess(), &process_handle, |
| 428 0, FALSE, DUPLICATE_SAME_ACCESS)); |
| 429 #endif |
| 430 |
424 // Instruct DesktopSessionProxy to connect to the network-to-desktop pipe. | 431 // Instruct DesktopSessionProxy to connect to the network-to-desktop pipe. |
425 desktop_environment_factory_->OnDesktopSessionAgentAttached( | 432 desktop_environment_factory_->OnDesktopSessionAgentAttached( |
426 terminal_id_, base::GetCurrentProcessHandle(), desktop_pipe); | 433 terminal_id_, process_handle, desktop_pipe); |
427 } | 434 } |
428 | 435 |
429 // Runs until the desktop is attached and exits immediately after that. | 436 // Runs until the desktop is attached and exits immediately after that. |
430 TEST_F(IpcDesktopEnvironmentTest, Basic) { | 437 TEST_F(IpcDesktopEnvironmentTest, Basic) { |
431 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( | 438 scoped_ptr<protocol::MockClipboardStub> clipboard_stub( |
432 new protocol::MockClipboardStub()); | 439 new protocol::MockClipboardStub()); |
433 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) | 440 EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) |
434 .Times(0); | 441 .Times(0); |
435 | 442 |
436 // Start the input injector and screen capturer. | 443 // Start the input injector and screen capturer. |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 screen_controls_->SetScreenResolution(ScreenResolution( | 662 screen_controls_->SetScreenResolution(ScreenResolution( |
656 webrtc::DesktopSize(100, 100), | 663 webrtc::DesktopSize(100, 100), |
657 webrtc::DesktopVector(96, 96))); | 664 webrtc::DesktopVector(96, 96))); |
658 | 665 |
659 task_runner_ = nullptr; | 666 task_runner_ = nullptr; |
660 io_task_runner_ = nullptr; | 667 io_task_runner_ = nullptr; |
661 main_run_loop_.Run(); | 668 main_run_loop_.Run(); |
662 } | 669 } |
663 | 670 |
664 } // namespace remoting | 671 } // namespace remoting |
OLD | NEW |