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

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

Issue 1161023008: Suggest to fill password change forms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renaming and showing password field suggestions rarely Created 5 years, 6 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 1e1c71fcd0c680e94f5c23791a4975ff240bf9b1..26de72833cc94f21dd5cfcd95ba24f487f848d64 100644
--- a/components/password_manager/core/browser/password_form_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -1522,4 +1522,26 @@ TEST_F(PasswordFormManagerTest, PasswordToSave_NewValue) {
EXPECT_EQ(kNewValue, PasswordFormManager::PasswordToSave(form));
}
+TEST_F(PasswordFormManagerTest, TestSuggestingPasswordChangeForms) {
+ // Suggesting password on the password change form on the previously visited
+ // site. Credentials are found in the password store, and are not blacklisted.
+ TestPasswordManager password_manager(client());
+ PasswordForm observed_change_password_form = *observed_form();
+ observed_change_password_form.new_password_element =
+ base::ASCIIToUTF16("new_pwd");
+ PasswordFormManager manager_creds(&password_manager, client(),
+ client()->driver(),
+ observed_change_password_form, false);
+ manager_creds.SimulateFetchMatchingLoginsFromPasswordStore();
+ ScopedVector<PasswordForm> simulated_results;
+ simulated_results.push_back(CreateSavedMatch(false));
+ manager_creds.OnGetPasswordStoreResults(simulated_results.Pass());
+ Mock::VerifyAndClearExpectations(client()->mock_driver());
+
+ // Check that Autofill message was sent.
+ EXPECT_EQ(1, password_manager.GetLatestBestMatches().size());
+ // Check that we suggest, not autofill.
+ EXPECT_TRUE(password_manager.GetLatestWaitForUsername());
+}
+
} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698