| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 IPC::Channel::MODE_CLIENT, | 179 IPC::Channel::MODE_CLIENT, |
| 180 &network_listener_, | 180 &network_listener_, |
| 181 io_task_runner_.get())); | 181 io_task_runner_.get())); |
| 182 } | 182 } |
| 183 | 183 |
| 184 void DesktopProcessTest::OnDesktopAttached( | 184 void DesktopProcessTest::OnDesktopAttached( |
| 185 IPC::PlatformFileForTransit desktop_process) { | 185 IPC::PlatformFileForTransit desktop_process) { |
| 186 #if defined(OS_POSIX) | 186 #if defined(OS_POSIX) |
| 187 DCHECK(desktop_process.auto_close); | 187 DCHECK(desktop_process.auto_close); |
| 188 | 188 |
| 189 base::ClosePlatformFile(desktop_process.fd); | 189 base::File closer(IPC::PlatformFileForTransitToFile(desktop_process)); |
| 190 #endif // defined(OS_POSIX) | 190 #endif // defined(OS_POSIX) |
| 191 } | 191 } |
| 192 | 192 |
| 193 DesktopEnvironment* DesktopProcessTest::CreateDesktopEnvironment() { | 193 DesktopEnvironment* DesktopProcessTest::CreateDesktopEnvironment() { |
| 194 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); | 194 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); |
| 195 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr()) | 195 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr()) |
| 196 .Times(0); | 196 .Times(0); |
| 197 EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr()) | 197 EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr()) |
| 198 .Times(AtMost(1)) | 198 .Times(AtMost(1)) |
| 199 .WillOnce(Invoke(this, &DesktopProcessTest::CreateInputInjector)); | 199 .WillOnce(Invoke(this, &DesktopProcessTest::CreateInputInjector)); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 } | 337 } |
| 338 | 338 |
| 339 // Run the desktop process and ask it to crash. | 339 // Run the desktop process and ask it to crash. |
| 340 TEST_F(DesktopProcessTest, DeathTest) { | 340 TEST_F(DesktopProcessTest, DeathTest) { |
| 341 testing::GTEST_FLAG(death_test_style) = "threadsafe"; | 341 testing::GTEST_FLAG(death_test_style) = "threadsafe"; |
| 342 | 342 |
| 343 EXPECT_DEATH(RunDeathTest(), ""); | 343 EXPECT_DEATH(RunDeathTest(), ""); |
| 344 } | 344 } |
| 345 | 345 |
| 346 } // namespace remoting | 346 } // namespace remoting |
| OLD | NEW |