| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 137   void SendStartSessionAgent(); | 137   void SendStartSessionAgent(); | 
| 138 | 138 | 
| 139  protected: | 139  protected: | 
| 140   // The daemon's end of the daemon-to-desktop channel. | 140   // The daemon's end of the daemon-to-desktop channel. | 
| 141   scoped_ptr<IPC::ChannelProxy> daemon_channel_; | 141   scoped_ptr<IPC::ChannelProxy> daemon_channel_; | 
| 142 | 142 | 
| 143   // Delegate that is passed to |daemon_channel_|. | 143   // Delegate that is passed to |daemon_channel_|. | 
| 144   MockDaemonListener daemon_listener_; | 144   MockDaemonListener daemon_listener_; | 
| 145 | 145 | 
| 146   // Runs the daemon's end of the channel. | 146   // Runs the daemon's end of the channel. | 
| 147   MessageLoop message_loop_; | 147   base::MessageLoop message_loop_; | 
| 148 | 148 | 
| 149   scoped_refptr<AutoThreadTaskRunner> io_task_runner_; | 149   scoped_refptr<AutoThreadTaskRunner> io_task_runner_; | 
| 150 | 150 | 
| 151   // The network's end of the network-to-desktop channel. | 151   // The network's end of the network-to-desktop channel. | 
| 152   scoped_ptr<IPC::ChannelProxy> network_channel_; | 152   scoped_ptr<IPC::ChannelProxy> network_channel_; | 
| 153 | 153 | 
| 154   // Delegate that is passed to |network_channel_|. | 154   // Delegate that is passed to |network_channel_|. | 
| 155   MockNetworkListener network_listener_; | 155   MockNetworkListener network_listener_; | 
| 156 }; | 156 }; | 
| 157 | 157 | 
| 158 |  | 
| 159 DesktopProcessTest::DesktopProcessTest() | 158 DesktopProcessTest::DesktopProcessTest() | 
| 160     : message_loop_(MessageLoop::TYPE_UI) { | 159     : message_loop_(base::MessageLoop::TYPE_UI) {} | 
| 161 } |  | 
| 162 | 160 | 
| 163 DesktopProcessTest::~DesktopProcessTest() { | 161 DesktopProcessTest::~DesktopProcessTest() { | 
| 164 } | 162 } | 
| 165 | 163 | 
| 166 void DesktopProcessTest::SetUp() { | 164 void DesktopProcessTest::SetUp() { | 
| 167 } | 165 } | 
| 168 | 166 | 
| 169 void DesktopProcessTest::TearDown() { | 167 void DesktopProcessTest::TearDown() { | 
| 170 } | 168 } | 
| 171 | 169 | 
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 239 | 237 | 
| 240 void DesktopProcessTest::RunDesktopProcess() { | 238 void DesktopProcessTest::RunDesktopProcess() { | 
| 241   base::RunLoop run_loop; | 239   base::RunLoop run_loop; | 
| 242   base::Closure quit_ui_task_runner = base::Bind( | 240   base::Closure quit_ui_task_runner = base::Bind( | 
| 243       base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask), | 241       base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask), | 
| 244       message_loop_.message_loop_proxy(), | 242       message_loop_.message_loop_proxy(), | 
| 245       FROM_HERE, run_loop.QuitClosure()); | 243       FROM_HERE, run_loop.QuitClosure()); | 
| 246   scoped_refptr<AutoThreadTaskRunner> ui_task_runner = new AutoThreadTaskRunner( | 244   scoped_refptr<AutoThreadTaskRunner> ui_task_runner = new AutoThreadTaskRunner( | 
| 247       message_loop_.message_loop_proxy(), quit_ui_task_runner); | 245       message_loop_.message_loop_proxy(), quit_ui_task_runner); | 
| 248 | 246 | 
| 249   io_task_runner_ = AutoThread::CreateWithType("IPC thread", ui_task_runner, | 247   io_task_runner_ = AutoThread::CreateWithType( | 
| 250                                                MessageLoop::TYPE_IO); | 248       "IPC thread", ui_task_runner, base::MessageLoop::TYPE_IO); | 
| 251 | 249 | 
| 252   std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); | 250   std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); | 
| 253   daemon_channel_.reset(new IPC::ChannelProxy( | 251   daemon_channel_.reset(new IPC::ChannelProxy( | 
| 254       IPC::ChannelHandle(channel_name), | 252       IPC::ChannelHandle(channel_name), | 
| 255       IPC::Channel::MODE_SERVER, | 253       IPC::Channel::MODE_SERVER, | 
| 256       &daemon_listener_, | 254       &daemon_listener_, | 
| 257       io_task_runner_)); | 255       io_task_runner_)); | 
| 258 | 256 | 
| 259   scoped_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory( | 257   scoped_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory( | 
| 260       new MockDesktopEnvironmentFactory()); | 258       new MockDesktopEnvironmentFactory()); | 
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 342 } | 340 } | 
| 343 | 341 | 
| 344 // Run the desktop process and ask it to crash. | 342 // Run the desktop process and ask it to crash. | 
| 345 TEST_F(DesktopProcessTest, DeathTest) { | 343 TEST_F(DesktopProcessTest, DeathTest) { | 
| 346   testing::GTEST_FLAG(death_test_style) = "threadsafe"; | 344   testing::GTEST_FLAG(death_test_style) = "threadsafe"; | 
| 347 | 345 | 
| 348   EXPECT_DEATH(RunDeathTest(), ""); | 346   EXPECT_DEATH(RunDeathTest(), ""); | 
| 349 } | 347 } | 
| 350 | 348 | 
| 351 }  // namespace remoting | 349 }  // namespace remoting | 
| OLD | NEW | 
|---|