Commit fcdafe17 authored by Viktor Semeniuk's avatar Viktor Semeniuk Committed by Commit Bot

[Passwords] Fixed form comparison in SavedPasswordsPresenter::EditPassword

This change fixes android credential password editing on iOS.

Bug: 1134065

Change-Id: I65241882e2dcc0c99425639d20b4b8e0d2150a4e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2442613
Commit-Queue: Viktor Semeniuk <vsemeniuk@google.com>
Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813535}
parent b92ac427
......@@ -41,7 +41,10 @@ void SavedPasswordsPresenter::Init() {
bool SavedPasswordsPresenter::EditPassword(const PasswordForm& form,
base::string16 new_password) {
auto found = base::ranges::find(passwords_, form);
auto is_equal = [&form](const PasswordForm& form_to_check) {
return ArePasswordFormUniqueKeysEqual(form, form_to_check);
};
auto found = base::ranges::find_if(passwords_, is_equal);
if (found == passwords_.end())
return false;
......
......@@ -142,6 +142,7 @@ TEST_F(SavedPasswordsPresenterTest, EditPassword) {
// Verify that editing a password that does not exist does not triggers
// notifications.
form.username_value = base::ASCIIToUTF16("another_username");
EXPECT_CALL(observer, OnEdited).Times(0);
EXPECT_CALL(observer, OnSavedPasswordsChanged).Times(0);
EXPECT_FALSE(presenter().EditPassword(form, new_password));
......
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