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

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

Issue 550563002: [Password Generation] Allow generation when saved credentials aren't valid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Created 6 years, 3 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/password_form_manager.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/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 b9197ca9f48a99d1c0d4a60240e65c74cf6ee5a0..ae4807476ef98aa967fa80564771672b7af8bf24 100644
--- a/components/password_manager/core/browser/password_form_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -704,6 +704,27 @@ TEST_F(PasswordFormManagerTest, TestSendNotBlacklistedMessage) {
SimulateResponseFromPasswordStore(&manager_creds, result);
Mock::VerifyAndClearExpectations(client()->GetMockDriver());
+ // There are cases, such as when a form is explicitly for creating a new
+ // password, where we may ignore saved credentials. Make sure that we still
+ // allow generation in that case.
+ PasswordForm signup_form(*observed_form());
+ signup_form.new_password_element = base::ASCIIToUTF16("new_password_field");
+
+ PasswordFormManager manager_dropped_creds(&password_manager,
+ client(),
+ client()->GetDriver(),
+ signup_form,
+ false);
+ EXPECT_CALL(*(client()->GetMockDriver()), AllowPasswordGenerationForForm(_))
+ .Times(1);
+ EXPECT_CALL(*(client()->GetMockDriver()), IsOffTheRecord())
+ .WillRepeatedly(Return(false));
+ SimulateFetchMatchingLoginsFromPasswordStore(&manager_dropped_creds);
+ result.clear();
+ result.push_back(CreateSavedMatch(false));
+ SimulateResponseFromPasswordStore(&manager_dropped_creds, result);
+ Mock::VerifyAndClearExpectations(client()->GetMockDriver());
+
// Signing up on a previously visited site. Credentials are found in the
// password store, but they are blacklisted. AllowPasswordGenerationForForm
// should not be called and no "not blacklisted" message sent.
« no previous file with comments | « components/password_manager/core/browser/password_form_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698