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

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

Issue 377223003: LoginDatabase::Update should touch all the fields which are synced. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the test on Mac Created 6 years, 5 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
« no previous file with comments | « components/password_manager/core/browser/login_database.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/password_manager/core/browser/login_database_unittest.cc
diff --git a/components/password_manager/core/browser/login_database_unittest.cc b/components/password_manager/core/browser/login_database_unittest.cc
index b1093c9bcd28b69aaa435e119d221632a00008a4..0cb6d8277fb3c50e122816026e9dbd6110975d7d 100644
--- a/components/password_manager/core/browser/login_database_unittest.cc
+++ b/components/password_manager/core/browser/login_database_unittest.cc
@@ -901,6 +901,45 @@ TEST_F(LoginDatabaseTest, DoubleAdd) {
EXPECT_EQ(list, db_.AddLogin(form));
}
+TEST_F(LoginDatabaseTest, UpdateLogin) {
+ PasswordForm form;
+ form.origin = GURL("http://accounts.google.com/LoginAuth");
+ form.signon_realm = "http://accounts.google.com/";
+ form.username_value = ASCIIToUTF16("my_username");
+ form.password_value = ASCIIToUTF16("my_password");
+ form.ssl_valid = false;
+ form.preferred = true;
+ form.blacklisted_by_user = false;
+ form.scheme = PasswordForm::SCHEME_HTML;
+ EXPECT_EQ(AddChangeForForm(form), db_.AddLogin(form));
+
+ form.action = GURL("http://accounts.google.com/login");
+ form.password_value = ASCIIToUTF16("my_new_password");
+ form.ssl_valid = true;
+ form.preferred = false;
+ form.other_possible_usernames.push_back(ASCIIToUTF16("my_new_username"));
+ form.times_used = 20;
+ form.submit_element = ASCIIToUTF16("submit_element");
+ form.date_synced = base::Time::Now();
+ form.date_created = base::Time::Now() - base::TimeDelta::FromDays(1);
+ // Remove this line after crbug/374132 is fixed.
+ form.date_created = base::Time::FromTimeT(form.date_created.ToTimeT());
+ form.blacklisted_by_user = true;
+ form.scheme = PasswordForm::SCHEME_BASIC;
+ form.type = PasswordForm::TYPE_GENERATED;
+ EXPECT_EQ(UpdateChangeForForm(form), db_.UpdateLogin(form));
+
+ ScopedVector<autofill::PasswordForm> result;
+ EXPECT_TRUE(db_.GetLogins(form, &result.get()));
+ ASSERT_EQ(1U, result.size());
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+ // On Mac, passwords are not stored in login database, instead they're in
+ // the keychain.
+ form.password_value.clear();
+#endif // OS_MACOSX && !OS_IOS
+ EXPECT_EQ(form, *result[0]);
+}
+
#if defined(OS_POSIX)
// Only the current user has permission to read the database.
//
« no previous file with comments | « components/password_manager/core/browser/login_database.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698