| Index: components/password_manager/core/browser/password_syncable_service_unittest.cc
|
| diff --git a/components/password_manager/core/browser/password_syncable_service_unittest.cc b/components/password_manager/core/browser/password_syncable_service_unittest.cc
|
| index b64dcb4b1ad4bcf37b2f5541850d1c19f6e93e35..df5d17f0d98626aaf5c15f6fa3938b96c686c1b5 100644
|
| --- a/components/password_manager/core/browser/password_syncable_service_unittest.cc
|
| +++ b/components/password_manager/core/browser/password_syncable_service_unittest.cc
|
| @@ -82,6 +82,25 @@ SyncChange CreateSyncChange(const autofill::PasswordForm& password,
|
| return SyncChange(FROM_HERE, type, data);
|
| }
|
|
|
| +class FormFinder {
|
| + public:
|
| + explicit FormFinder(const autofill::PasswordForm& form) : form_(form) {}
|
| + ~FormFinder() {}
|
| +
|
| + bool operator()(const autofill::PasswordForm& form) const;
|
| +
|
| + private:
|
| + const autofill::PasswordForm form_;
|
| +};
|
| +
|
| +bool FormFinder::operator()(const autofill::PasswordForm& form) const {
|
| + return form.origin == form_.origin &&
|
| + form.username_element == form_.username_element &&
|
| + form.username_value == form_.username_value &&
|
| + form.password_element == form_.password_element &&
|
| + form.signon_realm == form_.signon_realm;
|
| +}
|
| +
|
| // A testable implementation of the |PasswordSyncableService| that mocks
|
| // out all interaction with the password database.
|
| class MockPasswordSyncableService : public PasswordSyncableService {
|
| @@ -268,8 +287,15 @@ PasswordStoreChangeList PasswordStoreDataVerifier::VerifyChange(
|
| const autofill::PasswordForm& password,
|
| std::vector<autofill::PasswordForm>* password_list) {
|
| std::vector<autofill::PasswordForm>::iterator it =
|
| - std::find(password_list->begin(), password_list->end(), password);
|
| + std::find_if(password_list->begin(), password_list->end(),
|
| + FormFinder(password));
|
| EXPECT_NE(password_list->end(), it);
|
| + PasswordsEqual(GetPasswordSpecifics(SyncDataFromPassword(*it)),
|
| + GetPasswordSpecifics(SyncDataFromPassword(password)));
|
| + if (type != PasswordStoreChange::REMOVE) {
|
| + EXPECT_FALSE(password.date_synced.is_null()) << password.signon_realm;
|
| + EXPECT_FALSE(password.date_synced.is_max()) << password.signon_realm;
|
| + }
|
| password_list->erase(it);
|
| return PasswordStoreChangeList(1, PasswordStoreChange(type, password));
|
| }
|
|
|