Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(545)

Unified Diff: components/password_manager/core/browser/password_form_manager_unittest.cc

Issue 299443002: Password Login Database: report correct changes from UpdateLogin(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added UpdateNonexistentLogin tests Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/password_manager/core/browser/password_form_manager_unittest.cc
diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc
index 1599f444422954a56d38e38a1746d9610d13dfde..3de9ecc86f115a28f737cb22fbe590a15668ca4e 100644
--- a/components/password_manager/core/browser/password_form_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -687,6 +687,9 @@ TEST_F(PasswordFormManagerTest, TestUpdateIncompleteCredentials) {
complete_form.username_element = encountered_form.username_element;
complete_form.submit_element = encountered_form.submit_element;
+ PasswordForm obsolete_form(*incomplete_form);
+ obsolete_form.action = encountered_form.action;
+
// Feed the incomplete credentials to the manager.
std::vector<PasswordForm*> results;
results.push_back(incomplete_form); // Takes ownership.
@@ -696,9 +699,11 @@ TEST_F(PasswordFormManagerTest, TestUpdateIncompleteCredentials) {
complete_form, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES);
// By now that form has been used once.
complete_form.times_used = 1;
+ obsolete_form.times_used = 1;
// Check that PasswordStore receives an update request with the complete form.
- EXPECT_CALL(*mock_store(), UpdateLogin(complete_form));
+ EXPECT_CALL(*mock_store(), RemoveLogin(obsolete_form));
+ EXPECT_CALL(*mock_store(), AddLogin(complete_form));
form_manager.Save();
}

Powered by Google App Engine
This is Rietveld 408576698