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

Unified Diff: chrome/renderer/autofill/password_autofill_agent_browsertest.cc

Issue 2881033003: [Password Manager] Send a request to the store if user clicks on an undetected password field (Closed)
Patch Set: Rebase Created 3 years, 7 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 | « no previous file | components/autofill/content/renderer/password_autofill_agent.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/autofill/password_autofill_agent_browsertest.cc
diff --git a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
index 144697576dc08a02b652506fad2912ddadcad399..ccd18184dc361d0504ba0b4b111b102072b4ca29 100644
--- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
+++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
@@ -97,8 +97,8 @@ const char kEmptyFormHTML[] =
const char kFormWithoutPasswordsHTML[] =
"<FORM>"
- " <INPUT type='text' id='random_field'/>"
" <INPUT type='text' id='username'/>"
+ " <INPUT type='text' id='random_field'/>"
"</FORM>";
const char kNonVisibleFormHTML[] =
@@ -899,6 +899,25 @@ TEST_F(PasswordAutofillAgentTest, SendPasswordFormsTest_FormWithoutPasswords) {
EXPECT_TRUE(fake_driver_.password_forms_rendered()->empty());
}
+TEST_F(PasswordAutofillAgentTest,
+ SendPasswordFormsTest_UndetectedPasswordField) {
+ fake_driver_.reset_password_forms_calls();
+ LoadHTML(kFormWithoutPasswordsHTML);
+ // Emulate that a password field appears but we don't detect that.
+ std::string script =
+ "document.getElementById('random_field').type = 'password';";
+ ExecuteJavaScriptForTests(script.c_str());
+ base::RunLoop().RunUntilIdle();
+ EXPECT_FALSE(fake_driver_.called_password_forms_parsed());
+
+ // When the user clicks on the field, a request to the store will be sent.
+ EXPECT_TRUE(SimulateElementClick("random_field"));
+ base::RunLoop().RunUntilIdle();
+ EXPECT_TRUE(fake_driver_.called_password_forms_parsed());
+ ASSERT_TRUE(fake_driver_.password_forms_parsed());
+ EXPECT_FALSE(fake_driver_.password_forms_parsed()->empty());
+}
+
TEST_F(PasswordAutofillAgentTest, SendPasswordFormsTest_NonDisplayedForm) {
fake_driver_.reset_password_forms_calls();
LoadHTML(kNonDisplayedFormHTML);
« no previous file with comments | « no previous file | components/autofill/content/renderer/password_autofill_agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698