diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-08 21:31:15 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-08 21:31:15 +0000 |
commit | 3a5cdfd9006d5da89f0b9464d6a2ffd2d8146f56 (patch) | |
tree | 2c60196e9527fed005ad61cccf828a13a0d9b191 /chrome/browser/sync/profile_sync_service_startup_unittest.cc | |
parent | d0bb80d8f7aeccf84b68b4f200b27a75f009670e (diff) | |
download | chromium_src-3a5cdfd9006d5da89f0b9464d6a2ffd2d8146f56.zip chromium_src-3a5cdfd9006d5da89f0b9464d6a2ffd2d8146f56.tar.gz chromium_src-3a5cdfd9006d5da89f0b9464d6a2ffd2d8146f56.tar.bz2 |
[Sync] Fix handling of passphrase required events.
REASON_ENCRYPTION and REASON_DECRYPTION should both result in the user
being prompted for a passphrase if encrypted datatypes are enabled. Modified
IsPassphraseRequiredForDecryption to account for this (and added todo to rename
it). Currently REASON_ENCRYPTION will never result in the user being prompted
for a passphrase, even if we know the user has encrypted datatypes they will
not be able to encrypt.
In addition, we should only ever need to unblock the DTM if an encrypted type
is enabled. In that case, the passphrase must have been accepted. Cases where
encrypted datatypes are not enabled (which is the only way we accept not having a
valid passphrase now) do not need to unblock the DTM, and if the user disables
an encrypted type it will trigger a reconfiguration organically.
Because we can only automatically enter a passphrase twice (for the two cached
passphrases), and only one of these will succeed anyways, we no longer have the
possibility of infinite configuration loops.
BUG=102757
TEST=Manually forcing a migration on the same sync cycle
we are downloading a new datatype doesn't trigger infinite sync loops.
Review URL: http://codereview.chromium.org/8423066
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109106 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/profile_sync_service_startup_unittest.cc')
-rw-r--r-- | chrome/browser/sync/profile_sync_service_startup_unittest.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/chrome/browser/sync/profile_sync_service_startup_unittest.cc b/chrome/browser/sync/profile_sync_service_startup_unittest.cc index 400ffcc..9884efc 100644 --- a/chrome/browser/sync/profile_sync_service_startup_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_startup_unittest.cc @@ -134,10 +134,9 @@ TEST_F(ProfileSyncServiceStartupTest, StartFirstTime) { TEST_F(ProfileSyncServiceStartupCrosTest, StartFirstTime) { DataTypeManagerMock* data_type_manager = SetUpDataTypeManager(); profile_->GetPrefs()->ClearPref(prefs::kSyncHasSetupCompleted); - EXPECT_CALL(*data_type_manager, Configure(_, _)).Times(2); + EXPECT_CALL(*data_type_manager, Configure(_, _)); EXPECT_CALL(*data_type_manager, state()). - WillOnce(Return(DataTypeManager::CONFIGURED)). - WillOnce(Return(DataTypeManager::CONFIGURED)); + WillRepeatedly(Return(DataTypeManager::CONFIGURED)); EXPECT_CALL(*data_type_manager, Stop()).Times(1); EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); @@ -149,9 +148,9 @@ TEST_F(ProfileSyncServiceStartupCrosTest, StartFirstTime) { TEST_F(ProfileSyncServiceStartupTest, StartNormal) { DataTypeManagerMock* data_type_manager = SetUpDataTypeManager(); - EXPECT_CALL(*data_type_manager, Configure(_, _)).Times(2); + EXPECT_CALL(*data_type_manager, Configure(_, _)); EXPECT_CALL(*data_type_manager, state()). - WillOnce(Return(DataTypeManager::CONFIGURED)); + WillRepeatedly(Return(DataTypeManager::CONFIGURED)); EXPECT_CALL(*data_type_manager, Stop()).Times(1); EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); @@ -179,7 +178,7 @@ TEST_F(ProfileSyncServiceStartupTest, ManagedStartup) { TEST_F(ProfileSyncServiceStartupTest, SwitchManaged) { DataTypeManagerMock* data_type_manager = SetUpDataTypeManager(); - EXPECT_CALL(*data_type_manager, Configure(_, _)).Times(2); + EXPECT_CALL(*data_type_manager, Configure(_, _)); EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); profile_->GetTokenService()->IssueAuthTokenForTest( @@ -205,7 +204,7 @@ TEST_F(ProfileSyncServiceStartupTest, SwitchManaged) { TEST_F(ProfileSyncServiceStartupTest, ClearServerData) { DataTypeManagerMock* data_type_manager = SetUpDataTypeManager(); - EXPECT_CALL(*data_type_manager, Configure(_, _)).Times(2); + EXPECT_CALL(*data_type_manager, Configure(_, _)).Times(1); EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); profile_->GetTokenService()->IssueAuthTokenForTest( |