| 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 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 void RunDeathTest(); | 143 void RunDeathTest(); |
| 144 | 144 |
| 145 // Sends a crash request to the desktop process. | 145 // Sends a crash request to the desktop process. |
| 146 void SendCrashRequest(); | 146 void SendCrashRequest(); |
| 147 | 147 |
| 148 // Requests the desktop process to start the desktop session agent. | 148 // Requests the desktop process to start the desktop session agent. |
| 149 void SendStartSessionAgent(); | 149 void SendStartSessionAgent(); |
| 150 | 150 |
| 151 protected: | 151 protected: |
| 152 // The daemon's end of the daemon-to-desktop channel. | 152 // The daemon's end of the daemon-to-desktop channel. |
| 153 scoped_ptr<IPC::ChannelProxy> daemon_channel_; | 153 std::unique_ptr<IPC::ChannelProxy> daemon_channel_; |
| 154 | 154 |
| 155 // Delegate that is passed to |daemon_channel_|. | 155 // Delegate that is passed to |daemon_channel_|. |
| 156 MockDaemonListener daemon_listener_; | 156 MockDaemonListener daemon_listener_; |
| 157 | 157 |
| 158 // Runs the daemon's end of the channel. | 158 // Runs the daemon's end of the channel. |
| 159 base::MessageLoopForUI message_loop_; | 159 base::MessageLoopForUI message_loop_; |
| 160 | 160 |
| 161 scoped_refptr<AutoThreadTaskRunner> io_task_runner_; | 161 scoped_refptr<AutoThreadTaskRunner> io_task_runner_; |
| 162 | 162 |
| 163 // The network's end of the network-to-desktop channel. | 163 // The network's end of the network-to-desktop channel. |
| 164 scoped_ptr<IPC::ChannelProxy> network_channel_; | 164 std::unique_ptr<IPC::ChannelProxy> network_channel_; |
| 165 | 165 |
| 166 // Delegate that is passed to |network_channel_|. | 166 // Delegate that is passed to |network_channel_|. |
| 167 MockNetworkListener network_listener_; | 167 MockNetworkListener network_listener_; |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 DesktopProcessTest::DesktopProcessTest() {} | 170 DesktopProcessTest::DesktopProcessTest() {} |
| 171 | 171 |
| 172 DesktopProcessTest::~DesktopProcessTest() { | 172 DesktopProcessTest::~DesktopProcessTest() { |
| 173 } | 173 } |
| 174 | 174 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 message_loop_.task_runner(), quit_ui_task_runner); | 262 message_loop_.task_runner(), quit_ui_task_runner); |
| 263 | 263 |
| 264 io_task_runner_ = AutoThread::CreateWithType( | 264 io_task_runner_ = AutoThread::CreateWithType( |
| 265 "IPC thread", ui_task_runner, base::MessageLoop::TYPE_IO); | 265 "IPC thread", ui_task_runner, base::MessageLoop::TYPE_IO); |
| 266 | 266 |
| 267 std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); | 267 std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); |
| 268 daemon_channel_ = IPC::ChannelProxy::Create( | 268 daemon_channel_ = IPC::ChannelProxy::Create( |
| 269 IPC::ChannelHandle(channel_name), IPC::Channel::MODE_SERVER, | 269 IPC::ChannelHandle(channel_name), IPC::Channel::MODE_SERVER, |
| 270 &daemon_listener_, io_task_runner_.get()); | 270 &daemon_listener_, io_task_runner_.get()); |
| 271 | 271 |
| 272 scoped_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory( | 272 std::unique_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory( |
| 273 new MockDesktopEnvironmentFactory()); | 273 new MockDesktopEnvironmentFactory()); |
| 274 EXPECT_CALL(*desktop_environment_factory, CreatePtr()) | 274 EXPECT_CALL(*desktop_environment_factory, CreatePtr()) |
| 275 .Times(AnyNumber()) | 275 .Times(AnyNumber()) |
| 276 .WillRepeatedly(Invoke(this, | 276 .WillRepeatedly(Invoke(this, |
| 277 &DesktopProcessTest::CreateDesktopEnvironment)); | 277 &DesktopProcessTest::CreateDesktopEnvironment)); |
| 278 EXPECT_CALL(*desktop_environment_factory, SupportsAudioCapture()) | 278 EXPECT_CALL(*desktop_environment_factory, SupportsAudioCapture()) |
| 279 .Times(AnyNumber()) | 279 .Times(AnyNumber()) |
| 280 .WillRepeatedly(Return(false)); | 280 .WillRepeatedly(Return(false)); |
| 281 | 281 |
| 282 DesktopProcess desktop_process(ui_task_runner, io_task_runner_, channel_name); | 282 DesktopProcess desktop_process(ui_task_runner, io_task_runner_, channel_name); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 } | 354 } |
| 355 | 355 |
| 356 // Run the desktop process and ask it to crash. | 356 // Run the desktop process and ask it to crash. |
| 357 TEST_F(DesktopProcessTest, DeathTest) { | 357 TEST_F(DesktopProcessTest, DeathTest) { |
| 358 testing::GTEST_FLAG(death_test_style) = "threadsafe"; | 358 testing::GTEST_FLAG(death_test_style) = "threadsafe"; |
| 359 | 359 |
| 360 EXPECT_DEATH(RunDeathTest(), ""); | 360 EXPECT_DEATH(RunDeathTest(), ""); |
| 361 } | 361 } |
| 362 | 362 |
| 363 } // namespace remoting | 363 } // namespace remoting |
| OLD | NEW |