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 // Create a service process that uses a Mock to respond to the browser in order | 5 // Create a service process that uses a Mock to respond to the browser in order |
6 // to test launching the browser using the cloud print policy check command | 6 // to test launching the browser using the cloud print policy check command |
7 // line switch. | 7 // line switch. |
8 | 8 |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 463 |
464 startup_channel_handle_ = mojo::edk::NamedPlatformHandle( | 464 startup_channel_handle_ = mojo::edk::NamedPlatformHandle( |
465 base::StringPrintf("%d.%p.%d", base::GetCurrentProcId(), this, | 465 base::StringPrintf("%d.%p.%d", base::GetCurrentProcId(), this, |
466 base::RandInt(0, std::numeric_limits<int>::max()))); | 466 base::RandInt(0, std::numeric_limits<int>::max()))); |
467 startup_channel_ = IPC::ChannelProxy::Create( | 467 startup_channel_ = IPC::ChannelProxy::Create( |
468 mojo::edk::ConnectToPeerProcess( | 468 mojo::edk::ConnectToPeerProcess( |
469 mojo::edk::CreateServerHandle(startup_channel_handle_)) | 469 mojo::edk::CreateServerHandle(startup_channel_handle_)) |
470 .release(), | 470 .release(), |
471 IPC::Channel::MODE_SERVER, this, IOTaskRunner()); | 471 IPC::Channel::MODE_SERVER, this, IOTaskRunner()); |
472 | 472 |
473 base::Process process = SpawnChild(name); | 473 base::SpawnChildResult spawn_result = SpawnChild(name); |
| 474 base::Process process = std::move(spawn_result.process); |
474 EXPECT_TRUE(process.IsValid()); | 475 EXPECT_TRUE(process.IsValid()); |
475 return process; | 476 return process; |
476 } | 477 } |
477 | 478 |
478 void CloudPrintProxyPolicyStartupTest::WaitForConnect() { | 479 void CloudPrintProxyPolicyStartupTest::WaitForConnect() { |
479 observer_.Wait(); | 480 observer_.Wait(); |
480 EXPECT_TRUE(CheckServiceProcessReady()); | 481 EXPECT_TRUE(CheckServiceProcessReady()); |
481 EXPECT_TRUE(base::ThreadTaskRunnerHandle::Get().get()); | 482 EXPECT_TRUE(base::ThreadTaskRunnerHandle::Get().get()); |
482 | 483 |
483 mojo::MessagePipe pipe; | 484 mojo::MessagePipe pipe; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 // constructed. | 536 // constructed. |
536 chrome::TestingIOThreadState testing_io_thread_state; | 537 chrome::TestingIOThreadState testing_io_thread_state; |
537 | 538 |
538 base::Process process = | 539 base::Process process = |
539 Launch("CloudPrintMockService_StartEnabledWaitForQuit"); | 540 Launch("CloudPrintMockService_StartEnabledWaitForQuit"); |
540 WaitForConnect(); | 541 WaitForConnect(); |
541 ShutdownAndWaitForExitWithTimeout(std::move(process)); | 542 ShutdownAndWaitForExitWithTimeout(std::move(process)); |
542 ServiceProcessControl::GetInstance()->Disconnect(); | 543 ServiceProcessControl::GetInstance()->Disconnect(); |
543 content::RunAllPendingInMessageLoop(); | 544 content::RunAllPendingInMessageLoop(); |
544 } | 545 } |
OLD | NEW |