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 beb842f02ca8206d1e71f1d35cfbc03879508290..0b57f447716a7169bddd33a6260e284f8363de31 100644 |
--- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc |
+++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc |
@@ -1919,6 +1919,17 @@ TEST_F(PasswordAutofillAgentTest, FindingUsernameWithAutofillPredictions) { |
AutofillMsg_AutofillUsernameDataReceived msg(0, predictions); |
static_cast<content::RenderFrameObserver*>(password_autofill_agent_) |
->OnMessageReceived(msg); |
+ |
+ // The prediction should still match even if the form changes, as long |
+ // as the particular element doesn't change. |
+ std::string add_field_to_form = |
+ "var form = document.getElementById('LoginTestForm');" |
+ "var new_input = document.createElement('input');" |
+ "new_input.setAttribute('type', 'text');" |
+ "new_input.setAttribute('id', 'other_field');" |
+ "form.appendChild(new_input);"; |
+ ExecuteJavaScript(add_field_to_form.c_str()); |
+ |
static_cast<content::RenderFrameObserver*>(password_autofill_agent_) |
->WillSendSubmitEvent(username_element_.form()); |
static_cast<content::RenderFrameObserver*>(password_autofill_agent_) |