diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-16 23:30:08 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-16 23:30:08 +0000 |
commit | 0cc5af1e63cd0b4829df26e13b1d4ec0246f6d5f (patch) | |
tree | 81eda230ca4a1713aa8c07fe2de6387e1bcfb04b | |
parent | aaa20bde39ef30c762b0430913a0fa99d39e3a81 (diff) | |
download | chromium_src-0cc5af1e63cd0b4829df26e13b1d4ec0246f6d5f.zip chromium_src-0cc5af1e63cd0b4829df26e13b1d4ec0246f6d5f.tar.gz chromium_src-0cc5af1e63cd0b4829df26e13b1d4ec0246f6d5f.tar.bz2 |
sync: remove cros_user parameter from ProfileSyncService
Instead use SigninManager to store this information.
TBR=mirandac@chromium.org
BUG=88109,93922, 107160
TEST=most scenarios with CrOS UI displaying the username, including signin dialogs
Review URL: http://codereview.chromium.org/8910003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114880 0039d316-1c4b-4281-b951-d872f2087c98
37 files changed, 271 insertions, 158 deletions
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc index 159d6ba..156cc13 100644 --- a/chrome/browser/chromeos/login/login_utils.cc +++ b/chrome/browser/chromeos/login/login_utils.cc @@ -894,9 +894,8 @@ void LoginUtilsImpl::StartSync( // Set the CrOS user by getting this constructor run with the // user's email on first retrieval. std::string email = UserManager::Get()->logged_in_user().email(); - // TODO(tim): Tidy this up once cros_user is gone (part of bug 93922). user_profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, email); - user_profile->GetProfileSyncService(email)->SetPassphrase(password_, false); + user_profile->GetProfileSyncService()->SetPassphrase(password_, false); password_ = ""; token_service->Initialize(GaiaConstants::kChromeOSSource, user_profile); diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc index 4046b70..89e1c1c 100644 --- a/chrome/browser/chromeos/login/screen_locker.cc +++ b/chrome/browser/chromeos/login/screen_locker.cc @@ -32,6 +32,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/sync/profile_sync_service.h" +#include "chrome/browser/sync/signin_manager.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" @@ -279,7 +280,11 @@ void ScreenLocker::OnLoginSuccess( Profile* profile = ProfileManager::GetDefaultProfile(); if (profile) { - ProfileSyncService* service = profile->GetProfileSyncService(username); + // TODO(tim): When do we get here? Does this get called if + // LoginUtils::StartSync has already happened (and presumably the username + // is already set)? + ProfileSyncService* service = profile->GetProfileSyncService(); + service->signin()->SetAuthenticatedUsername(username); if (service && !service->HasSyncSetupCompleted()) { // If sync has failed somehow, try setting the sync passphrase here. service->SetPassphrase(password, false); diff --git a/chrome/browser/defaults.cc b/chrome/browser/defaults.cc index 1f3e303..83b6a4d 100644 --- a/chrome/browser/defaults.cc +++ b/chrome/browser/defaults.cc @@ -29,7 +29,7 @@ const bool kShowImportOnBookmarkBar = false; const bool kShowExitMenuItem = true; const bool kDownloadPageHasShowInFolder = true; const bool kSizeTabButtonToTopOfTabStrip = true; -const bool kBootstrapSyncAuthentication = true; +const bool kSyncAutoStarts = true; const bool kShowOtherBrowsersInAboutMemory = false; const bool kAlwaysOpenIncognitoWindow = true; const bool kShowCancelButtonInTaskManager = true; @@ -66,7 +66,7 @@ const bool kShowExitMenuItem = false; const bool kShowExitMenuItem = true; #endif const bool kSizeTabButtonToTopOfTabStrip = false; -const bool kBootstrapSyncAuthentication = false; +const bool kSyncAutoStarts = false; const bool kShowOtherBrowsersInAboutMemory = true; const bool kAlwaysOpenIncognitoWindow = false; const bool kShowCancelButtonInTaskManager = false; diff --git a/chrome/browser/defaults.h b/chrome/browser/defaults.h index e06f008..b112899 100644 --- a/chrome/browser/defaults.h +++ b/chrome/browser/defaults.h @@ -56,9 +56,11 @@ extern const bool kDownloadPageHasShowInFolder; // Should the tab strip be sized to the top of the tab strip? extern const bool kSizeTabButtonToTopOfTabStrip; -// Whether we should bootstrap the sync authentication using cookies instead of -// asking the user for credentials. -extern const bool kBootstrapSyncAuthentication; +// If true, we want to automatically start sync signin whenever we have +// credentials (user doesn't need to go through the startup flow). This is +// typically enabled on platforms (like ChromeOS) that have their own +// distinct signin flow. +extern const bool kSyncAutoStarts; // Should other browsers be shown in about:memory page? extern const bool kShowOtherBrowsersInAboutMemory; diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc index fcbee74..6257a75 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.cc +++ b/chrome/browser/profiles/off_the_record_profile_impl.cc @@ -444,11 +444,6 @@ ProfileSyncService* OffTheRecordProfileImpl::GetProfileSyncService() { return NULL; } -ProfileSyncService* OffTheRecordProfileImpl::GetProfileSyncService( - const std::string& cros_user) { - return NULL; -} - bool OffTheRecordProfileImpl::IsSameProfile(Profile* profile) { return (profile == this) || (profile == profile_); } diff --git a/chrome/browser/profiles/off_the_record_profile_impl.h b/chrome/browser/profiles/off_the_record_profile_impl.h index 38143ce..81f3d87 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.h +++ b/chrome/browser/profiles/off_the_record_profile_impl.h @@ -91,8 +91,6 @@ class OffTheRecordProfileImpl : public Profile, virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE; virtual TokenService* GetTokenService() OVERRIDE; virtual ProfileSyncService* GetProfileSyncService() OVERRIDE; - virtual ProfileSyncService* GetProfileSyncService( - const std::string& cros_user) OVERRIDE; virtual bool IsSameProfile(Profile* profile) OVERRIDE; virtual Time GetStartTime() const OVERRIDE; virtual SpellCheckHost* GetSpellCheckHost() OVERRIDE; diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h index d425d9d..d502a26 100644 --- a/chrome/browser/profiles/profile.h +++ b/chrome/browser/profiles/profile.h @@ -400,11 +400,6 @@ class Profile : public content::BrowserContext { // Returns the ProfileSyncService, creating if not yet created. virtual ProfileSyncService* GetProfileSyncService() = 0; - // Returns the ProfileSyncService, creating if not yet created, with - // the specified CrOS username. - virtual ProfileSyncService* GetProfileSyncService( - const std::string& cros_user) = 0; - // Return whether 2 profiles are the same. 2 profiles are the same if they // represent the same profile. This can happen if there is pointer equality // or if one profile is the incognito version of another profile (or vice diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index e54f05a..17583fb 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -1400,27 +1400,21 @@ ProfileSyncService* ProfileImpl::GetProfileSyncService() { return NULL; } #endif - return GetProfileSyncService(""); -} - -ProfileSyncService* ProfileImpl::GetProfileSyncService( - const std::string& cros_user) { if (!ProfileSyncService::IsSyncEnabled()) return NULL; if (!profile_sync_service_created_) { profile_sync_service_created_ = true; - InitSyncService(cros_user); + InitSyncService(); } return sync_service_.get(); } -void ProfileImpl::InitSyncService(const std::string& cros_user) { +void ProfileImpl::InitSyncService() { profile_sync_factory_.reset( new ProfileSyncComponentsFactoryImpl(this, CommandLine::ForCurrentProcess())); - sync_service_.reset( - profile_sync_factory_->CreateProfileSyncService(cros_user)); + sync_service_.reset(profile_sync_factory_->CreateProfileSyncService()); profile_sync_factory_->RegisterDataTypes(sync_service_.get()); sync_service_->Initialize(); diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h index 98edb11..d85ceb6 100644 --- a/chrome/browser/profiles/profile_impl.h +++ b/chrome/browser/profiles/profile_impl.h @@ -126,10 +126,8 @@ class ProfileImpl : public Profile, virtual FilePath last_selected_directory() OVERRIDE; virtual void set_last_selected_directory(const FilePath& path) OVERRIDE; virtual ProfileSyncService* GetProfileSyncService() OVERRIDE; - virtual ProfileSyncService* GetProfileSyncService( - const std::string& cros_user) OVERRIDE; virtual TokenService* GetTokenService() OVERRIDE; - void InitSyncService(const std::string& cros_user); + void InitSyncService(); virtual ExtensionInfoMap* GetExtensionInfoMap() OVERRIDE; virtual PromoCounter* GetInstantPromoCounter() OVERRIDE; virtual ChromeURLDataManager* GetChromeURLDataManager() OVERRIDE; diff --git a/chrome/browser/sync/profile_sync_components_factory.h b/chrome/browser/sync/profile_sync_components_factory.h index efb5a98..ed4e91d 100644 --- a/chrome/browser/sync/profile_sync_components_factory.h +++ b/chrome/browser/sync/profile_sync_components_factory.h @@ -60,8 +60,7 @@ class ProfileSyncComponentsFactory { // caller. // TODO(tim): Bug 93922. Remove this method in favor of a // ProfileSyncServiceFactory singleton. - virtual ProfileSyncService* CreateProfileSyncService( - const std::string& cros_user) = 0; + virtual ProfileSyncService* CreateProfileSyncService() = 0; // Creates and registers enabled datatypes with the provided // ProfileSyncService. diff --git a/chrome/browser/sync/profile_sync_components_factory_impl.cc b/chrome/browser/sync/profile_sync_components_factory_impl.cc index 168d774..bdc557c 100644 --- a/chrome/browser/sync/profile_sync_components_factory_impl.cc +++ b/chrome/browser/sync/profile_sync_components_factory_impl.cc @@ -6,6 +6,7 @@ #include "chrome/browser/extensions/app_notification_manager.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/settings/settings_backend.h" +#include "chrome/browser/defaults.h" #include "chrome/browser/prefs/pref_model_associator.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search_engines/template_url_service.h" @@ -88,11 +89,25 @@ ProfileSyncComponentsFactoryImpl::ProfileSyncComponentsFactoryImpl( command_line_(command_line) { } -ProfileSyncService* ProfileSyncComponentsFactoryImpl::CreateProfileSyncService( - const std::string& cros_user) { - +ProfileSyncService* + ProfileSyncComponentsFactoryImpl::CreateProfileSyncService() { + ProfileSyncService::StartBehavior behavior = + browser_defaults::kSyncAutoStarts ? ProfileSyncService::AUTO_START + : ProfileSyncService::MANUAL_START; + + PrefService* prefs = profile_->GetPrefs(); + SigninManager* signin = new SigninManager(); + signin->SetAuthenticatedUsername(prefs->GetString( + prefs::kGoogleServicesUsername)); + + // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync + // is set up and *not* a browser restart for a manual-start platform (where + // sync has already been set up, and should be able to start without user + // intervention). We can get rid of the browser_default eventually, but + // need to take care that ProfileSyncService doesn't get tripped up between + // those two cases. Bug 88109. ProfileSyncService* pss = new ProfileSyncService( - this, profile_, new SigninManager(), cros_user); + this, profile_, signin, behavior); return pss; } diff --git a/chrome/browser/sync/profile_sync_components_factory_impl.h b/chrome/browser/sync/profile_sync_components_factory_impl.h index 5210469..5d3b4b5 100644 --- a/chrome/browser/sync/profile_sync_components_factory_impl.h +++ b/chrome/browser/sync/profile_sync_components_factory_impl.h @@ -22,8 +22,7 @@ class ProfileSyncComponentsFactoryImpl : public ProfileSyncComponentsFactory { virtual ~ProfileSyncComponentsFactoryImpl() {} // ProfileSyncComponentsFactory interface. - virtual ProfileSyncService* CreateProfileSyncService( - const std::string& cros_user) OVERRIDE; + virtual ProfileSyncService* CreateProfileSyncService() OVERRIDE; virtual void RegisterDataTypes(ProfileSyncService* pss) OVERRIDE; diff --git a/chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc b/chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc index fbb1c49..1ed8c5f 100644 --- a/chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc +++ b/chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc @@ -79,7 +79,7 @@ class ProfileSyncComponentsFactoryImplTest : public testing::Test { syncable::ModelType type) { command_line_->AppendSwitch(cmd_switch); scoped_ptr<ProfileSyncService> pss( - profile_sync_service_factory_->CreateProfileSyncService("")); + profile_sync_service_factory_->CreateProfileSyncService()); profile_sync_service_factory_->RegisterDataTypes(pss.get()); DataTypeController::StateMap controller_states; pss->GetDataTypeControllerStates(&controller_states); @@ -96,7 +96,7 @@ class ProfileSyncComponentsFactoryImplTest : public testing::Test { TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDefault) { scoped_ptr<ProfileSyncService> pss( - profile_sync_service_factory_->CreateProfileSyncService("")); + profile_sync_service_factory_->CreateProfileSyncService()); profile_sync_service_factory_->RegisterDataTypes(pss.get()); DataTypeController::StateMap controller_states; pss->GetDataTypeControllerStates(&controller_states); diff --git a/chrome/browser/sync/profile_sync_components_factory_mock.h b/chrome/browser/sync/profile_sync_components_factory_mock.h index ca7b2d1..126e1e8 100644 --- a/chrome/browser/sync/profile_sync_components_factory_mock.h +++ b/chrome/browser/sync/profile_sync_components_factory_mock.h @@ -24,8 +24,8 @@ class ProfileSyncComponentsFactoryMock : public ProfileSyncComponentsFactory { browser_sync::ChangeProcessor* change_processor); virtual ~ProfileSyncComponentsFactoryMock(); - MOCK_METHOD1(CreateProfileSyncService, - ProfileSyncService*(const std::string&)); + MOCK_METHOD0(CreateProfileSyncService, + ProfileSyncService*()); MOCK_METHOD1(RegisterDataTypes, void(ProfileSyncService*)); MOCK_METHOD2(CreateDataTypeManager, browser_sync::DataTypeManager*( diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index ec607a3..2ba31cc 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -107,14 +107,13 @@ bool ShouldShowActionOnUI( ProfileSyncService::ProfileSyncService(ProfileSyncComponentsFactory* factory, Profile* profile, SigninManager* signin_manager, - const std::string& cros_user) + StartBehavior start_behavior) : last_auth_error_(AuthError::None()), passphrase_required_reason_(sync_api::REASON_PASSPHRASE_NOT_REQUIRED), factory_(factory), profile_(profile), // |profile| may be NULL in unit tests. sync_prefs_(profile_ ? profile_->GetPrefs() : NULL), - cros_user_(cros_user), sync_service_url_(kDevServerUrl), backend_initialized_(false), is_auth_in_progress_(false), @@ -127,7 +126,7 @@ ProfileSyncService::ProfileSyncService(ProfileSyncComponentsFactory* factory, encrypted_types_(browser_sync::Cryptographer::SensitiveTypes()), encrypt_everything_(false), encryption_pending_(false), - auto_start_enabled_(false), + auto_start_enabled_(start_behavior == AUTO_START), failed_datatypes_handler_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { // By default, dev, canary, and unbranded Chromium users will go to the // development servers. Development servers have more features than standard @@ -142,10 +141,6 @@ ProfileSyncService::ProfileSyncService(ProfileSyncComponentsFactory* factory, sync_service_url_ = GURL(kSyncServerUrl); } - // TODO(atwilson): Set auto_start_enabled_ for other platforms that want this - // functionality. - if (!cros_user_.empty()) - auto_start_enabled_ = true; } ProfileSyncService::~ProfileSyncService() { @@ -164,7 +159,7 @@ bool ProfileSyncService::AreCredentialsAvailable( } // CrOS user is always logged in. Chrome uses signin_ to check logged in. - if (cros_user_.empty() && signin_->GetAuthenticatedUsername().empty()) + if (signin_->GetAuthenticatedUsername().empty()) return false; TokenService* token_service = profile()->GetTokenService(); @@ -291,8 +286,7 @@ void ProfileSyncService::InitSettings() { SyncCredentials ProfileSyncService::GetCredentials() { SyncCredentials credentials; - credentials.email = cros_user_.empty() ? - signin_->GetAuthenticatedUsername() : cros_user_; + credentials.email = signin_->GetAuthenticatedUsername(); DCHECK(!credentials.email.empty()); TokenService* service = profile_->GetTokenService(); credentials.sync_token = service->GetTokenForService( @@ -1466,7 +1460,7 @@ void ProfileSyncService::Observe(int type, } if (!sync_prefs_.IsStartSuppressed()) StartUp(); - } else if (cros_user_.empty() && + } else if (!auto_start_enabled_ && !signin_->GetAuthenticatedUsername().empty()) { // If not in auto-start / Chrome OS mode, and we have a username // without tokens, the user will need to signin again. NotifyObservers diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index 4b94fc5..5d47ee2 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -143,6 +143,11 @@ class ProfileSyncService : public browser_sync::SyncFrontend, CLEAR_SUCCEEDED = 4, }; + enum StartBehavior { + AUTO_START, + MANUAL_START, + }; + // Default sync server URL. static const char* kSyncServerUrl; // Sync server URL for dev channel users @@ -151,7 +156,7 @@ class ProfileSyncService : public browser_sync::SyncFrontend, ProfileSyncService(ProfileSyncComponentsFactory* factory, Profile* profile, SigninManager* signin, // Service takes ownership. - const std::string& cros_user); + StartBehavior start_behavior); virtual ~ProfileSyncService(); // Initializes the object. This should be called every time an object of this @@ -466,9 +471,8 @@ class ProfileSyncService : public browser_sync::SyncFrontend, bool ShouldPushChanges(); const GURL& sync_service_url() const { return sync_service_url_; } - SigninManager* signin() { return signin_.get(); } - const std::string& cros_user() const { return cros_user_; } bool auto_start_enabled() const { return auto_start_enabled_; } + SigninManager* signin() const { return signin_.get(); } // Stops the sync backend and sets the flag for suppressing sync startup. void StopAndSuppress(); @@ -600,9 +604,6 @@ class ProfileSyncService : public browser_sync::SyncFrontend, // preferences. browser_sync::SyncPrefs sync_prefs_; - // Email for the ChromiumOS user, if we're running under ChromiumOS. - std::string cros_user_; - // TODO(ncarter): Put this in a profile, once there is UI for it. // This specifies where to find the sync server. GURL sync_service_url_; @@ -690,7 +691,7 @@ class ProfileSyncService : public browser_sync::SyncFrontend, // credentials (user doesn't need to go through the startup flow). This is // typically enabled on platforms (like ChromeOS) that have their own // distinct signin flow. - bool auto_start_enabled_; + const bool auto_start_enabled_; scoped_ptr<browser_sync::BackendMigrator> migrator_; diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc index 1ec4cee..5b28ee5 100644 --- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc @@ -40,6 +40,7 @@ #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_test_util.h" #include "chrome/browser/sync/protocol/autofill_specifics.pb.h" +#include "chrome/browser/sync/signin_manager.h" #include "chrome/browser/sync/syncable/directory_manager.h" #include "chrome/browser/sync/syncable/model_type.h" #include "chrome/browser/sync/syncable/syncable.h" @@ -390,8 +391,15 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest { bool will_fail_association, syncable::ModelType type) { AbstractAutofillFactory* factory = GetFactory(type); - service_.reset(new TestProfileSyncService( - &factory_, &profile_, "test_user", false, callback)); + SigninManager* signin = new SigninManager(); + signin->SetAuthenticatedUsername("test_user"); + service_.reset( + new TestProfileSyncService(&factory_, + &profile_, + signin, + ProfileSyncService::AUTO_START, + false, + callback)); EXPECT_CALL(profile_, GetProfileSyncService()).WillRepeatedly( Return(service_.get())); DataTypeController* data_type_controller = diff --git a/chrome/browser/sync/profile_sync_service_harness.cc b/chrome/browser/sync/profile_sync_service_harness.cc index 1a8d3cb..1daaeec 100644 --- a/chrome/browser/sync/profile_sync_service_harness.cc +++ b/chrome/browser/sync/profile_sync_service_harness.cc @@ -151,7 +151,7 @@ bool ProfileSyncServiceHarness::SetupSync() { bool ProfileSyncServiceHarness::SetupSync( syncable::ModelTypeSet synced_datatypes) { // Initialize the sync client's profile sync service object. - service_ = profile_->GetProfileSyncService(""); + service_ = profile_->GetProfileSyncService(); if (service_ == NULL) { LOG(ERROR) << "SetupSync(): service_ is null."; return false; diff --git a/chrome/browser/sync/profile_sync_service_mock.cc b/chrome/browser/sync/profile_sync_service_mock.cc index 173a1a1..2682fd3 100644 --- a/chrome/browser/sync/profile_sync_service_mock.cc +++ b/chrome/browser/sync/profile_sync_service_mock.cc @@ -12,11 +12,17 @@ #include "chrome/test/base/testing_profile.h" ProfileSyncServiceMock::ProfileSyncServiceMock() - : ProfileSyncService(NULL, NULL, new SigninManager(), "") { + : ProfileSyncService(NULL, + NULL, + new SigninManager(), + ProfileSyncService::MANUAL_START) { } ProfileSyncServiceMock::ProfileSyncServiceMock( - Profile* profile) : ProfileSyncService(NULL, profile, NULL, "") { + Profile* profile) : ProfileSyncService(NULL, + profile, + NULL, + ProfileSyncService::MANUAL_START) { } ProfileSyncServiceMock::~ProfileSyncServiceMock() { diff --git a/chrome/browser/sync/profile_sync_service_password_unittest.cc b/chrome/browser/sync/profile_sync_service_password_unittest.cc index 47095173..fff8fdc 100644 --- a/chrome/browser/sync/profile_sync_service_password_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_password_unittest.cc @@ -28,6 +28,7 @@ #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_test_util.h" #include "chrome/browser/sync/protocol/password_specifics.pb.h" +#include "chrome/browser/sync/signin_manager.h" #include "chrome/browser/sync/syncable/directory_manager.h" #include "chrome/browser/sync/syncable/syncable.h" #include "chrome/browser/sync/test/engine/test_id_factory.h" @@ -128,11 +129,14 @@ class PasswordTestProfileSyncService : public TestProfileSyncService { PasswordTestProfileSyncService( ProfileSyncComponentsFactory* factory, Profile* profile, - const std::string& test_user, + SigninManager* signin, bool synchronous_backend_initialization, const base::Closure& initial_condition_setup_cb, const base::Closure& passphrase_accept_cb) - : TestProfileSyncService(factory, profile, test_user, + : TestProfileSyncService(factory, + profile, + signin, + ProfileSyncService::AUTO_START, synchronous_backend_initialization, initial_condition_setup_cb), callback_(passphrase_accept_cb) {} @@ -212,8 +216,10 @@ class ProfileSyncServicePasswordTest : public AbstractProfileSyncServiceTest { void StartSyncService(const base::Closure& root_callback, const base::Closure& node_callback) { if (!service_.get()) { + SigninManager* signin = new SigninManager(); + signin->SetAuthenticatedUsername("test_user"); service_.reset(new PasswordTestProfileSyncService( - &factory_, &profile_, "test_user", false, + &factory_, &profile_, signin, false, root_callback, node_callback)); syncable::ModelTypeSet preferred_types = service_->GetPreferredDataTypes(); diff --git a/chrome/browser/sync/profile_sync_service_preference_unittest.cc b/chrome/browser/sync/profile_sync_service_preference_unittest.cc index df71e98..9db995b 100644 --- a/chrome/browser/sync/profile_sync_service_preference_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_preference_unittest.cc @@ -29,6 +29,7 @@ #include "chrome/browser/sync/internal_api/write_transaction.h" #include "chrome/browser/sync/profile_sync_test_util.h" #include "chrome/browser/sync/protocol/preference_specifics.pb.h" +#include "chrome/browser/sync/signin_manager.h" #include "chrome/browser/sync/syncable/model_type.h" #include "chrome/browser/sync/test_profile_sync_service.h" #include "chrome/common/net/gaia/gaia_constants.h" @@ -119,8 +120,15 @@ class ProfileSyncServicePreferenceTest if (service_.get()) return false; + SigninManager* signin = new SigninManager(); + signin->SetAuthenticatedUsername("test"); service_.reset(new TestProfileSyncService( - &factory_, profile_.get(), "test", false, callback)); + &factory_, + profile_.get(), + signin, + ProfileSyncService::AUTO_START, + false, + callback)); pref_sync_service_ = reinterpret_cast<PrefModelAssociator*>( prefs_->GetSyncableService()); if (!pref_sync_service_) diff --git a/chrome/browser/sync/profile_sync_service_session_unittest.cc b/chrome/browser/sync/profile_sync_service_session_unittest.cc index f703126..9214e41 100644 --- a/chrome/browser/sync/profile_sync_service_session_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_session_unittest.cc @@ -32,6 +32,7 @@ #include "chrome/browser/sync/profile_sync_test_util.h" #include "chrome/browser/sync/protocol/session_specifics.pb.h" #include "chrome/browser/sync/protocol/sync.pb.h" +#include "chrome/browser/sync/signin_manager.h" #include "chrome/browser/sync/syncable/directory_manager.h" #include "chrome/browser/sync/syncable/model_type.h" #include "chrome/browser/sync/syncable/syncable.h" @@ -223,8 +224,15 @@ class ProfileSyncServiceSessionTest bool will_fail_association) { if (sync_service_.get()) return false; + SigninManager* signin = new SigninManager(); + signin->SetAuthenticatedUsername("test_user"); sync_service_.reset(new TestProfileSyncService( - &factory_, profile(), "test user", false, callback)); + &factory_, + profile(), + signin, + ProfileSyncService::AUTO_START, + false, + callback)); SessionServiceFactory::SetForTestProfile(profile(), helper_.service()); // Register the session data type. diff --git a/chrome/browser/sync/profile_sync_service_startup_unittest.cc b/chrome/browser/sync/profile_sync_service_startup_unittest.cc index 07812ce..5c4fd0d 100644 --- a/chrome/browser/sync/profile_sync_service_startup_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_startup_unittest.cc @@ -12,7 +12,7 @@ #include "chrome/browser/sync/glue/data_type_manager_mock.h" #include "chrome/browser/sync/profile_sync_components_factory_mock.h" #include "chrome/browser/sync/profile_sync_test_util.h" -#include "chrome/browser/sync/signin_manager.h" +#include "chrome/browser/sync/signin_manager_fake.h" #include "chrome/browser/sync/test_profile_sync_service.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/net/gaia/gaia_auth_consumer.h" @@ -66,8 +66,12 @@ class ProfileSyncServiceStartupTest : public testing::Test { protected: // Overridden below by ProfileSyncServiceStartupCrosTest. virtual void CreateSyncService() { - service_.reset(new TestProfileSyncService( - &factory_, profile_.get(), "", true, base::Closure())); + service_.reset(new TestProfileSyncService(&factory_, + profile_.get(), + new FakeSigninManager(), + ProfileSyncService::MANUAL_START, + true, + base::Closure())); } DataTypeManagerMock* SetUpDataTypeManager() { @@ -89,8 +93,14 @@ class ProfileSyncServiceStartupTest : public testing::Test { class ProfileSyncServiceStartupCrosTest : public ProfileSyncServiceStartupTest { protected: virtual void CreateSyncService() { - service_.reset(new TestProfileSyncService( - &factory_, profile_.get(), "test_user", true, base::Closure())); + SigninManager* signin = new SigninManager(); + signin->SetAuthenticatedUsername("test_user"); + service_.reset(new TestProfileSyncService(&factory_, + profile_.get(), + signin, + ProfileSyncService::AUTO_START, + true, + base::Closure())); } }; diff --git a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc index 82d5c64..8e6045b 100644 --- a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc @@ -33,6 +33,7 @@ #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_test_util.h" #include "chrome/browser/sync/protocol/typed_url_specifics.pb.h" +#include "chrome/browser/sync/signin_manager.h" #include "chrome/browser/sync/syncable/directory_manager.h" #include "chrome/browser/sync/test_profile_sync_service.h" #include "chrome/browser/sync/test/engine/test_id_factory.h" @@ -173,8 +174,14 @@ class ProfileSyncServiceTypedUrlTest : public AbstractProfileSyncServiceTest { void StartSyncService(const base::Closure& callback) { if (!service_.get()) { + SigninManager* signin = new SigninManager(); + signin->SetAuthenticatedUsername("test"); service_.reset( - new TestProfileSyncService(&factory_, &profile_, "test", false, + new TestProfileSyncService(&factory_, + &profile_, + signin, + ProfileSyncService::AUTO_START, + false, callback)); EXPECT_CALL(profile_, GetProfileSyncService()).WillRepeatedly( Return(service_.get())); diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index 1b824db..1e93d89 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -12,6 +12,7 @@ #include "chrome/browser/sync/js/js_arg_list.h" #include "chrome/browser/sync/js/js_event_details.h" #include "chrome/browser/sync/js/js_test_util.h" +#include "chrome/browser/sync/signin_manager.h" #include "chrome/browser/sync/profile_sync_components_factory_mock.h" #include "chrome/browser/sync/test_profile_sync_service.h" #include "chrome/common/chrome_version_info.h" @@ -87,9 +88,14 @@ class ProfileSyncServiceTest : public testing::Test { bool sync_setup_completed, bool expect_create_dtm) { if (!service_.get()) { - // Set bootstrap to true and it will provide a logged in user for test - service_.reset(new TestProfileSyncService( - &factory_, profile_.get(), "test", true, base::Closure())); + SigninManager* signin = new SigninManager(); + signin->SetAuthenticatedUsername("test"); + service_.reset(new TestProfileSyncService(&factory_, + profile_.get(), + signin, + ProfileSyncService::AUTO_START, + true, + base::Closure())); if (!set_initial_sync_ended) service_->dont_set_initial_sync_ended_on_init(); if (synchronous_sync_configuration) @@ -131,8 +137,12 @@ class ProfileSyncServiceTest : public testing::Test { }; TEST_F(ProfileSyncServiceTest, InitialState) { - service_.reset(new TestProfileSyncService( - &factory_, profile_.get(), "", true, base::Closure())); + service_.reset(new TestProfileSyncService(&factory_, + profile_.get(), + new SigninManager(), + ProfileSyncService::MANUAL_START, + true, + base::Closure())); EXPECT_TRUE( service_->sync_service_url().spec() == ProfileSyncService::kSyncServerUrl || @@ -144,15 +154,25 @@ TEST_F(ProfileSyncServiceTest, DisabledByPolicy) { profile_->GetTestingPrefService()->SetManagedPref( prefs::kSyncManaged, Value::CreateBooleanValue(true)); - service_.reset(new TestProfileSyncService( - &factory_, profile_.get(), "", true, base::Closure())); + service_.reset(new TestProfileSyncService(&factory_, + profile_.get(), + new SigninManager(), + ProfileSyncService::MANUAL_START, + true, + base::Closure())); service_->Initialize(); EXPECT_TRUE(service_->IsManaged()); } TEST_F(ProfileSyncServiceTest, AbortedByShutdown) { - service_.reset(new TestProfileSyncService( - &factory_, profile_.get(), "test", true, base::Closure())); + SigninManager* signin = new SigninManager(); + signin->SetAuthenticatedUsername("test"); + service_.reset(new TestProfileSyncService(&factory_, + profile_.get(), + signin, + ProfileSyncService::AUTO_START, + true, + base::Closure())); EXPECT_CALL(factory_, CreateDataTypeManager(_, _)).Times(0); EXPECT_CALL(factory_, CreateBookmarkSyncComponents(_, _)).Times(0); service_->RegisterDataTypeController( @@ -165,8 +185,14 @@ TEST_F(ProfileSyncServiceTest, AbortedByShutdown) { } TEST_F(ProfileSyncServiceTest, DisableAndEnableSyncTemporarily) { - service_.reset(new TestProfileSyncService( - &factory_, profile_.get(), "test", true, base::Closure())); + SigninManager* signin = new SigninManager(); + signin->SetAuthenticatedUsername("test"); + service_.reset(new TestProfileSyncService(&factory_, + profile_.get(), + signin, + ProfileSyncService::AUTO_START, + true, + base::Closure())); // Register the bookmark data type. EXPECT_CALL(factory_, CreateDataTypeManager(_, _)). WillRepeatedly(ReturnNewDataTypeManager()); diff --git a/chrome/browser/sync/signin_manager.cc b/chrome/browser/sync/signin_manager.cc index 2b16430..d0115ab 100644 --- a/chrome/browser/sync/signin_manager.cc +++ b/chrome/browser/sync/signin_manager.cc @@ -77,7 +77,7 @@ void SigninManager::SetAuthenticatedUsername(const std::string& username) { authenticated_username_ = username; // TODO(tim): We could go further in ensuring kGoogleServicesUsername and // authenticated_username_ are consistent once established (e.g. remove - // authenticated_username_ altogether). + // authenticated_username_ altogether). Bug 107160. } void SigninManager::PrepareForSignin() { diff --git a/chrome/browser/sync/signin_manager_fake.cc b/chrome/browser/sync/signin_manager_fake.cc new file mode 100644 index 0000000..da486f9 --- /dev/null +++ b/chrome/browser/sync/signin_manager_fake.cc @@ -0,0 +1,16 @@ +// Copyright (c) 2011 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/sync/signin_manager_fake.h" + +FakeSigninManager::FakeSigninManager() {} + +FakeSigninManager::~FakeSigninManager() {} + +void FakeSigninManager::StartSignIn(const std::string& username, + const std::string& password, + const std::string& login_token, + const std::string& login_captcha) { + SetAuthenticatedUsername(username); +} diff --git a/chrome/browser/sync/signin_manager_fake.h b/chrome/browser/sync/signin_manager_fake.h new file mode 100644 index 0000000..563bc02 --- /dev/null +++ b/chrome/browser/sync/signin_manager_fake.h @@ -0,0 +1,27 @@ +// Copyright (c) 2011 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_SYNC_SIGNIN_MANAGER_FAKE_H_ +#define CHROME_BROWSER_SYNC_SIGNIN_MANAGER_FAKE_H_ +#pragma once + +#include <string> + +#include "base/compiler_specific.h" +#include "chrome/browser/sync/signin_manager.h" + +// A signin manager that bypasses actual authentication routines with servers +// and accepts the credentials provided to StartSignIn. +class FakeSigninManager : public SigninManager { + public: + FakeSigninManager(); + virtual ~FakeSigninManager(); + + virtual void StartSignIn(const std::string& username, + const std::string& password, + const std::string& login_token, + const std::string& login_captcha) OVERRIDE; +}; + +#endif // CHROME_BROWSER_SYNC_SIGNIN_MANAGER_FAKE_H_ diff --git a/chrome/browser/sync/sync_setup_flow.h b/chrome/browser/sync/sync_setup_flow.h index 4fb9a93..7939f0f 100644 --- a/chrome/browser/sync/sync_setup_flow.h +++ b/chrome/browser/sync/sync_setup_flow.h @@ -118,6 +118,7 @@ class SyncSetupFlow { FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, CrosAuthSetup); FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, ShowErrorUIForPasswordTest); FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, ShowErrorUIForPassphraseTest); + FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardCrosTest, CrosAuthSetup); // Use static Run method to get an instance. SyncSetupFlow(SyncSetupWizard::State start_state, diff --git a/chrome/browser/sync/sync_setup_wizard.cc b/chrome/browser/sync/sync_setup_wizard.cc index 23698b8..80d892f 100644 --- a/chrome/browser/sync/sync_setup_wizard.cc +++ b/chrome/browser/sync/sync_setup_wizard.cc @@ -68,8 +68,9 @@ void SyncSetupWizard::Step(State advance_state) { return; // No flow is in progress, and we have never escorted the user all the // way through the wizard flow. + // TODO(atwilson): Make sure this works on all autostart_enabled platforms. State end_state = DONE; - if (!service_->cros_user().empty() && + if (service_->auto_start_enabled() && !service_->profile()->GetPrefs()->GetBoolean( prefs::kSyncSuppressStart)) { end_state = GAIA_SUCCESS; diff --git a/chrome/browser/sync/sync_setup_wizard_unittest.cc b/chrome/browser/sync/sync_setup_wizard_unittest.cc index f183880..82efb73 100644 --- a/chrome/browser/sync/sync_setup_wizard_unittest.cc +++ b/chrome/browser/sync/sync_setup_wizard_unittest.cc @@ -61,8 +61,9 @@ class MockSyncSetupHandler : public OptionsSyncSetupHandler { class ProfileSyncServiceForWizardTest : public ProfileSyncService { public: ProfileSyncServiceForWizardTest(ProfileSyncComponentsFactory* factory, - Profile* profile) - : ProfileSyncService(factory, profile, new SigninManager(), ""), + Profile* profile, + ProfileSyncService::StartBehavior behavior) + : ProfileSyncService(factory, profile, new SigninManager(), behavior), user_cancelled_dialog_(false), is_using_secondary_passphrase_(false), encrypt_everything_(false) { @@ -144,11 +145,6 @@ class ProfileSyncServiceForWizardTest : public ProfileSyncService { chosen_data_types_.Clear(); } - // Use this to have the service act as if it were running under CrOS. - void set_cros_mode() { - cros_user_ = kTestUser; - } - virtual void ShowSyncSetup(const std::string& sub_page) { // Do Nothing. } @@ -178,8 +174,10 @@ class ProfileSyncServiceForWizardTest : public ProfileSyncService { class TestingProfileWithSyncService : public TestingProfile { public: - TestingProfileWithSyncService() { - sync_service_.reset(new ProfileSyncServiceForWizardTest(&factory_, this)); + explicit TestingProfileWithSyncService( + ProfileSyncService::StartBehavior behavior) { + sync_service_.reset(new ProfileSyncServiceForWizardTest( + &factory_, this, behavior)); } virtual ProfileSyncService* GetProfileSyncService() { @@ -199,8 +197,12 @@ class SyncSetupWizardTest : public BrowserWithTestWindowTest { service_(NULL), flow_(NULL) {} virtual ~SyncSetupWizardTest() {} + virtual TestingProfile* BuildProfile() { + return new TestingProfileWithSyncService( + ProfileSyncService::MANUAL_START); + } virtual void SetUp() { - set_profile(new TestingProfileWithSyncService()); + set_profile(BuildProfile()); profile()->CreateBookmarkModel(false); // Wait for the bookmarks model to load. profile()->BlockUntilBookmarkModelLoaded(); @@ -528,34 +530,6 @@ TEST_F(SyncSetupWizardTest, DiscreteRunGaiaLogin) { wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); } -// Tests a scenario where sync is disabled on chrome os on startup due to -// an auth error (application specific password is needed). -TEST_F(SyncSetupWizardTest, CrosAuthSetup) { - service_->set_cros_mode(); - - wizard_->Step(SyncSetupWizard::GAIA_LOGIN); - - AttachSyncSetupHandler(); - EXPECT_EQ(SyncSetupWizard::GAIA_SUCCESS, flow_->end_state_); - - DictionaryValue dialog_args; - SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args); - EXPECT_EQ(4U, dialog_args.size()); - std::string actual_user; - dialog_args.GetString("user", &actual_user); - EXPECT_EQ(kTestUser, actual_user); - int error = -1; - dialog_args.GetInteger("error", &error); - EXPECT_EQ(0, error); - bool editable = true; - dialog_args.GetBoolean("editable_user", &editable); - EXPECT_FALSE(editable); - wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); - EXPECT_TRUE(service_->user_cancelled_dialog_); - EXPECT_TRUE(service_->profile()->GetPrefs()->GetBoolean( - prefs::kSyncHasSetupCompleted)); -} - TEST_F(SyncSetupWizardTest, NonFatalError) { CompleteSetup(); @@ -621,3 +595,40 @@ TEST_F(SyncSetupWizardTest, NonFatalError) { CloseSetupUI(); EXPECT_FALSE(wizard_->IsVisible()); } + +class SyncSetupWizardCrosTest : public SyncSetupWizardTest { + public: + virtual TestingProfile* BuildProfile() { + TestingProfile* profile = + new TestingProfileWithSyncService(ProfileSyncService::AUTO_START); + profile->GetProfileSyncService()->signin()->SetAuthenticatedUsername( + kTestUser); + return profile; + } +}; + +// Tests a scenario where sync is disabled on chrome os on startup due to +// an auth error (application specific password is needed). +TEST_F(SyncSetupWizardCrosTest, CrosAuthSetup) { + wizard_->Step(SyncSetupWizard::GAIA_LOGIN); + + AttachSyncSetupHandler(); + EXPECT_EQ(SyncSetupWizard::GAIA_SUCCESS, flow_->end_state_); + + DictionaryValue dialog_args; + SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args); + EXPECT_EQ(4U, dialog_args.size()); + std::string actual_user; + dialog_args.GetString("user", &actual_user); + EXPECT_EQ(kTestUser, actual_user); + int error = -1; + dialog_args.GetInteger("error", &error); + EXPECT_EQ(0, error); + bool editable = true; + dialog_args.GetBoolean("editable_user", &editable); + EXPECT_FALSE(editable); + wizard_->Step(SyncSetupWizard::GAIA_SUCCESS); + EXPECT_TRUE(service_->user_cancelled_dialog_); + EXPECT_TRUE(service_->profile()->GetPrefs()->GetBoolean( + prefs::kSyncHasSetupCompleted)); +} diff --git a/chrome/browser/sync/test/integration/passwords_helper.cc b/chrome/browser/sync/test/integration/passwords_helper.cc index 792c0dc..e14e078 100644 --- a/chrome/browser/sync/test/integration/passwords_helper.cc +++ b/chrome/browser/sync/test/integration/passwords_helper.cc @@ -105,7 +105,7 @@ void RemoveLogins(PasswordStore* store) { } void SetPassphrase(int index, const std::string& passphrase) { - test()->GetProfile(index)->GetProfileSyncService("")->SetPassphrase( + test()->GetProfile(index)->GetProfileSyncService()->SetPassphrase( passphrase, true); } diff --git a/chrome/browser/sync/test_profile_sync_service.cc b/chrome/browser/sync/test_profile_sync_service.cc index 8813e0b..d126831 100644 --- a/chrome/browser/sync/test_profile_sync_service.cc +++ b/chrome/browser/sync/test_profile_sync_service.cc @@ -27,23 +27,6 @@ using syncable::ModelType; using syncable::ScopedDirLookup; using sync_api::UserShare; -namespace { - -class FakeSigninManager : public SigninManager { - public: - FakeSigninManager() {} - virtual ~FakeSigninManager() {} - - virtual void StartSignIn(const std::string& username, - const std::string& password, - const std::string& login_token, - const std::string& login_captcha) OVERRIDE { - SetAuthenticatedUsername(username); - } -}; - -} // namespace - namespace browser_sync { SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest( @@ -141,10 +124,14 @@ browser_sync::SyncBackendHostForProfileSyncTest* TestProfileSyncService::TestProfileSyncService( ProfileSyncComponentsFactory* factory, Profile* profile, - const std::string& test_user, + SigninManager* signin, + ProfileSyncService::StartBehavior behavior, bool synchronous_backend_initialization, const base::Closure& callback) - : ProfileSyncService(factory, profile, new FakeSigninManager(), test_user), + : ProfileSyncService(factory, + profile, + signin, + behavior), synchronous_backend_initialization_( synchronous_backend_initialization), synchronous_sync_configuration_(false), @@ -152,7 +139,6 @@ TestProfileSyncService::TestProfileSyncService( set_initial_sync_ended_on_init_(true), fail_initial_download_(false) { SetSyncSetupCompleted(); - signin_->SetAuthenticatedUsername(test_user); } TestProfileSyncService::~TestProfileSyncService() {} diff --git a/chrome/browser/sync/test_profile_sync_service.h b/chrome/browser/sync/test_profile_sync_service.h index 9eea551..696a110 100644 --- a/chrome/browser/sync/test_profile_sync_service.h +++ b/chrome/browser/sync/test_profile_sync_service.h @@ -65,9 +65,12 @@ class TestProfileSyncService : public ProfileSyncService { public: // |callback| can be used to populate nodes before the OnBackendInitialized // callback fires. + // TODO(tim): Remove |synchronous_backend_initialization|, and add ability to + // inject TokenService alongside SigninManager. TestProfileSyncService(ProfileSyncComponentsFactory* factory, Profile* profile, - const std::string& test_user, + SigninManager* signin, + ProfileSyncService::StartBehavior behavior, bool synchronous_backend_initialization, const base::Closure& callback); diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index dba9f59..de18c23 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1696,6 +1696,8 @@ 'browser/sync/profile_sync_service_unittest.cc', 'browser/sync/profile_sync_test_util.cc', 'browser/sync/profile_sync_test_util.h', + 'browser/sync/signin_manager_fake.cc', + 'browser/sync/signin_manager_fake.h', 'browser/sync/signin_manager_unittest.cc', 'browser/sync/sync_global_error_unittest.cc', 'browser/sync/sync_prefs_unittest.cc', diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index d9c1876..82d94bf 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc @@ -798,11 +798,6 @@ TokenService* TestingProfile::GetTokenService() { } ProfileSyncService* TestingProfile::GetProfileSyncService() { - return GetProfileSyncService(""); -} - -ProfileSyncService* TestingProfile::GetProfileSyncService( - const std::string& cros_user) { if (!profile_sync_service_.get()) { // Use a NiceMock here since we are really using the mock as a // fake. Test cases that want to set expectations on a diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h index 7054284..ac67eaa 100644 --- a/chrome/test/base/testing_profile.h +++ b/chrome/test/base/testing_profile.h @@ -284,8 +284,6 @@ class TestingProfile : public Profile { // Creates and initializes a profile sync service if the tests require one. virtual TokenService* GetTokenService() OVERRIDE; virtual ProfileSyncService* GetProfileSyncService() OVERRIDE; - virtual ProfileSyncService* GetProfileSyncService( - const std::string& cros_notes) OVERRIDE; virtual ChromeBlobStorageContext* GetBlobStorageContext() OVERRIDE; virtual ExtensionInfoMap* GetExtensionInfoMap() OVERRIDE; virtual PromoCounter* GetInstantPromoCounter() OVERRIDE; |