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

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

Issue 488083002: [Password Manager] Fix to recognise failed login attempt for sites where content server pushes new … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@branch_autofill_todo_20140813
Patch Set: Updated as per review comments. Created 6 years, 4 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 469a0a1a965d1e3edcfbac4972c54768c7c86112..b274c94f4c1eaac0097cff089048c7f3b49b856f 100644
--- a/components/password_manager/core/browser/password_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_manager_unittest.cc
@@ -758,4 +758,43 @@ TEST_F(PasswordManagerTest, SyncCredentialsNotSaved) {
manager()->OnPasswordFormsRendered(observed, true);
}
+// On failed login attempts, the retry-form can have action scheme changed from
+// HTTP to HTTPS (see http://crbug.com/400769). Check that such retry-form is
+// considered equal to the original login form, and the attempt recognised as a
+// failure.
+TEST_F(PasswordManagerTest,
+ SeeingFormActionWithOnlyHttpHttpsChangeIsLoginFailure) {
+ std::vector<PasswordForm*> result; // Empty password store.
+ EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0));
+ EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
+ .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return()));
+
+ PasswordForm first_form(MakeSimpleForm());
+ first_form.origin = GURL("http://www.xda-developers.com/");
+ first_form.action = GURL("http://forum.xda-developers.com/login.php");
+
+ // |second_form|'s action differs only with it's scheme i.e. *https://*.
+ PasswordForm second_form(first_form);
+ second_form.action = GURL("https://forum.xda-developers.com/login.php");
+
+ std::vector<PasswordForm> observed;
+ observed.push_back(first_form);
+ manager()->OnPasswordFormsParsed(observed);
+ manager()->OnPasswordFormsRendered(observed, true);
+ observed.clear();
+
+ // Now submit the |first_form|.
+ OnPasswordFormSubmitted(first_form);
+
+ // Simulate loading a page, which contains |second_form| instead of
+ // |first_form|.
+ observed.push_back(second_form);
+
+ // Verify that no prompt to save the password is shown.
+ EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(Exactly(0));
+ manager()->OnPasswordFormsParsed(observed);
+ manager()->OnPasswordFormsRendered(observed, true);
+ observed.clear();
+}
+
} // 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