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

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

Issue 795183002: PasswordFormManager supports multiple drivers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment about non-blacklisted forms Created 6 years 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 a59accae87056e04ce1e2015fd461fe8e23c6196..f6b1add8a730fbfcfbf3116c4204d2f179209ad2 100644
--- a/components/password_manager/core/browser/password_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_manager_unittest.cc
@@ -566,7 +566,7 @@ TEST_F(PasswordManagerTest, InitiallyInvisibleForm) {
result.push_back(existing);
EXPECT_CALL(driver_, FillPasswordForm(_));
EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
- .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return()));
+ .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return()));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
observed.push_back(form);
@@ -603,7 +603,7 @@ TEST_F(PasswordManagerTest, FillPasswordsOnDisabledManager) {
EXPECT_CALL(driver_, FillPasswordForm(_));
EXPECT_CALL(*store_.get(),
GetLogins(_, testing::Eq(PasswordStore::DISALLOW_PROMPT), _))
- .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return()));
+ .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return()));
std::vector<PasswordForm> observed;
PasswordForm form(MakeSimpleForm());
observed.push_back(form);
@@ -891,4 +891,30 @@ TEST_F(PasswordManagerTest, FormSubmitWithOnlyPassowrdField) {
form_to_save->Save();
}
+TEST_F(PasswordManagerTest, FillPasswordOnManyFrames) {
+ // If one password form appears in more frames, it should be filled in all of
+ // them.
+ PasswordForm form(MakeSimpleForm()); // The observed and saved form.
+
+ // "Save" the form.
+ std::vector<PasswordForm*> result;
+ result.push_back(new PasswordForm(form)); // Calee owns the form.
+ EXPECT_CALL(*store_.get(),
+ GetLogins(_, testing::Eq(PasswordStore::DISALLOW_PROMPT), _))
+ .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return()));
+
+ // The form will be seen the first time.
+ EXPECT_CALL(driver_, FillPasswordForm(_)).Times(1);
+ std::vector<PasswordForm> observed;
+ observed.push_back(form);
+ manager()->OnPasswordFormsParsed(&driver_, observed);
+
+ // Now the form will be seen the second time, in a different frame. The driver
+ // for that frame should be told to fill it, but the store should not be asked
+ // for it again.
+ MockPasswordManagerDriver driver_b;
+ EXPECT_CALL(driver_b, FillPasswordForm(_)).Times(1);
+ manager()->OnPasswordFormsParsed(&driver_b, observed);
+}
+
} // namespace password_manager
« 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