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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 Value::CreateStringValue( | 476 Value::CreateStringValue( |
477 MockServiceIPCServer::EnabledUserId())); | 477 MockServiceIPCServer::EnabledUserId())); |
478 | 478 |
479 CommandLine command_line(CommandLine::NO_PROGRAM); | 479 CommandLine command_line(CommandLine::NO_PROGRAM); |
480 command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); | 480 command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); |
481 test_launcher_utils::PrepareBrowserCommandLineForTests(&command_line); | 481 test_launcher_utils::PrepareBrowserCommandLineForTests(&command_line); |
482 | 482 |
483 WaitForConnect(); | 483 WaitForConnect(); |
484 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 484 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
485 MessageLoop::QuitClosure(), | 485 MessageLoop::QuitClosure(), |
486 TestTimeouts::action_timeout_ms()); | 486 TestTimeouts::action_timeout()); |
487 | 487 |
488 bool run_loop = LaunchBrowser(command_line, profile); | 488 bool run_loop = LaunchBrowser(command_line, profile); |
489 EXPECT_FALSE(run_loop); | 489 EXPECT_FALSE(run_loop); |
490 if (run_loop) | 490 if (run_loop) |
491 MessageLoop::current()->Run(); | 491 MessageLoop::current()->Run(); |
492 | 492 |
493 EXPECT_EQ(MockServiceIPCServer::EnabledUserId(), | 493 EXPECT_EQ(MockServiceIPCServer::EnabledUserId(), |
494 prefs->GetString(prefs::kCloudPrintEmail)); | 494 prefs->GetString(prefs::kCloudPrintEmail)); |
495 | 495 |
496 ShutdownAndWaitForExitWithTimeout(handle); | 496 ShutdownAndWaitForExitWithTimeout(handle); |
(...skipping 21 matching lines...) Expand all Loading... |
518 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, | 518 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, |
519 Value::CreateBooleanValue(false)); | 519 Value::CreateBooleanValue(false)); |
520 | 520 |
521 CommandLine command_line(CommandLine::NO_PROGRAM); | 521 CommandLine command_line(CommandLine::NO_PROGRAM); |
522 command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); | 522 command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); |
523 test_launcher_utils::PrepareBrowserCommandLineForTests(&command_line); | 523 test_launcher_utils::PrepareBrowserCommandLineForTests(&command_line); |
524 | 524 |
525 WaitForConnect(); | 525 WaitForConnect(); |
526 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 526 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
527 MessageLoop::QuitClosure(), | 527 MessageLoop::QuitClosure(), |
528 TestTimeouts::action_timeout_ms()); | 528 TestTimeouts::action_timeout()); |
529 | 529 |
530 bool run_loop = LaunchBrowser(command_line, profile); | 530 bool run_loop = LaunchBrowser(command_line, profile); |
531 | 531 |
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 |