| 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 // from InProcessBrowserTest::SetUp(). These tests require a more complex | 422 // from InProcessBrowserTest::SetUp(). These tests require a more complex |
| 423 // process startup so they are unable to just inherit from | 423 // process startup so they are unable to just inherit from |
| 424 // InProcessBrowserTest. | 424 // InProcessBrowserTest. |
| 425 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 425 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 426 base::FilePath user_data_dir = | 426 base::FilePath user_data_dir = |
| 427 command_line->GetSwitchValuePath(switches::kUserDataDir); | 427 command_line->GetSwitchValuePath(switches::kUserDataDir); |
| 428 if (user_data_dir.empty()) { | 428 if (user_data_dir.empty()) { |
| 429 ASSERT_TRUE(temp_user_data_dir_.CreateUniqueTempDir() && | 429 ASSERT_TRUE(temp_user_data_dir_.CreateUniqueTempDir() && |
| 430 temp_user_data_dir_.IsValid()) | 430 temp_user_data_dir_.IsValid()) |
| 431 << "Could not create temporary user data directory \"" | 431 << "Could not create temporary user data directory \"" |
| 432 << temp_user_data_dir_.path().value() << "\"."; | 432 << temp_user_data_dir_.GetPath().value() << "\"."; |
| 433 | 433 |
| 434 user_data_dir = temp_user_data_dir_.path(); | 434 user_data_dir = temp_user_data_dir_.GetPath(); |
| 435 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); | 435 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); |
| 436 } | 436 } |
| 437 ASSERT_TRUE(test_launcher_utils::OverrideUserDataDir(user_data_dir)); | 437 ASSERT_TRUE(test_launcher_utils::OverrideUserDataDir(user_data_dir)); |
| 438 | 438 |
| 439 #if defined(OS_MACOSX) | 439 #if defined(OS_MACOSX) |
| 440 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); | 440 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 441 EXPECT_TRUE(MockLaunchd::MakeABundle(temp_dir_.path(), | 441 EXPECT_TRUE(MockLaunchd::MakeABundle(temp_dir_.GetPath(), |
| 442 "CloudPrintProxyTest", | 442 "CloudPrintProxyTest", &bundle_path_, |
| 443 &bundle_path_, | |
| 444 &executable_path_)); | 443 &executable_path_)); |
| 445 mock_launchd_.reset(new MockLaunchd(executable_path_, | 444 mock_launchd_.reset(new MockLaunchd(executable_path_, |
| 446 base::MessageLoopForUI::current(), | 445 base::MessageLoopForUI::current(), |
| 447 true, false)); | 446 true, false)); |
| 448 scoped_launchd_instance_.reset( | 447 scoped_launchd_instance_.reset( |
| 449 new Launchd::ScopedInstance(mock_launchd_.get())); | 448 new Launchd::ScopedInstance(mock_launchd_.get())); |
| 450 #endif | 449 #endif |
| 451 } | 450 } |
| 452 | 451 |
| 453 void CloudPrintProxyPolicyStartupTest::TearDown() { | 452 void CloudPrintProxyPolicyStartupTest::TearDown() { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 // constructed. | 546 // constructed. |
| 548 chrome::TestingIOThreadState testing_io_thread_state; | 547 chrome::TestingIOThreadState testing_io_thread_state; |
| 549 | 548 |
| 550 base::Process process = | 549 base::Process process = |
| 551 Launch("CloudPrintMockService_StartEnabledWaitForQuit"); | 550 Launch("CloudPrintMockService_StartEnabledWaitForQuit"); |
| 552 WaitForConnect(); | 551 WaitForConnect(); |
| 553 ShutdownAndWaitForExitWithTimeout(std::move(process)); | 552 ShutdownAndWaitForExitWithTimeout(std::move(process)); |
| 554 ServiceProcessControl::GetInstance()->Disconnect(); | 553 ServiceProcessControl::GetInstance()->Disconnect(); |
| 555 content::RunAllPendingInMessageLoop(); | 554 content::RunAllPendingInMessageLoop(); |
| 556 } | 555 } |
| OLD | NEW |