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

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

Issue 1863073002: [Password Manager] Call FetchDataFromPasswordStore for new password form manager, if there was no c… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' of https://chromium.googlesource.com/chromium/src into tumblr_crash Created 4 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
« no previous file with comments | « components/password_manager/core/browser/password_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_manager_unittest.cc
diff --git a/components/password_manager/core/browser/password_manager_unittest.cc b/components/password_manager/core/browser/password_manager_unittest.cc
index 9fffb1799889b4c9a625f3453c77ebbfb169e5b0..043333361b1390708cfa9dbc8b229315ac0b1528 100644
--- a/components/password_manager/core/browser/password_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_manager_unittest.cc
@@ -1266,6 +1266,28 @@ TEST_F(PasswordManagerTest, PasswordGenerationUsernameChanged) {
EXPECT_EQ(form.new_password_value, form_to_save.password_value);
}
+TEST_F(PasswordManagerTest,
+ PasswordGenerationNoCorrespondingPasswordFormManager) {
+ // Verifies that if there is no corresponding password form manager for the
+ // given form, new password form manager should fetch data from the password
+ // store. Also verifies that |SetGenerationElementAndReasonForForm| doesn't
+ // change |has_generated_password_| of new password form manager.
+ EXPECT_CALL(client_, IsSavingAndFillingEnabledForCurrentPage())
+ .WillRepeatedly(Return(true));
+ PasswordForm form(MakeFormWithOnlyNewPasswordField());
+ std::vector<PasswordForm> observed;
+ manager()->OnPasswordFormsParsed(&driver_, observed);
+ manager()->OnPasswordFormsRendered(&driver_, observed, true);
+
+ PasswordStoreConsumer* consumer = nullptr;
+ EXPECT_CALL(*store_, GetLogins(form, _)).WillOnce(SaveArg<1>(&consumer));
+ manager()->SetGenerationElementAndReasonForForm(&driver_, form,
+ base::string16(), false);
+ PasswordFormManager* form_manager =
+ static_cast<PasswordFormManager*>(consumer);
+ EXPECT_FALSE(form_manager->has_generated_password());
+}
+
TEST_F(PasswordManagerTest, ForceSavingPasswords) {
// Add the enable-password-force-saving feature.
base::FeatureList::ClearInstanceForTesting();
« no previous file with comments | « components/password_manager/core/browser/password_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698