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 "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 base::GetCurrentProcId(), this, | 443 base::GetCurrentProcId(), this, |
444 base::RandInt(0, std::numeric_limits<int>::max())); | 444 base::RandInt(0, std::numeric_limits<int>::max())); |
445 startup_channel_ = IPC::ChannelProxy::Create(startup_channel_id_, | 445 startup_channel_ = IPC::ChannelProxy::Create(startup_channel_id_, |
446 IPC::Channel::MODE_SERVER, | 446 IPC::Channel::MODE_SERVER, |
447 this, | 447 this, |
448 IOMessageLoopProxy()); | 448 IOMessageLoopProxy()); |
449 | 449 |
450 #if defined(OS_POSIX) | 450 #if defined(OS_POSIX) |
451 base::FileHandleMappingVector ipc_file_list; | 451 base::FileHandleMappingVector ipc_file_list; |
452 ipc_file_list.push_back(std::make_pair( | 452 ipc_file_list.push_back(std::make_pair( |
453 startup_channel_->TakeClientFileDescriptor(), | 453 startup_channel_->TakeClientFileDescriptor().release(), |
454 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); | 454 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); |
455 base::LaunchOptions options; | 455 base::LaunchOptions options; |
456 options.fds_to_remap = &ipc_file_list; | 456 options.fds_to_remap = &ipc_file_list; |
457 base::ProcessHandle handle = SpawnChildWithOptions(name, options); | 457 base::ProcessHandle handle = SpawnChildWithOptions(name, options); |
458 #else | 458 #else |
459 base::ProcessHandle handle = SpawnChild(name); | 459 base::ProcessHandle handle = SpawnChild(name); |
460 #endif | 460 #endif |
461 EXPECT_TRUE(handle); | 461 EXPECT_TRUE(handle); |
462 return handle; | 462 return handle; |
463 } | 463 } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 // condition. | 623 // condition. |
624 if (should_run_loop) | 624 if (should_run_loop) |
625 run_loop.Run(); | 625 run_loop.Run(); |
626 | 626 |
627 EXPECT_EQ("", prefs->GetString(prefs::kCloudPrintEmail)); | 627 EXPECT_EQ("", prefs->GetString(prefs::kCloudPrintEmail)); |
628 | 628 |
629 ShutdownAndWaitForExitWithTimeout(handle); | 629 ShutdownAndWaitForExitWithTimeout(handle); |
630 content::RunAllPendingInMessageLoop(); | 630 content::RunAllPendingInMessageLoop(); |
631 profile_manager.DeleteTestingProfile("StartBrowserWithPolicy"); | 631 profile_manager.DeleteTestingProfile("StartBrowserWithPolicy"); |
632 } | 632 } |
OLD | NEW |