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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 } | 474 } |
475 | 475 |
476 void CloudPrintProxyPolicyStartupTest::WaitForConnect() { | 476 void CloudPrintProxyPolicyStartupTest::WaitForConnect() { |
477 observer_.Wait(); | 477 observer_.Wait(); |
478 EXPECT_TRUE(CheckServiceProcessReady()); | 478 EXPECT_TRUE(CheckServiceProcessReady()); |
479 EXPECT_TRUE(base::ThreadTaskRunnerHandle::Get().get()); | 479 EXPECT_TRUE(base::ThreadTaskRunnerHandle::Get().get()); |
480 | 480 |
481 mojo::MessagePipe pipe; | 481 mojo::MessagePipe pipe; |
482 BrowserThread::PostBlockingPoolTask( | 482 BrowserThread::PostBlockingPoolTask( |
483 FROM_HERE, base::Bind(&ConnectOnBlockingPool, base::Passed(&pipe.handle1), | 483 FROM_HERE, base::Bind(&ConnectOnBlockingPool, base::Passed(&pipe.handle1), |
484 mojo::edk::NamedPlatformHandle( | 484 GetServiceProcessChannel())); |
485 GetServiceProcessChannel().name))); | |
486 ServiceProcessControl::GetInstance()->SetChannel( | 485 ServiceProcessControl::GetInstance()->SetChannel( |
487 IPC::ChannelProxy::Create(IPC::ChannelMojo::CreateClientFactory( | 486 IPC::ChannelProxy::Create(IPC::ChannelMojo::CreateClientFactory( |
488 std::move(pipe.handle0), IOTaskRunner()), | 487 std::move(pipe.handle0), IOTaskRunner()), |
489 this, IOTaskRunner())); | 488 this, IOTaskRunner())); |
490 } | 489 } |
491 | 490 |
492 bool CloudPrintProxyPolicyStartupTest::Send(IPC::Message* message) { | 491 bool CloudPrintProxyPolicyStartupTest::Send(IPC::Message* message) { |
493 return ServiceProcessControl::GetInstance()->Send(message); | 492 return ServiceProcessControl::GetInstance()->Send(message); |
494 } | 493 } |
495 | 494 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 // constructed. | 533 // constructed. |
535 chrome::TestingIOThreadState testing_io_thread_state; | 534 chrome::TestingIOThreadState testing_io_thread_state; |
536 | 535 |
537 base::Process process = | 536 base::Process process = |
538 Launch("CloudPrintMockService_StartEnabledWaitForQuit"); | 537 Launch("CloudPrintMockService_StartEnabledWaitForQuit"); |
539 WaitForConnect(); | 538 WaitForConnect(); |
540 ShutdownAndWaitForExitWithTimeout(std::move(process)); | 539 ShutdownAndWaitForExitWithTimeout(std::move(process)); |
541 ServiceProcessControl::GetInstance()->Disconnect(); | 540 ServiceProcessControl::GetInstance()->Disconnect(); |
542 content::RunAllPendingInMessageLoop(); | 541 content::RunAllPendingInMessageLoop(); |
543 } | 542 } |
OLD | NEW |