Commit 969c22ef authored by blundell@chromium.org's avatar blundell@chromium.org

Eliminate ProfileOAuth2TokenService being a BCKS.

This CL introduces a level of indirection around ProfileOAuth2TokenService
(ProfileOAuth2TokenServiceWrapper) to eliminate PO2TS being a BCKS. The only
purpose of the wrapper class is to glue a PO2TS instance to a Profile; the
wrapper has no public API. In particular, PO2TSFactory still vends PO2TS
instances.

BUG=334187
TBR=jochen

Review URL: https://codereview.chromium.org/148513010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251444 0039d316-1c4b-4281-b951-d872f2087c98
parent d6da906f
......@@ -20,6 +20,7 @@
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/common/chrome_constants.h"
......@@ -92,7 +93,7 @@ class UserCloudPolicyManagerChromeOSTest : public testing::Test {
TestingProfile::TestingFactories factories;
factories.push_back(
std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::Build));
FakeProfileOAuth2TokenServiceWrapper::Build));
profile_ = profile_manager_->CreateTestingProfile(
chrome::kInitialProfile, scoped_ptr<PrefServiceSyncable>(),
base::UTF8ToUTF16("testing_profile"), 0, std::string(), factories);
......
......@@ -9,6 +9,7 @@
#include "base/strings/stringprintf.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/fake_signin_manager.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager_base.h"
......@@ -211,7 +212,7 @@ class IdentityAccountTrackerTest : public testing::Test {
virtual void SetUp() OVERRIDE {
TestingProfile::Builder builder;
builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::Build);
FakeProfileOAuth2TokenServiceWrapper::Build);
builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
FakeSigninManagerBase::Build);
......
......@@ -7,6 +7,7 @@
#include "chrome/browser/services/gcm/fake_gcm_profile_service.h"
#include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/test/base/testing_profile.h"
......@@ -27,7 +28,7 @@ class GCMNetworkChannelDelegateImplTest : public ::testing::Test {
TestingProfile::Builder builder;
builder.AddTestingFactory(
ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::BuildAutoIssuingTokenService);
FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService);
profile_ = builder.Build();
FakeProfileOAuth2TokenService* token_service =
......
......@@ -15,6 +15,7 @@
#include "chrome/browser/managed_mode/managed_user_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/chrome_paths.h"
......@@ -74,7 +75,7 @@ class ManagedUserServiceTest : public ::testing::Test {
virtual void SetUp() OVERRIDE {
TestingProfile::Builder builder;
builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::Build);
FakeProfileOAuth2TokenServiceWrapper::Build);
profile_ = builder.Build();
managed_user_service_ =
ManagedUserServiceFactory::GetForProfile(profile_.get());
......
......@@ -15,6 +15,7 @@
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/fake_signin_manager.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager.h"
......@@ -175,7 +176,7 @@ class UserPolicySigninServiceTest : public testing::Test {
builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
SigninManagerFake::Build);
builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::Build);
FakeProfileOAuth2TokenServiceWrapper::Build);
profile_ = builder.Build().Pass();
url_factory_.set_remove_fetcher_on_delete(true);
......
......@@ -8,6 +8,7 @@
#include "chrome/browser/signin/account_reconcilor.h"
#include "chrome/browser/signin/account_reconcilor_factory.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/fake_signin_manager.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
......@@ -100,7 +101,7 @@ AccountReconcilorTest::AccountReconcilorTest()
void AccountReconcilorTest::SetUp() {
TestingProfile::Builder builder;
builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::Build);
FakeProfileOAuth2TokenServiceWrapper::Build);
builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
FakeSigninManagerBase::Build);
builder.AddTestingFactory(AccountReconcilorFactory::GetInstance(),
......
......@@ -68,7 +68,7 @@ class AndroidProfileOAuth2TokenService : public ProfileOAuth2TokenService {
virtual void FireRefreshTokensLoadedFromJava(JNIEnv* env, jobject obj);
protected:
friend class ProfileOAuth2TokenServiceFactory;
friend class ProfileOAuth2TokenServiceWrapperImpl;
AndroidProfileOAuth2TokenService();
virtual ~AndroidProfileOAuth2TokenService();
......
......@@ -13,23 +13,6 @@ FakeProfileOAuth2TokenService::PendingRequest::PendingRequest() {
FakeProfileOAuth2TokenService::PendingRequest::~PendingRequest() {
}
// static
BrowserContextKeyedService* FakeProfileOAuth2TokenService::Build(
content::BrowserContext* profile) {
FakeProfileOAuth2TokenService* service = new FakeProfileOAuth2TokenService();
service->Initialize(reinterpret_cast<Profile*>(profile));
return service;
}
BrowserContextKeyedService*
FakeProfileOAuth2TokenService::BuildAutoIssuingTokenService(
content::BrowserContext* profile) {
FakeProfileOAuth2TokenService* service = new FakeProfileOAuth2TokenService();
service->set_auto_post_fetch_response_on_message_loop(true);
service->Initialize(reinterpret_cast<Profile*>(profile));
return service;
}
FakeProfileOAuth2TokenService::FakeProfileOAuth2TokenService()
: auto_post_fetch_response_on_message_loop_(false) {
SigninAccountIdHelper::SetDisableForTest(true);
......
......@@ -17,10 +17,6 @@
#include "chrome/browser/signin/profile_oauth2_token_service.h"
#endif
namespace content {
class BrowserContext;
}
// Helper class to simplify writing unittests that depend on an instance of
// ProfileOAuth2TokenService.
//
......@@ -111,17 +107,6 @@ class FakeProfileOAuth2TokenService
auto_post_fetch_response_on_message_loop_ = auto_post_response;
}
// Helper function to be used with
// BrowserContextKeyedService::SetTestingFactory().
static BrowserContextKeyedService* Build(content::BrowserContext* profile);
// Helper function to be used with
// BrowserContextKeyedService::SetTestingFactory() that creates a
// FakeProfileOAuth2TokenService object that posts fetch responses on the
// current message loop.
static BrowserContextKeyedService* BuildAutoIssuingTokenService(
content::BrowserContext* profile);
protected:
// OAuth2TokenService overrides.
virtual void FetchOAuth2Token(RequestImpl* request,
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
// static
BrowserContextKeyedService* FakeProfileOAuth2TokenServiceWrapper::Build(
content::BrowserContext* context) {
Profile* profile = static_cast<Profile*>(context);
return new FakeProfileOAuth2TokenServiceWrapper(profile, false);
}
// static
BrowserContextKeyedService*
FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService(
content::BrowserContext* context) {
Profile* profile = static_cast<Profile*>(context);
return new FakeProfileOAuth2TokenServiceWrapper(profile, true);
}
FakeProfileOAuth2TokenServiceWrapper::FakeProfileOAuth2TokenServiceWrapper(
Profile* profile,
bool auto_issue_tokens) {
if (auto_issue_tokens)
service_.set_auto_post_fetch_response_on_message_loop(true);
service_.Initialize(reinterpret_cast<Profile*>(profile));
}
FakeProfileOAuth2TokenServiceWrapper::~FakeProfileOAuth2TokenServiceWrapper() {
service_.Shutdown();
}
ProfileOAuth2TokenService*
FakeProfileOAuth2TokenServiceWrapper::GetProfileOAuth2TokenService() {
return &service_;
}
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SIGNIN_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_WRAPPER_H_
#define CHROME_BROWSER_SIGNIN_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_WRAPPER_H_
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
class Profile;
// A wrapper around FakeProfileOAuth2TokenService to be able to use it as a
// BCKS.
class FakeProfileOAuth2TokenServiceWrapper
: public ProfileOAuth2TokenServiceWrapper {
public:
// Helper function to be used with
// BrowserContextKeyedService::SetTestingFactory().
static BrowserContextKeyedService* Build(content::BrowserContext* context);
// Helper function to be used with
// BrowserContextKeyedService::SetTestingFactory() that creates a
// FakeProfileOAuth2TokenService object that posts fetch responses on the
// current message loop.
static BrowserContextKeyedService* BuildAutoIssuingTokenService(
content::BrowserContext* context);
FakeProfileOAuth2TokenServiceWrapper(Profile* profile,
bool auto_issue_tokens);
virtual ~FakeProfileOAuth2TokenServiceWrapper();
// ProfileOAuth2TokenServiceWrapper implementation:
virtual ProfileOAuth2TokenService* GetProfileOAuth2TokenService() OVERRIDE;
private:
FakeProfileOAuth2TokenService service_;
};
#endif // CHROME_BROWSER_SIGNIN_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_WRAPPER_H_
......@@ -60,7 +60,7 @@ class MutableProfileOAuth2TokenService : public ProfileOAuth2TokenService,
// to information about the account.
typedef std::map<std::string, linked_ptr<AccountInfo> > AccountInfoMap;
friend class ProfileOAuth2TokenServiceFactory;
friend class ProfileOAuth2TokenServiceWrapperImpl;
MutableProfileOAuth2TokenService();
virtual ~MutableProfileOAuth2TokenService();
......
......@@ -21,7 +21,7 @@ class GoogleServiceAuthError;
class Profile;
class SigninGlobalError;
// ProfileOAuth2TokenService is a BrowserContextKeyedService that retrieves
// ProfileOAuth2TokenService is a class that retrieves
// OAuth2 access tokens for a given set of scopes using the OAuth2 login
// refresh tokens.
//
......@@ -35,14 +35,14 @@ class SigninGlobalError;
//
// Note: requests should be started from the UI thread. To start a
// request from other thread, please use ProfileOAuth2TokenServiceRequest.
class ProfileOAuth2TokenService : public OAuth2TokenService,
public BrowserContextKeyedService {
class ProfileOAuth2TokenService : public OAuth2TokenService {
public:
virtual ~ProfileOAuth2TokenService();
// Initializes this token service with the profile.
virtual void Initialize(Profile* profile);
// BrowserContextKeyedService implementation.
virtual void Shutdown() OVERRIDE;
virtual void Shutdown();
// Gets an account id of the primary account related to the profile.
// DEPRECATED: Use SigninManagerBase::GetAuthenticatedAccountId() instead.
......@@ -82,7 +82,6 @@ class ProfileOAuth2TokenService : public OAuth2TokenService,
protected:
ProfileOAuth2TokenService();
virtual ~ProfileOAuth2TokenService();
// OAuth2TokenService overrides.
// Note: These methods are overriden so that ProfileOAuth2TokenService is a
......
......@@ -16,6 +16,40 @@
#include "chrome/browser/signin/mutable_profile_oauth2_token_service.h"
#endif
class ProfileOAuth2TokenServiceWrapperImpl
: public ProfileOAuth2TokenServiceWrapper {
public:
explicit ProfileOAuth2TokenServiceWrapperImpl(Profile* profile);
virtual ~ProfileOAuth2TokenServiceWrapperImpl();
// ProfileOAuth2TokenServiceWrapper:
virtual ProfileOAuth2TokenService* GetProfileOAuth2TokenService() OVERRIDE;
// BrowserContextKeyedService:
virtual void Shutdown() OVERRIDE;
private:
scoped_ptr<ProfileOAuth2TokenService> profile_oauth2_token_service_;
};
ProfileOAuth2TokenServiceWrapperImpl::ProfileOAuth2TokenServiceWrapperImpl(
Profile* profile) {
profile_oauth2_token_service_.reset(new ProfileOAuth2TokenServiceFactory::
PlatformSpecificOAuth2TokenService());
profile_oauth2_token_service_->Initialize(profile);
}
ProfileOAuth2TokenServiceWrapperImpl::~ProfileOAuth2TokenServiceWrapperImpl() {}
void ProfileOAuth2TokenServiceWrapperImpl::Shutdown() {
profile_oauth2_token_service_->Shutdown();
}
ProfileOAuth2TokenService*
ProfileOAuth2TokenServiceWrapperImpl::GetProfileOAuth2TokenService() {
return profile_oauth2_token_service_.get();
}
ProfileOAuth2TokenServiceFactory::ProfileOAuth2TokenServiceFactory()
: BrowserContextKeyedServiceFactory(
"ProfileOAuth2TokenService",
......@@ -27,18 +61,24 @@ ProfileOAuth2TokenServiceFactory::ProfileOAuth2TokenServiceFactory()
ProfileOAuth2TokenServiceFactory::~ProfileOAuth2TokenServiceFactory() {
}
// static
ProfileOAuth2TokenService*
ProfileOAuth2TokenServiceFactory::GetForProfile(Profile* profile) {
return static_cast<ProfileOAuth2TokenService*>(
GetInstance()->GetServiceForBrowserContext(profile, true));
ProfileOAuth2TokenServiceWrapper* wrapper =
static_cast<ProfileOAuth2TokenServiceWrapper*>(
GetInstance()->GetServiceForBrowserContext(profile, true));
if (!wrapper)
return NULL;
return wrapper->GetProfileOAuth2TokenService();
}
// static
ProfileOAuth2TokenServiceFactory::PlatformSpecificOAuth2TokenService*
ProfileOAuth2TokenServiceFactory::GetPlatformSpecificForProfile(
Profile* profile) {
return static_cast<PlatformSpecificOAuth2TokenService*>(
GetForProfile(profile));
ProfileOAuth2TokenService* service =
ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
return static_cast<PlatformSpecificOAuth2TokenService*>(service);
}
// static
......@@ -51,8 +91,5 @@ BrowserContextKeyedService*
ProfileOAuth2TokenServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
Profile* profile = static_cast<Profile*>(context);
PlatformSpecificOAuth2TokenService* service =
new PlatformSpecificOAuth2TokenService();
service->Initialize(profile);
return service;
return new ProfileOAuth2TokenServiceWrapperImpl(profile);
}
......@@ -17,7 +17,13 @@ class AndroidProfileOAuth2TokenService;
class MutableProfileOAuth2TokenService;
#endif
// Singleton that owns all ProfileOAuth2TokenServices and associates them with
// A wrapper of ProfileOAuth2TokenService so we can use it as a BCKS.
class ProfileOAuth2TokenServiceWrapper : public BrowserContextKeyedService {
public:
virtual ProfileOAuth2TokenService* GetProfileOAuth2TokenService() = 0;
};
/// Singleton that owns all ProfileOAuth2TokenServices and associates them with
// Profiles. Listens for the Profile's destruction notification and cleans up
// the associated ProfileOAuth2TokenService.
class ProfileOAuth2TokenServiceFactory
......@@ -46,6 +52,7 @@ class ProfileOAuth2TokenServiceFactory
private:
friend struct DefaultSingletonTraits<ProfileOAuth2TokenServiceFactory>;
friend class ProfileOAuth2TokenServiceWrapperImpl;
#if defined(OS_ANDROID)
typedef AndroidProfileOAuth2TokenService PlatformSpecificOAuth2TokenService;
......
......@@ -8,6 +8,7 @@
#include <vector>
#include "base/threading/thread.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/test/test_browser_thread.h"
......@@ -83,7 +84,7 @@ void ProfileOAuth2TokenServiceRequestTest::SetUp() {
&ui_loop_));
TestingProfile::Builder builder;
builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
&FakeProfileOAuth2TokenService::Build);
&FakeProfileOAuth2TokenServiceWrapper::Build);
profile_ = builder.Build();
oauth2_service_ = (FakeProfileOAuth2TokenService*)
......
......@@ -8,6 +8,7 @@
#include "base/prefs/pref_service.h"
#include "chrome/browser/signin/fake_auth_status_provider.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/fake_signin_manager.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager.h"
......@@ -28,7 +29,7 @@ class SigninGlobalErrorTest : public testing::Test {
// Create a signed-in profile.
TestingProfile::Builder builder;
builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::Build);
FakeProfileOAuth2TokenServiceWrapper::Build);
builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
FakeSigninManagerBase::Build);
profile_ = builder.Build();
......
......@@ -16,6 +16,7 @@
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/signin/chrome_signin_manager_delegate.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
......@@ -107,7 +108,7 @@ class SigninManagerTest : public testing::Test {
prefs_.get());
TestingProfile::Builder builder;
builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::Build);
FakeProfileOAuth2TokenServiceWrapper::Build);
profile_ = builder.Build();
}
......
......@@ -11,6 +11,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/fake_auth_status_provider.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/fake_signin_manager.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
......@@ -53,7 +54,7 @@ class SigninTrackerTest : public testing::Test {
virtual void SetUp() OVERRIDE {
TestingProfile::Builder builder;
builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::Build);
FakeProfileOAuth2TokenServiceWrapper::Build);
profile_ = builder.Build();
......
......@@ -22,6 +22,7 @@
#include "base/time/time.h"
#include "chrome/browser/autofill/personal_data_manager_factory.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager.h"
#include "chrome/browser/signin/signin_manager_factory.h"
......@@ -513,7 +514,7 @@ class ProfileSyncServiceAutofillTest
TestingProfile::Builder builder;
builder.AddTestingFactory(
ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::BuildAutoIssuingTokenService);
FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService);
profile_ = builder.Build().Pass();
web_database_.reset(new WebDatabaseFake(&autofill_table_));
MockWebDataServiceWrapper* wrapper =
......
......@@ -20,6 +20,7 @@
#include "chrome/browser/password_manager/null_password_store_service.h"
#include "chrome/browser/password_manager/password_store_factory.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager.h"
......@@ -160,7 +161,7 @@ class ProfileSyncServicePasswordTest : public AbstractProfileSyncServiceTest {
TestingProfile::Builder builder;
builder.AddTestingFactory(
ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::BuildAutoIssuingTokenService);
FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService);
profile_ = builder.Build().Pass();
invalidation::InvalidationServiceFactory::GetInstance()->
SetBuildOnlyFakeInvalidatorsForTest(true);
......
......@@ -18,6 +18,7 @@
#include "chrome/browser/invalidation/invalidation_service_factory.h"
#include "chrome/browser/prefs/pref_model_associator.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager.h"
#include "chrome/browser/signin/signin_manager_factory.h"
......@@ -127,7 +128,7 @@ class ProfileSyncServicePreferenceTest
TestingProfile::Builder builder;
builder.AddTestingFactory(
ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::BuildAutoIssuingTokenService);
FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService);
profile_ = builder.Build().Pass();
invalidation::InvalidationServiceFactory::GetInstance()->
SetBuildOnlyFakeInvalidatorsForTest(true);
......
......@@ -20,6 +20,7 @@
#include "chrome/browser/invalidation/invalidation_service_factory.h"
#include "chrome/browser/sessions/session_tab_helper.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager.h"
......@@ -137,7 +138,7 @@ class ProfileSyncServiceSessionTest
TestingProfile::Builder builder;
builder.AddTestingFactory(
ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::BuildAutoIssuingTokenService);
FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService);
// Don't want the profile to create a real ProfileSyncService.
builder.AddTestingFactory(ProfileSyncServiceFactory::GetInstance(), NULL);
scoped_ptr<TestingProfile> profile(builder.Build());
......
......@@ -8,6 +8,7 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/managed_mode/managed_user_signin_manager_wrapper.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/fake_signin_manager.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
......@@ -78,7 +79,7 @@ class ProfileSyncServiceStartupTest : public testing::Test {
FakeSigninManagerBase::Build);
builder.AddTestingFactory(
ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::BuildAutoIssuingTokenService);
FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService);
builder.AddTestingFactory(ProfileSyncServiceFactory::GetInstance(),
BuildService);
return builder.Build();
......
......@@ -24,6 +24,7 @@
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/invalidation/invalidation_service_factory.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager.h"
#include "chrome/browser/signin/signin_manager_factory.h"
......@@ -188,7 +189,7 @@ class ProfileSyncServiceTypedUrlTest : public AbstractProfileSyncServiceTest {
TestingProfile::Builder builder;
builder.AddTestingFactory(
ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::BuildAutoIssuingTokenService);
FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService);
profile_ = builder.Build().Pass();
invalidation::InvalidationServiceFactory::GetInstance()->
SetBuildOnlyFakeInvalidatorsForTest(true);
......
......@@ -10,6 +10,7 @@
#include "chrome/browser/invalidation/invalidation_service_factory.h"
#include "chrome/browser/managed_mode/managed_user_signin_manager_wrapper.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager.h"
#include "chrome/browser/signin/signin_manager_factory.h"
......@@ -95,7 +96,7 @@ class ProfileSyncServiceTest : public ::testing::Test {
builder.AddTestingFactory(
ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::BuildAutoIssuingTokenService);
FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService);
invalidation::InvalidationServiceFactory::GetInstance()->
SetBuildOnlyFakeInvalidatorsForTest(true);
......
......@@ -12,6 +12,7 @@
#include "chrome/browser/profiles/avatar_menu.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager.h"
......@@ -35,7 +36,7 @@ class ProfileChooserControllerTest : public CocoaProfileTest {
TestingProfile::TestingFactories factories;
factories.push_back(
std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::Build));
FakeProfileOAuth2TokenServiceWrapper::Build));
testing_profile_manager()->
CreateTestingProfile("test1", scoped_ptr<PrefServiceSyncable>(),
base::ASCIIToUTF16("Test 1"), 0, std::string(),
......
......@@ -14,6 +14,7 @@
#include "chrome/browser/profiles/profile_io_data.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/fake_signin_manager.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
......@@ -318,7 +319,7 @@ void OneClickSigninHelperTest::SubmitGAIAPassword(
content::BrowserContext* OneClickSigninHelperTest::CreateBrowserContext() {
TestingProfile::Builder builder;
builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
FakeProfileOAuth2TokenService::Build);
FakeProfileOAuth2TokenServiceWrapper::Build);
scoped_ptr<TestingProfile> profile = builder.Build();
fake_oauth2_token_service_ =
......
......@@ -171,6 +171,8 @@
'browser/sessions/session_service_test_helper.h',
'browser/signin/fake_profile_oauth2_token_service.cc',
'browser/signin/fake_profile_oauth2_token_service.h',
'browser/signin/fake_profile_oauth2_token_service_wrapper.cc',
'browser/signin/fake_profile_oauth2_token_service_wrapper.h',
'browser/signin/fake_signin_manager.cc',
'browser/signin/fake_signin_manager.h',
'browser/ssl/ssl_client_auth_requestor_mock.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment