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

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: Incorporatd review comments and added unit-tests 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
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 e628923a135ea80ddcadd137103a16188e0ad70d..4138105ba877657bb3553ebec4aeced2def3d16b 100644
--- a/components/password_manager/core/browser/password_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_manager_unittest.cc
@@ -758,4 +758,42 @@ TEST_F(PasswordManagerTest, SyncCredentialsNotSaved) {
manager()->OnPasswordFormsRendered(observed, true);
}
+// Verify that the form submission resulting into concent-server pushing
vabr (Chromium) 2014/08/26 09:42:59 nit: Although generally correct, the sentence is a
Pritam Nikam 2014/08/26 12:41:34 Done.
+// seperate form where actions differing only in their schemes shall not prompt
+// password save popup dialog.
+TEST_F(PasswordManagerTest,
+ FormSubmitWithNavigateToNewFormDifferingActionsOnlyBySchemes) {
vabr (Chromium) 2014/08/26 09:42:59 nit: The test name does not state what is tested,
Pritam Nikam 2014/08/26 12:41:34 Done.
+ 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");
+ first_form.signon_realm = "http://www.xda-developers.com/";
+ PasswordForm second_form(MakeSimpleForm());
vabr (Chromium) 2014/08/26 09:42:59 nit: Create this form from the previous, to emphas
Pritam Nikam 2014/08/26 12:41:34 Done.
+ second_form.origin = GURL("http://forum.xda-developers.com/login.php");
vabr (Chromium) 2014/08/26 09:42:59 The origin is not related to the tested change, so
Pritam Nikam 2014/08/26 12:41:34 Done.
+ second_form.action = GURL("https://forum.xda-developers.com/login.php");
vabr (Chromium) 2014/08/26 09:42:59 nit: Please add a comment emphasising that the cha
Pritam Nikam 2014/08/26 12:41:34 Done.
+ second_form.signon_realm = "http://www.xda-developers.com/";
vabr (Chromium) 2014/08/26 09:42:59 You can drop this if you create second_form based
Pritam Nikam 2014/08/26 12:41:34 Done.
+
+ std::vector<PasswordForm> observed;
+ observed.push_back(first_form);
+ manager()->OnPasswordFormsParsed(observed);
+ observed.clear();
+ manager()->OnPasswordFormsRendered(observed, true);
vabr (Chromium) 2014/08/26 09:42:59 Why do you clear |observed| before calling OnPassw
Pritam Nikam 2014/08/26 12:41:34 Done.
+
+ // Now submit the first form.
+ OnPasswordFormSubmitted(first_form);
+
+ // This page contains a form with the same action, but on a different scheme,
vabr (Chromium) 2014/08/26 09:42:59 nit: No need to comment on the difference, it shou
Pritam Nikam 2014/08/26 12:41:34 Done.
+ // i.e. "http://" to "https://".
+ observed.push_back(second_form);
+
+ // Verify that not to prompt with password save popup dialog.
vabr (Chromium) 2014/08/26 09:42:59 grammar nit: "Verify that no prompt to save the pa
Pritam Nikam 2014/08/26 12:41:34 Done.
+ EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(Exactly(0));
+ manager()->OnPasswordFormsParsed(observed);
+ manager()->OnPasswordFormsRendered(observed, true);
+ observed.clear();
+}
+
} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698