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

Side by Side Diff: chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc

Issue 14141006: [components] Switch {RefCounted}ProfileKeyedService to use BrowserContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for review Created 7 years, 8 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 #include <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/prefs/testing_pref_service.h" 10 #include "base/prefs/testing_pref_service.h"
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 415 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
416 416
417 service.GetMockServiceProcessControl()->SetWillBeEnabledExpectations(); 417 service.GetMockServiceProcessControl()->SetWillBeEnabledExpectations();
418 service.EnableForUser(std::string(), 418 service.EnableForUser(std::string(),
419 MockServiceProcessControl::EnabledUserId()); 419 MockServiceProcessControl::EnabledUserId());
420 420
421 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(), 421 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(),
422 prefs->GetString(prefs::kCloudPrintEmail)); 422 prefs->GetString(prefs::kCloudPrintEmail));
423 } 423 }
424 424
425 ProfileKeyedService* TestCloudPrintProxyServiceFactory(Profile* profile) { 425 ProfileKeyedService* TestCloudPrintProxyServiceFactory(
426 TestCloudPrintProxyService* service = new TestCloudPrintProxyService(profile); 426 content::BrowserContext* profile) {
427 TestCloudPrintProxyService* service =
428 new TestCloudPrintProxyService(static_cast<Profile*>(profile));
427 429
428 service->GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( 430 service->GetMockServiceProcessControl()->SetConnectSuccessMockExpectations(
429 MockServiceProcessControl::kServiceStateEnabled, true); 431 MockServiceProcessControl::kServiceStateEnabled, true);
430 service->GetMockServiceProcessControl()->SetWillBeDisabledExpectations(); 432 service->GetMockServiceProcessControl()->SetWillBeDisabledExpectations();
431 433
432 service->Initialize(); 434 service->Initialize();
433 MessageLoop::current()->RunUntilIdle(); 435 MessageLoop::current()->RunUntilIdle();
434 return service; 436 return service;
435 } 437 }
436 438
437 TEST_F(CloudPrintProxyPolicyTest, StartupBrowserCreatorWithCommandLine) { 439 TEST_F(CloudPrintProxyPolicyTest, StartupBrowserCreatorWithCommandLine) {
438 TestingPrefServiceSyncable* prefs = profile_.GetTestingPrefService(); 440 TestingPrefServiceSyncable* prefs = profile_.GetTestingPrefService();
439 prefs->SetUserPref(prefs::kCloudPrintEmail, 441 prefs->SetUserPref(prefs::kCloudPrintEmail,
440 Value::CreateStringValue(std::string())); 442 Value::CreateStringValue(std::string()));
441 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, 443 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled,
442 Value::CreateBooleanValue(false)); 444 Value::CreateBooleanValue(false));
443 445
444 CloudPrintProxyServiceFactory::GetInstance()-> 446 CloudPrintProxyServiceFactory::GetInstance()->
445 SetTestingFactory(&profile_, TestCloudPrintProxyServiceFactory); 447 SetTestingFactory(&profile_, TestCloudPrintProxyServiceFactory);
446 448
447 CommandLine command_line(CommandLine::NO_PROGRAM); 449 CommandLine command_line(CommandLine::NO_PROGRAM);
448 command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); 450 command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy);
449 451
450 EXPECT_FALSE(LaunchBrowser(command_line, &profile_)); 452 EXPECT_FALSE(LaunchBrowser(command_line, &profile_));
451 MessageLoop::current()->RunUntilIdle(); 453 MessageLoop::current()->RunUntilIdle();
452 } 454 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698