Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc

Issue 388963002: Get rid of the rest of CreateStringValue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bad rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 // LocalState for the BrowserProcess. Must be created before profiles are 545 // LocalState for the BrowserProcess. Must be created before profiles are
546 // constructed. 546 // constructed.
547 chrome::TestingIOThreadState testing_io_thread_state; 547 chrome::TestingIOThreadState testing_io_thread_state;
548 548
549 TestingProfile* profile = 549 TestingProfile* profile =
550 profile_manager.CreateTestingProfile("StartBrowserWithoutPolicy"); 550 profile_manager.CreateTestingProfile("StartBrowserWithoutPolicy");
551 CloudPrintProxyServiceFactory::GetInstance()-> 551 CloudPrintProxyServiceFactory::GetInstance()->
552 SetTestingFactory(profile, CloudPrintProxyServiceFactoryForPolicyTest); 552 SetTestingFactory(profile, CloudPrintProxyServiceFactoryForPolicyTest);
553 553
554 TestingPrefServiceSyncable* prefs = profile->GetTestingPrefService(); 554 TestingPrefServiceSyncable* prefs = profile->GetTestingPrefService();
555 prefs->SetUserPref(prefs::kCloudPrintEmail, 555 prefs->SetUserPref(
556 base::Value::CreateStringValue( 556 prefs::kCloudPrintEmail,
557 MockServiceIPCServer::EnabledUserId())); 557 new base::StringValue(MockServiceIPCServer::EnabledUserId()));
558 558
559 CommandLine command_line(CommandLine::NO_PROGRAM); 559 CommandLine command_line(CommandLine::NO_PROGRAM);
560 command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); 560 command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy);
561 test_launcher_utils::PrepareBrowserCommandLineForTests(&command_line); 561 test_launcher_utils::PrepareBrowserCommandLineForTests(&command_line);
562 562
563 WaitForConnect(); 563 WaitForConnect();
564 base::RunLoop run_loop; 564 base::RunLoop run_loop;
565 base::MessageLoop::current()->PostDelayedTask( 565 base::MessageLoop::current()->PostDelayedTask(
566 FROM_HERE, 566 FROM_HERE,
567 run_loop.QuitClosure(), 567 run_loop.QuitClosure(),
(...skipping 25 matching lines...) Expand all
593 // LocalState for the BrowserProcess. Must be created before profiles are 593 // LocalState for the BrowserProcess. Must be created before profiles are
594 // constructed. 594 // constructed.
595 chrome::TestingIOThreadState testing_io_thread_state; 595 chrome::TestingIOThreadState testing_io_thread_state;
596 596
597 TestingProfile* profile = 597 TestingProfile* profile =
598 profile_manager.CreateTestingProfile("StartBrowserWithPolicy"); 598 profile_manager.CreateTestingProfile("StartBrowserWithPolicy");
599 CloudPrintProxyServiceFactory::GetInstance()-> 599 CloudPrintProxyServiceFactory::GetInstance()->
600 SetTestingFactory(profile, CloudPrintProxyServiceFactoryForPolicyTest); 600 SetTestingFactory(profile, CloudPrintProxyServiceFactoryForPolicyTest);
601 601
602 TestingPrefServiceSyncable* prefs = profile->GetTestingPrefService(); 602 TestingPrefServiceSyncable* prefs = profile->GetTestingPrefService();
603 prefs->SetUserPref(prefs::kCloudPrintEmail, 603 prefs->SetUserPref(
604 base::Value::CreateStringValue( 604 prefs::kCloudPrintEmail,
605 MockServiceIPCServer::EnabledUserId())); 605 new base::StringValue(MockServiceIPCServer::EnabledUserId()));
606 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, 606 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled,
607 new base::FundamentalValue(false)); 607 new base::FundamentalValue(false));
608 608
609 CommandLine command_line(CommandLine::NO_PROGRAM); 609 CommandLine command_line(CommandLine::NO_PROGRAM);
610 command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); 610 command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy);
611 test_launcher_utils::PrepareBrowserCommandLineForTests(&command_line); 611 test_launcher_utils::PrepareBrowserCommandLineForTests(&command_line);
612 612
613 WaitForConnect(); 613 WaitForConnect();
614 base::RunLoop run_loop; 614 base::RunLoop run_loop;
615 base::MessageLoop::current()->PostDelayedTask( 615 base::MessageLoop::current()->PostDelayedTask(
616 FROM_HERE, 616 FROM_HERE,
617 run_loop.QuitClosure(), 617 run_loop.QuitClosure(),
618 TestTimeouts::action_timeout()); 618 TestTimeouts::action_timeout());
619 619
620 bool should_run_loop = LaunchBrowser(command_line, profile); 620 bool should_run_loop = LaunchBrowser(command_line, profile);
621 621
622 // No expectations on run_loop being true here; that would be a race 622 // No expectations on run_loop being true here; that would be a race
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698