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

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

Issue 2446053002: Use ChannelMojo between the remoting daemon and desktop processes. (Closed)
Patch Set: Created 4 years, 1 month 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
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 base::Closure quit_ui_task_runner = base::Bind( 258 base::Closure quit_ui_task_runner = base::Bind(
259 base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask), 259 base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask),
260 message_loop_.task_runner(), 260 message_loop_.task_runner(),
261 FROM_HERE, run_loop.QuitClosure()); 261 FROM_HERE, run_loop.QuitClosure());
262 scoped_refptr<AutoThreadTaskRunner> ui_task_runner = new AutoThreadTaskRunner( 262 scoped_refptr<AutoThreadTaskRunner> ui_task_runner = new AutoThreadTaskRunner(
263 message_loop_.task_runner(), quit_ui_task_runner); 263 message_loop_.task_runner(), quit_ui_task_runner);
264 264
265 io_task_runner_ = AutoThread::CreateWithType( 265 io_task_runner_ = AutoThread::CreateWithType(
266 "IPC thread", ui_task_runner, base::MessageLoop::TYPE_IO); 266 "IPC thread", ui_task_runner, base::MessageLoop::TYPE_IO);
267 267
268 std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); 268 mojo::MessagePipe pipe;
269 daemon_channel_ = IPC::ChannelProxy::Create( 269 daemon_channel_ = IPC::ChannelProxy::Create(
270 IPC::ChannelHandle(channel_name), IPC::Channel::MODE_SERVER, 270 pipe.handle0.release(), IPC::Channel::MODE_SERVER, &daemon_listener_,
271 &daemon_listener_, io_task_runner_.get()); 271 io_task_runner_.get());
272 272
273 std::unique_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory( 273 std::unique_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory(
274 new MockDesktopEnvironmentFactory()); 274 new MockDesktopEnvironmentFactory());
275 EXPECT_CALL(*desktop_environment_factory, CreatePtr()) 275 EXPECT_CALL(*desktop_environment_factory, CreatePtr())
276 .Times(AnyNumber()) 276 .Times(AnyNumber())
277 .WillRepeatedly(Invoke(this, 277 .WillRepeatedly(Invoke(this,
278 &DesktopProcessTest::CreateDesktopEnvironment)); 278 &DesktopProcessTest::CreateDesktopEnvironment));
279 EXPECT_CALL(*desktop_environment_factory, SupportsAudioCapture()) 279 EXPECT_CALL(*desktop_environment_factory, SupportsAudioCapture())
280 .Times(AnyNumber()) 280 .Times(AnyNumber())
281 .WillRepeatedly(Return(false)); 281 .WillRepeatedly(Return(false));
282 282
283 DesktopProcess desktop_process(ui_task_runner, io_task_runner_, channel_name); 283 DesktopProcess desktop_process(ui_task_runner, io_task_runner_,
284 io_task_runner_, std::move(pipe.handle1));
284 EXPECT_TRUE(desktop_process.Start(std::move(desktop_environment_factory))); 285 EXPECT_TRUE(desktop_process.Start(std::move(desktop_environment_factory)));
285 286
286 ui_task_runner = nullptr; 287 ui_task_runner = nullptr;
287 run_loop.Run(); 288 run_loop.Run();
288 } 289 }
289 290
290 void DesktopProcessTest::RunDeathTest() { 291 void DesktopProcessTest::RunDeathTest() {
291 InSequence s; 292 InSequence s;
292 EXPECT_CALL(daemon_listener_, OnChannelConnected(_)); 293 EXPECT_CALL(daemon_listener_, OnChannelConnected(_));
293 EXPECT_CALL(daemon_listener_, OnDesktopAttached(_)) 294 EXPECT_CALL(daemon_listener_, OnDesktopAttached(_))
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 } 356 }
356 357
357 // Run the desktop process and ask it to crash. 358 // Run the desktop process and ask it to crash.
358 TEST_F(DesktopProcessTest, DeathTest) { 359 TEST_F(DesktopProcessTest, DeathTest) {
359 testing::GTEST_FLAG(death_test_style) = "threadsafe"; 360 testing::GTEST_FLAG(death_test_style) = "threadsafe";
360 361
361 EXPECT_DEATH(RunDeathTest(), ""); 362 EXPECT_DEATH(RunDeathTest(), "");
362 } 363 }
363 364
364 } // namespace remoting 365 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/desktop_process_main.cc ('k') | remoting/host/ipc_desktop_environment_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698