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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 return std::move(spawn_result.process); | 476 return std::move(spawn_result.process); |
477 } | 477 } |
478 | 478 |
479 void CloudPrintProxyPolicyStartupTest::WaitForConnect() { | 479 void CloudPrintProxyPolicyStartupTest::WaitForConnect() { |
480 observer_.Wait(); | 480 observer_.Wait(); |
481 EXPECT_TRUE(CheckServiceProcessReady()); | 481 EXPECT_TRUE(CheckServiceProcessReady()); |
482 EXPECT_TRUE(base::ThreadTaskRunnerHandle::Get().get()); | 482 EXPECT_TRUE(base::ThreadTaskRunnerHandle::Get().get()); |
483 | 483 |
484 mojo::MessagePipe pipe; | 484 mojo::MessagePipe pipe; |
485 base::PostTaskWithTraits( | 485 base::PostTaskWithTraits( |
486 FROM_HERE, | 486 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
487 base::TaskTraits().MayBlock().WithPriority( | |
488 base::TaskPriority::BACKGROUND), | |
489 base::BindOnce(&ConnectAsync, base::Passed(&pipe.handle1), | 487 base::BindOnce(&ConnectAsync, base::Passed(&pipe.handle1), |
490 GetServiceProcessChannel())); | 488 GetServiceProcessChannel())); |
491 ServiceProcessControl::GetInstance()->SetChannel( | 489 ServiceProcessControl::GetInstance()->SetChannel( |
492 IPC::ChannelProxy::Create(IPC::ChannelMojo::CreateClientFactory( | 490 IPC::ChannelProxy::Create(IPC::ChannelMojo::CreateClientFactory( |
493 std::move(pipe.handle0), IOTaskRunner()), | 491 std::move(pipe.handle0), IOTaskRunner()), |
494 this, IOTaskRunner())); | 492 this, IOTaskRunner())); |
495 } | 493 } |
496 | 494 |
497 bool CloudPrintProxyPolicyStartupTest::Send(IPC::Message* message) { | 495 bool CloudPrintProxyPolicyStartupTest::Send(IPC::Message* message) { |
498 return ServiceProcessControl::GetInstance()->Send(message); | 496 return ServiceProcessControl::GetInstance()->Send(message); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 // constructed. | 537 // constructed. |
540 chrome::TestingIOThreadState testing_io_thread_state; | 538 chrome::TestingIOThreadState testing_io_thread_state; |
541 | 539 |
542 base::Process process = | 540 base::Process process = |
543 Launch("CloudPrintMockService_StartEnabledWaitForQuit"); | 541 Launch("CloudPrintMockService_StartEnabledWaitForQuit"); |
544 WaitForConnect(); | 542 WaitForConnect(); |
545 ShutdownAndWaitForExitWithTimeout(std::move(process)); | 543 ShutdownAndWaitForExitWithTimeout(std::move(process)); |
546 ServiceProcessControl::GetInstance()->Disconnect(); | 544 ServiceProcessControl::GetInstance()->Disconnect(); |
547 content::RunAllPendingInMessageLoop(); | 545 content::RunAllPendingInMessageLoop(); |
548 } | 546 } |
OLD | NEW |