| 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 <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/attachment_broker_privileged.h" |
| 20 #include "ipc/ipc_channel.h" | 21 #include "ipc/ipc_channel.h" |
| 21 #include "ipc/ipc_channel_proxy.h" | 22 #include "ipc/ipc_channel_proxy.h" |
| 22 #include "ipc/ipc_listener.h" | 23 #include "ipc/ipc_listener.h" |
| 23 #include "ipc/ipc_message.h" | 24 #include "ipc/ipc_message.h" |
| 24 #include "remoting/base/auto_thread.h" | 25 #include "remoting/base/auto_thread.h" |
| 25 #include "remoting/base/auto_thread_task_runner.h" | 26 #include "remoting/base/auto_thread_task_runner.h" |
| 26 #include "remoting/host/chromoting_messages.h" | 27 #include "remoting/host/chromoting_messages.h" |
| 27 #include "remoting/host/desktop_process.h" | 28 #include "remoting/host/desktop_process.h" |
| 28 #include "remoting/host/fake_mouse_cursor_monitor.h" | 29 #include "remoting/host/fake_mouse_cursor_monitor.h" |
| 29 #include "remoting/host/host_exit_codes.h" | 30 #include "remoting/host/host_exit_codes.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // Delegate that is passed to |network_channel_|. | 166 // Delegate that is passed to |network_channel_|. |
| 166 MockNetworkListener network_listener_; | 167 MockNetworkListener network_listener_; |
| 167 }; | 168 }; |
| 168 | 169 |
| 169 DesktopProcessTest::DesktopProcessTest() {} | 170 DesktopProcessTest::DesktopProcessTest() {} |
| 170 | 171 |
| 171 DesktopProcessTest::~DesktopProcessTest() { | 172 DesktopProcessTest::~DesktopProcessTest() { |
| 172 } | 173 } |
| 173 | 174 |
| 174 void DesktopProcessTest::SetUp() { | 175 void DesktopProcessTest::SetUp() { |
| 176 IPC::AttachmentBrokerPrivileged::CreateBrokerForSingleProcessTests(); |
| 175 } | 177 } |
| 176 | 178 |
| 177 void DesktopProcessTest::TearDown() { | 179 void DesktopProcessTest::TearDown() { |
| 178 } | 180 } |
| 179 | 181 |
| 180 void DesktopProcessTest::ConnectNetworkChannel( | 182 void DesktopProcessTest::ConnectNetworkChannel( |
| 181 IPC::PlatformFileForTransit desktop_process) { | 183 IPC::PlatformFileForTransit desktop_process) { |
| 182 | 184 |
| 183 #if defined(OS_POSIX) | 185 #if defined(OS_POSIX) |
| 184 IPC::ChannelHandle channel_handle(std::string(), desktop_process); | 186 IPC::ChannelHandle channel_handle(std::string(), desktop_process); |
| 185 #elif defined(OS_WIN) | 187 #elif defined(OS_WIN) |
| 186 IPC::ChannelHandle channel_handle(desktop_process); | 188 IPC::ChannelHandle channel_handle(desktop_process.GetHandle()); |
| 187 #endif // defined(OS_WIN) | 189 #endif // defined(OS_WIN) |
| 188 | 190 |
| 189 network_channel_ = | 191 network_channel_ = |
| 190 IPC::ChannelProxy::Create(channel_handle, IPC::Channel::MODE_CLIENT, | 192 IPC::ChannelProxy::Create(channel_handle, IPC::Channel::MODE_CLIENT, |
| 191 &network_listener_, io_task_runner_.get()); | 193 &network_listener_, io_task_runner_.get()); |
| 192 } | 194 } |
| 193 | 195 |
| 194 void DesktopProcessTest::OnDesktopAttached( | 196 void DesktopProcessTest::OnDesktopAttached( |
| 195 IPC::PlatformFileForTransit desktop_process) { | 197 IPC::PlatformFileForTransit desktop_process) { |
| 196 #if defined(OS_POSIX) | 198 #if defined(OS_POSIX) |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 } | 354 } |
| 353 | 355 |
| 354 // Run the desktop process and ask it to crash. | 356 // Run the desktop process and ask it to crash. |
| 355 TEST_F(DesktopProcessTest, DeathTest) { | 357 TEST_F(DesktopProcessTest, DeathTest) { |
| 356 testing::GTEST_FLAG(death_test_style) = "threadsafe"; | 358 testing::GTEST_FLAG(death_test_style) = "threadsafe"; |
| 357 | 359 |
| 358 EXPECT_DEATH(RunDeathTest(), ""); | 360 EXPECT_DEATH(RunDeathTest(), ""); |
| 359 } | 361 } |
| 360 | 362 |
| 361 } // namespace remoting | 363 } // namespace remoting |
| OLD | NEW |