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

Side by Side Diff: chrome/browser/signin/signin_manager_unittest.cc

Issue 148513010: Eliminate ProfileOAuth2TokenService being a BCKS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to review Created 6 years, 10 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 "chrome/browser/signin/signin_manager.h" 5 #include "chrome/browser/signin/signin_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "base/prefs/testing_pref_service.h" 11 #include "base/prefs/testing_pref_service.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/chrome_notification_types.h" 15 #include "chrome/browser/chrome_notification_types.h"
16 #include "chrome/browser/prefs/browser_prefs.h" 16 #include "chrome/browser/prefs/browser_prefs.h"
17 #include "chrome/browser/signin/chrome_signin_manager_delegate.h" 17 #include "chrome/browser/signin/chrome_signin_manager_delegate.h"
18 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" 18 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
19 #include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
19 #include "chrome/browser/signin/profile_oauth2_token_service.h" 20 #include "chrome/browser/signin/profile_oauth2_token_service.h"
20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 21 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
21 #include "chrome/browser/signin/signin_manager_factory.h" 22 #include "chrome/browser/signin/signin_manager_factory.h"
22 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
23 #include "chrome/common/url_constants.h" 24 #include "chrome/common/url_constants.h"
24 #include "chrome/test/base/testing_browser_process.h" 25 #include "chrome/test/base/testing_browser_process.h"
25 #include "chrome/test/base/testing_profile.h" 26 #include "chrome/test/base/testing_profile.h"
26 #include "components/webdata/encryptor/encryptor.h" 27 #include "components/webdata/encryptor/encryptor.h"
27 #include "content/public/browser/child_process_security_policy.h" 28 #include "content/public/browser/child_process_security_policy.h"
28 #include "content/public/browser/notification_source.h" 29 #include "content/public/browser/notification_source.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 virtual ~SigninManagerTest() {} 101 virtual ~SigninManagerTest() {}
101 102
102 virtual void SetUp() OVERRIDE { 103 virtual void SetUp() OVERRIDE {
103 manager_ = NULL; 104 manager_ = NULL;
104 prefs_.reset(new TestingPrefServiceSimple); 105 prefs_.reset(new TestingPrefServiceSimple);
105 chrome::RegisterLocalState(prefs_->registry()); 106 chrome::RegisterLocalState(prefs_->registry());
106 TestingBrowserProcess::GetGlobal()->SetLocalState( 107 TestingBrowserProcess::GetGlobal()->SetLocalState(
107 prefs_.get()); 108 prefs_.get());
108 TestingProfile::Builder builder; 109 TestingProfile::Builder builder;
109 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), 110 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
110 FakeProfileOAuth2TokenService::Build); 111 FakeProfileOAuth2TokenServiceWrapper::Build);
111 profile_ = builder.Build(); 112 profile_ = builder.Build();
112 } 113 }
113 114
114 virtual void TearDown() OVERRIDE { 115 virtual void TearDown() OVERRIDE {
115 if (manager_) 116 if (manager_)
116 manager_->RemoveObserver(&test_observer_); 117 manager_->RemoveObserver(&test_observer_);
117 118
118 // Destroy the SigninManager here, because it relies on profile() which is 119 // Destroy the SigninManager here, because it relies on profile() which is
119 // freed in the base class. 120 // freed in the base class.
120 if (naked_manager_) { 121 if (naked_manager_) {
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 profile()->GetPrefs()->GetString(prefs::kGoogleServicesUsername)); 574 profile()->GetPrefs()->GetString(prefs::kGoogleServicesUsername));
574 EXPECT_EQ("external@example.com", manager_->GetAuthenticatedUsername()); 575 EXPECT_EQ("external@example.com", manager_->GetAuthenticatedUsername());
575 } 576 }
576 577
577 TEST_F(SigninManagerTest, SigninNotAllowed) { 578 TEST_F(SigninManagerTest, SigninNotAllowed) {
578 std::string user("user@google.com"); 579 std::string user("user@google.com");
579 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, user); 580 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, user);
580 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); 581 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false);
581 CreateSigninManagerAsService(); 582 CreateSigninManagerAsService();
582 } 583 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_global_error_unittest.cc ('k') | chrome/browser/signin/signin_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698