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

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

Issue 11759019: Update other unittests to use newly added TestingBrowserProcess::GetGlobal(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: simpler codez Created 7 years, 11 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 CloudPrintProxyService* service = new CloudPrintProxyService(profile); 456 CloudPrintProxyService* service = new CloudPrintProxyService(profile);
457 service->Initialize(); 457 service->Initialize();
458 return service; 458 return service;
459 } 459 }
460 460
461 TEST_F(CloudPrintProxyPolicyStartupTest, StartBrowserWithoutPolicy) { 461 TEST_F(CloudPrintProxyPolicyStartupTest, StartBrowserWithoutPolicy) {
462 base::ProcessHandle handle = 462 base::ProcessHandle handle =
463 Launch("CloudPrintMockService_StartEnabledWaitForQuit"); 463 Launch("CloudPrintMockService_StartEnabledWaitForQuit");
464 464
465 TestingBrowserProcess* browser_process = 465 TestingBrowserProcess* browser_process =
466 static_cast<TestingBrowserProcess*>(g_browser_process); 466 TestingBrowserProcess::GetGlobal();
467 TestingProfileManager profile_manager(browser_process); 467 TestingProfileManager profile_manager(browser_process);
468 ASSERT_TRUE(profile_manager.SetUp()); 468 ASSERT_TRUE(profile_manager.SetUp());
469 469
470 TestingProfile* profile = 470 TestingProfile* profile =
471 profile_manager.CreateTestingProfile("StartBrowserWithoutPolicy"); 471 profile_manager.CreateTestingProfile("StartBrowserWithoutPolicy");
472 CloudPrintProxyServiceFactory::GetInstance()-> 472 CloudPrintProxyServiceFactory::GetInstance()->
473 SetTestingFactory(profile, CloudPrintProxyServiceFactoryForPolicyTest); 473 SetTestingFactory(profile, CloudPrintProxyServiceFactoryForPolicyTest);
474 474
475 TestingPrefServiceSyncable* prefs = profile->GetTestingPrefService(); 475 TestingPrefServiceSyncable* prefs = profile->GetTestingPrefService();
476 prefs->SetUserPref(prefs::kCloudPrintEmail, 476 prefs->SetUserPref(prefs::kCloudPrintEmail,
(...skipping 19 matching lines...) Expand all
496 496
497 ShutdownAndWaitForExitWithTimeout(handle); 497 ShutdownAndWaitForExitWithTimeout(handle);
498 profile_manager.DeleteTestingProfile("StartBrowserWithoutPolicy"); 498 profile_manager.DeleteTestingProfile("StartBrowserWithoutPolicy");
499 } 499 }
500 500
501 TEST_F(CloudPrintProxyPolicyStartupTest, StartBrowserWithPolicy) { 501 TEST_F(CloudPrintProxyPolicyStartupTest, StartBrowserWithPolicy) {
502 base::ProcessHandle handle = 502 base::ProcessHandle handle =
503 Launch("CloudPrintMockService_StartEnabledExpectDisabled"); 503 Launch("CloudPrintMockService_StartEnabledExpectDisabled");
504 504
505 TestingBrowserProcess* browser_process = 505 TestingBrowserProcess* browser_process =
506 static_cast<TestingBrowserProcess*>(g_browser_process); 506 TestingBrowserProcess::GetGlobal();
507 TestingProfileManager profile_manager(browser_process); 507 TestingProfileManager profile_manager(browser_process);
508 ASSERT_TRUE(profile_manager.SetUp()); 508 ASSERT_TRUE(profile_manager.SetUp());
509 509
510 TestingProfile* profile = 510 TestingProfile* profile =
511 profile_manager.CreateTestingProfile("StartBrowserWithPolicy"); 511 profile_manager.CreateTestingProfile("StartBrowserWithPolicy");
512 CloudPrintProxyServiceFactory::GetInstance()-> 512 CloudPrintProxyServiceFactory::GetInstance()->
513 SetTestingFactory(profile, CloudPrintProxyServiceFactoryForPolicyTest); 513 SetTestingFactory(profile, CloudPrintProxyServiceFactoryForPolicyTest);
514 514
515 TestingPrefServiceSyncable* prefs = profile->GetTestingPrefService(); 515 TestingPrefServiceSyncable* prefs = profile->GetTestingPrefService();
516 prefs->SetUserPref(prefs::kCloudPrintEmail, 516 prefs->SetUserPref(prefs::kCloudPrintEmail,
(...skipping 16 matching lines...) Expand all
533 // No expectations on run_loop being true here; that would be a race 533 // No expectations on run_loop being true here; that would be a race
534 // condition. 534 // condition.
535 if (run_loop) 535 if (run_loop)
536 MessageLoop::current()->Run(); 536 MessageLoop::current()->Run();
537 537
538 EXPECT_EQ("", prefs->GetString(prefs::kCloudPrintEmail)); 538 EXPECT_EQ("", prefs->GetString(prefs::kCloudPrintEmail));
539 539
540 ShutdownAndWaitForExitWithTimeout(handle); 540 ShutdownAndWaitForExitWithTimeout(handle);
541 profile_manager.DeleteTestingProfile("StartBrowserWithPolicy"); 541 profile_manager.DeleteTestingProfile("StartBrowserWithPolicy");
542 } 542 }
OLDNEW
« no previous file with comments | « chrome/browser/policy/user_policy_signin_service_unittest.cc ('k') | chrome/browser/profiles/avatar_menu_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698