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. |