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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 383 |
384 startup_channel_id_ = | 384 startup_channel_id_ = |
385 base::StringPrintf("%d.%p.%d", | 385 base::StringPrintf("%d.%p.%d", |
386 base::GetCurrentProcId(), this, | 386 base::GetCurrentProcId(), this, |
387 base::RandInt(0, std::numeric_limits<int>::max())); | 387 base::RandInt(0, std::numeric_limits<int>::max())); |
388 startup_channel_.reset(new IPC::ChannelProxy( | 388 startup_channel_.reset(new IPC::ChannelProxy( |
389 startup_channel_id_, IPC::Channel::MODE_SERVER, | 389 startup_channel_id_, IPC::Channel::MODE_SERVER, |
390 this, IOMessageLoopProxy())); | 390 this, IOMessageLoopProxy())); |
391 | 391 |
392 #if defined(OS_POSIX) | 392 #if defined(OS_POSIX) |
393 base::file_handle_mapping_vector ipc_file_list; | 393 base::FileHandleMappingVector ipc_file_list; |
394 ipc_file_list.push_back(std::make_pair( | 394 ipc_file_list.push_back(std::make_pair( |
395 startup_channel_->TakeClientFileDescriptor(), | 395 startup_channel_->TakeClientFileDescriptor(), |
396 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); | 396 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); |
397 base::ProcessHandle handle = SpawnChild(name, ipc_file_list, false); | 397 base::ProcessHandle handle = SpawnChild(name, ipc_file_list, false); |
398 #else | 398 #else |
399 base::ProcessHandle handle = SpawnChild(name, false); | 399 base::ProcessHandle handle = SpawnChild(name, false); |
400 #endif | 400 #endif |
401 EXPECT_TRUE(handle); | 401 EXPECT_TRUE(handle); |
402 return handle; | 402 return handle; |
403 } | 403 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 // No expectations on run_loop being true here; that would be a race | 532 // No expectations on run_loop being true here; that would be a race |
533 // condition. | 533 // condition. |
534 if (run_loop) | 534 if (run_loop) |
535 MessageLoop::current()->Run(); | 535 MessageLoop::current()->Run(); |
536 | 536 |
537 EXPECT_EQ("", prefs->GetString(prefs::kCloudPrintEmail)); | 537 EXPECT_EQ("", prefs->GetString(prefs::kCloudPrintEmail)); |
538 | 538 |
539 ShutdownAndWaitForExitWithTimeout(handle); | 539 ShutdownAndWaitForExitWithTimeout(handle); |
540 profile_manager.DeleteTestingProfile("StartBrowserWithPolicy"); | 540 profile_manager.DeleteTestingProfile("StartBrowserWithPolicy"); |
541 } | 541 } |
OLD | NEW |