Commit 5ad5b933 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Clean up launched feature RecoverPasswordsForSyncUsers

Bug: none
Change-Id: I93bab47f0dd609e8f71c9427f8ae2821e995193e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1868953Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707334}
parent 86fcd8f9
...@@ -172,9 +172,7 @@ bool AreLocalAndRemotePasswordsEqual( ...@@ -172,9 +172,7 @@ bool AreLocalAndRemotePasswordsEqual(
} }
bool ShouldRecoverPasswordsDuringMerge() { bool ShouldRecoverPasswordsDuringMerge() {
return base::FeatureList::IsEnabled( return !base::FeatureList::IsEnabled(features::kDeleteCorruptedPasswords);
features::kRecoverPasswordsForSyncUsers) &&
!base::FeatureList::IsEnabled(features::kDeleteCorruptedPasswords);
} }
// A simple class for scoping a password store sync transaction. If the // A simple class for scoping a password store sync transaction. If the
......
...@@ -452,9 +452,7 @@ void PasswordSyncableService::CreateOrUpdateEntry( ...@@ -452,9 +452,7 @@ void PasswordSyncableService::CreateOrUpdateEntry(
} }
bool PasswordSyncableService::ShouldRecoverPasswordsDuringMerge() const { bool PasswordSyncableService::ShouldRecoverPasswordsDuringMerge() const {
return base::FeatureList::IsEnabled( return !base::FeatureList::IsEnabled(features::kDeleteCorruptedPasswords);
features::kRecoverPasswordsForSyncUsers) &&
!base::FeatureList::IsEnabled(features::kDeleteCorruptedPasswords);
} }
syncer::SyncData SyncDataFromPassword( syncer::SyncData SyncDataFromPassword(
......
...@@ -88,14 +88,8 @@ class PasswordSyncableService : public syncer::SyncableService { ...@@ -88,14 +88,8 @@ class PasswordSyncableService : public syncer::SyncableService {
// Returns true if corrupted passwords should be deleted from the local // Returns true if corrupted passwords should be deleted from the local
// database when merging data. // database when merging data.
// There are two features that handle recovering lost passwords. // This is true if the feature DeleteCorruptedPasswords is disabled, as it
// RecoverPasswordsForSyncUsers recovers passwords for sync users when merging // recovers both Sync and non-Sync users internally in LoginDatabase.
// data with Sync. If that feature is disabled, this method returns false.
// Other feature, DeleteCorruptedPasswords, is introduced after the first
// feature and recovers both Sync and non-Sync users internally in
// LoginDatabase. When that feature is enabled, this method returns false.
// After launching DeleteCorruptedPasswords, RecoverPasswordsForSyncUsers
// and related code is to be cleaned up.
bool ShouldRecoverPasswordsDuringMerge() const; bool ShouldRecoverPasswordsDuringMerge() const;
// The factory that creates sync errors. |SyncError| has rich data // The factory that creates sync errors. |SyncError| has rich data
......
...@@ -518,10 +518,8 @@ TEST_F(PasswordSyncableServiceTest, FailedReadFromPasswordStore) { ...@@ -518,10 +518,8 @@ TEST_F(PasswordSyncableServiceTest, FailedReadFromPasswordStore) {
syncer::PASSWORDS); syncer::PASSWORDS);
EXPECT_CALL(*password_store(), FillAutofillableLogins(_)) EXPECT_CALL(*password_store(), FillAutofillableLogins(_))
.WillOnce(Return(false)); .WillOnce(Return(false));
if (base::FeatureList::IsEnabled(features::kRecoverPasswordsForSyncUsers)) {
EXPECT_CALL(*password_store(), DeleteUndecryptableLogins()) EXPECT_CALL(*password_store(), DeleteUndecryptableLogins())
.WillOnce(Return(DatabaseCleanupResult::kDatabaseUnavailable)); .WillOnce(Return(DatabaseCleanupResult::kDatabaseUnavailable));
}
EXPECT_CALL(*error_factory, CreateAndUploadError(_, _)) EXPECT_CALL(*error_factory, CreateAndUploadError(_, _))
.WillOnce(Return(error)); .WillOnce(Return(error));
// ActOnPasswordStoreChanges() below shouldn't generate any changes for Sync. // ActOnPasswordStoreChanges() below shouldn't generate any changes for Sync.
...@@ -539,37 +537,13 @@ TEST_F(PasswordSyncableServiceTest, FailedReadFromPasswordStore) { ...@@ -539,37 +537,13 @@ TEST_F(PasswordSyncableServiceTest, FailedReadFromPasswordStore) {
service()->ActOnPasswordStoreChanges(list); service()->ActOnPasswordStoreChanges(list);
} }
// Disable feature for deleting undecryptable logins. // Test that passwords are recovered for Sync users using the older logic (i.e.
TEST_F(PasswordSyncableServiceTest, RecoverPasswordsForSyncUsersDisabled) { // recover passwords only for Sync users) when the feature for deleting
// corrupted passwords for all users is disabled.
TEST_F(PasswordSyncableServiceTest, RecoverPasswordsOnlyForSyncUsers) {
base::test::ScopedFeatureList scoped_feature_list; base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature( scoped_feature_list.InitAndDisableFeature(
features::kRecoverPasswordsForSyncUsers); features::kDeleteCorruptedPasswords);
auto error_factory = std::make_unique<syncer::SyncErrorFactoryMock>();
syncer::SyncError error(FROM_HERE, syncer::SyncError::DATATYPE_ERROR,
"Failed to get passwords from store.",
syncer::PASSWORDS);
EXPECT_CALL(*error_factory, CreateAndUploadError(_, _))
.WillOnce(Return(error));
EXPECT_CALL(*password_store(), FillAutofillableLogins(_))
.WillOnce(Return(false));
EXPECT_CALL(*password_store(), DeleteUndecryptableLogins()).Times(0);
syncer::SyncMergeResult result = service()->MergeDataAndStartSyncing(
syncer::PASSWORDS, SyncDataList(), std::move(processor_),
std::move(error_factory));
EXPECT_TRUE(result.error().IsSet());
}
// Test that passwords are recovered for Sync users using the older feature
// (kRecoverPasswordsForSyncUsers) when feature for recovering passwords for
// Sync users is enabled, while feature for deleting corrupted passwords for
// all users is disabled.
TEST_F(PasswordSyncableServiceTest, RecoverPasswordsForSyncUsersEnabled) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures(
{features::kRecoverPasswordsForSyncUsers},
{features::kDeleteCorruptedPasswords});
EXPECT_CALL(*processor_, ProcessSyncChanges(_, IsEmpty())); EXPECT_CALL(*processor_, ProcessSyncChanges(_, IsEmpty()));
EXPECT_CALL(*password_store(), FillAutofillableLogins(_)) EXPECT_CALL(*password_store(), FillAutofillableLogins(_))
...@@ -585,15 +559,11 @@ TEST_F(PasswordSyncableServiceTest, RecoverPasswordsForSyncUsersEnabled) { ...@@ -585,15 +559,11 @@ TEST_F(PasswordSyncableServiceTest, RecoverPasswordsForSyncUsersEnabled) {
EXPECT_FALSE(result.error().IsSet()); EXPECT_FALSE(result.error().IsSet());
} }
// Test that passwords are not recovered using the older feature // Test that passwords are not recovered when merging data if the feature for
// (kRecoverPasswordForSyncUsers) when merging data if both features for // deleting passwords for all users is enabled.
// recovering passwords for Sync users and deleting passwords for all users
// are enabled.
TEST_F(PasswordSyncableServiceTest, PasswordRecoveryForAllUsersEnabled) { TEST_F(PasswordSyncableServiceTest, PasswordRecoveryForAllUsersEnabled) {
base::test::ScopedFeatureList scoped_feature_list; base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures({features::kRecoverPasswordsForSyncUsers, scoped_feature_list.InitAndEnableFeature(features::kDeleteCorruptedPasswords);
features::kDeleteCorruptedPasswords},
{});
auto error_factory = std::make_unique<syncer::SyncErrorFactoryMock>(); auto error_factory = std::make_unique<syncer::SyncErrorFactoryMock>();
syncer::SyncError error(FROM_HERE, syncer::SyncError::DATATYPE_ERROR, syncer::SyncError error(FROM_HERE, syncer::SyncError::DATATYPE_ERROR,
...@@ -622,9 +592,8 @@ TEST_F(PasswordSyncableServiceTest, PasswordRecoveryForAllUsersEnabled) { ...@@ -622,9 +592,8 @@ TEST_F(PasswordSyncableServiceTest, PasswordRecoveryForAllUsersEnabled) {
#endif #endif
TEST_F(PasswordSyncableServiceTest, MAYBE_FailedDeleteUndecryptableLogins) { TEST_F(PasswordSyncableServiceTest, MAYBE_FailedDeleteUndecryptableLogins) {
base::test::ScopedFeatureList scoped_feature_list; base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures( scoped_feature_list.InitAndDisableFeature(
{features::kRecoverPasswordsForSyncUsers}, features::kDeleteCorruptedPasswords);
{features::kDeleteCorruptedPasswords});
auto error_factory = std::make_unique<syncer::SyncErrorFactoryMock>(); auto error_factory = std::make_unique<syncer::SyncErrorFactoryMock>();
syncer::SyncError error( syncer::SyncError error(
FROM_HERE, syncer::SyncError::DATATYPE_ERROR, FROM_HERE, syncer::SyncError::DATATYPE_ERROR,
......
...@@ -75,11 +75,6 @@ const base::Feature kPasswordManagerOnboardingAndroid = { ...@@ -75,11 +75,6 @@ const base::Feature kPasswordManagerOnboardingAndroid = {
const base::Feature kPasswordSaveIllustration = { const base::Feature kPasswordSaveIllustration = {
"SavePasswordIllustration", base::FEATURE_DISABLED_BY_DEFAULT}; "SavePasswordIllustration", base::FEATURE_DISABLED_BY_DEFAULT};
// Deletes entries from local database on Mac which cannot be decrypted when
// merging data with Sync.
const base::Feature kRecoverPasswordsForSyncUsers = {
"RecoverPasswordsForSyncUsers", base::FEATURE_ENABLED_BY_DEFAULT};
// Enables support of filling and saving on username first flow. // Enables support of filling and saving on username first flow.
const base::Feature kUsernameFirstFlow = {"UsernameFirstFlow", const base::Feature kUsernameFirstFlow = {"UsernameFirstFlow",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
......
...@@ -31,7 +31,6 @@ extern const base::Feature kPasswordEditingAndroid; ...@@ -31,7 +31,6 @@ extern const base::Feature kPasswordEditingAndroid;
extern const base::Feature kPasswordImport; extern const base::Feature kPasswordImport;
extern const base::Feature kPasswordManagerOnboardingAndroid; extern const base::Feature kPasswordManagerOnboardingAndroid;
extern const base::Feature kPasswordSaveIllustration; extern const base::Feature kPasswordSaveIllustration;
extern const base::Feature kRecoverPasswordsForSyncUsers;
extern const base::Feature kUsernameFirstFlow; extern const base::Feature kUsernameFirstFlow;
extern const base::Feature kStickyBubble; extern const base::Feature kStickyBubble;
......
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