Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Side by Side Diff: remoting/host/desktop_process_unittest.cc

Issue 1184523003: attachment broker wip (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor comments. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/host/desktop_process.cc ('k') | remoting/host/desktop_session_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 void DesktopProcessTest::ConnectNetworkChannel( 169 void DesktopProcessTest::ConnectNetworkChannel(
170 IPC::PlatformFileForTransit desktop_process) { 170 IPC::PlatformFileForTransit desktop_process) {
171 171
172 #if defined(OS_POSIX) 172 #if defined(OS_POSIX)
173 IPC::ChannelHandle channel_handle(std::string(), desktop_process); 173 IPC::ChannelHandle channel_handle(std::string(), desktop_process);
174 #elif defined(OS_WIN) 174 #elif defined(OS_WIN)
175 IPC::ChannelHandle channel_handle(desktop_process); 175 IPC::ChannelHandle channel_handle(desktop_process);
176 #endif // defined(OS_WIN) 176 #endif // defined(OS_WIN)
177 177
178 network_channel_ = IPC::ChannelProxy::Create(channel_handle, 178 network_channel_ = IPC::ChannelProxy::Create(
179 IPC::Channel::MODE_CLIENT, 179 channel_handle, IPC::Channel::MODE_CLIENT, &network_listener_,
180 &network_listener_, 180 io_task_runner_.get(), nullptr);
181 io_task_runner_.get());
182 } 181 }
183 182
184 void DesktopProcessTest::OnDesktopAttached( 183 void DesktopProcessTest::OnDesktopAttached(
185 IPC::PlatformFileForTransit desktop_process) { 184 IPC::PlatformFileForTransit desktop_process) {
186 #if defined(OS_POSIX) 185 #if defined(OS_POSIX)
187 DCHECK(desktop_process.auto_close); 186 DCHECK(desktop_process.auto_close);
188 187
189 base::File closer(IPC::PlatformFileForTransitToFile(desktop_process)); 188 base::File closer(IPC::PlatformFileForTransitToFile(desktop_process));
190 #endif // defined(OS_POSIX) 189 #endif // defined(OS_POSIX)
191 } 190 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask), 238 base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask),
240 message_loop_.task_runner(), 239 message_loop_.task_runner(),
241 FROM_HERE, run_loop.QuitClosure()); 240 FROM_HERE, run_loop.QuitClosure());
242 scoped_refptr<AutoThreadTaskRunner> ui_task_runner = new AutoThreadTaskRunner( 241 scoped_refptr<AutoThreadTaskRunner> ui_task_runner = new AutoThreadTaskRunner(
243 message_loop_.task_runner(), quit_ui_task_runner); 242 message_loop_.task_runner(), quit_ui_task_runner);
244 243
245 io_task_runner_ = AutoThread::CreateWithType( 244 io_task_runner_ = AutoThread::CreateWithType(
246 "IPC thread", ui_task_runner, base::MessageLoop::TYPE_IO); 245 "IPC thread", ui_task_runner, base::MessageLoop::TYPE_IO);
247 246
248 std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); 247 std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID();
249 daemon_channel_ = IPC::ChannelProxy::Create(IPC::ChannelHandle(channel_name), 248 daemon_channel_ = IPC::ChannelProxy::Create(
250 IPC::Channel::MODE_SERVER, 249 IPC::ChannelHandle(channel_name), IPC::Channel::MODE_SERVER,
251 &daemon_listener_, 250 &daemon_listener_, io_task_runner_.get(), nullptr);
252 io_task_runner_.get());
253 251
254 scoped_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory( 252 scoped_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory(
255 new MockDesktopEnvironmentFactory()); 253 new MockDesktopEnvironmentFactory());
256 EXPECT_CALL(*desktop_environment_factory, CreatePtr()) 254 EXPECT_CALL(*desktop_environment_factory, CreatePtr())
257 .Times(AnyNumber()) 255 .Times(AnyNumber())
258 .WillRepeatedly(Invoke(this, 256 .WillRepeatedly(Invoke(this,
259 &DesktopProcessTest::CreateDesktopEnvironment)); 257 &DesktopProcessTest::CreateDesktopEnvironment));
260 EXPECT_CALL(*desktop_environment_factory, SupportsAudioCapture()) 258 EXPECT_CALL(*desktop_environment_factory, SupportsAudioCapture())
261 .Times(AnyNumber()) 259 .Times(AnyNumber())
262 .WillRepeatedly(Return(false)); 260 .WillRepeatedly(Return(false));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 334 }
337 335
338 // Run the desktop process and ask it to crash. 336 // Run the desktop process and ask it to crash.
339 TEST_F(DesktopProcessTest, DeathTest) { 337 TEST_F(DesktopProcessTest, DeathTest) {
340 testing::GTEST_FLAG(death_test_style) = "threadsafe"; 338 testing::GTEST_FLAG(death_test_style) = "threadsafe";
341 339
342 EXPECT_DEATH(RunDeathTest(), ""); 340 EXPECT_DEATH(RunDeathTest(), "");
343 } 341 }
344 342
345 } // namespace remoting 343 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/desktop_process.cc ('k') | remoting/host/desktop_session_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698