| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <tuple> | 5 #include <tuple> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 "newLastname.setAttribute('id', 'second_lastname');" | 126 "newLastname.setAttribute('id', 'second_lastname');" |
| 127 "newLastname.value = 'Hope';" | 127 "newLastname.value = 'Hope';" |
| 128 "var newEmail=document.createElement('input');" | 128 "var newEmail=document.createElement('input');" |
| 129 "newEmail.setAttribute('type', 'text');" | 129 "newEmail.setAttribute('type', 'text');" |
| 130 "newEmail.setAttribute('id', 'second_email');" | 130 "newEmail.setAttribute('id', 'second_email');" |
| 131 "newEmail.value = 'bobhope@example.com';" | 131 "newEmail.value = 'bobhope@example.com';" |
| 132 "newForm.appendChild(newFirstname);" | 132 "newForm.appendChild(newFirstname);" |
| 133 "newForm.appendChild(newLastname);" | 133 "newForm.appendChild(newLastname);" |
| 134 "newForm.appendChild(newEmail);" | 134 "newForm.appendChild(newEmail);" |
| 135 "document.body.appendChild(newForm);"); | 135 "document.body.appendChild(newForm);"); |
| 136 msg_loop_.RunUntilIdle(); | |
| 137 | 136 |
| 137 WaitForAutofillDidAssociateFormControl(); |
| 138 message = render_thread_->sink().GetFirstMessageMatching( | 138 message = render_thread_->sink().GetFirstMessageMatching( |
| 139 AutofillHostMsg_FormsSeen::ID); | 139 AutofillHostMsg_FormsSeen::ID); |
| 140 ASSERT_NE(nullptr, message); | 140 ASSERT_NE(nullptr, message); |
| 141 AutofillHostMsg_FormsSeen::Read(message, ¶ms); | 141 AutofillHostMsg_FormsSeen::Read(message, ¶ms); |
| 142 forms = std::get<0>(params); | 142 forms = std::get<0>(params); |
| 143 ASSERT_EQ(1UL, forms.size()); | 143 ASSERT_EQ(1UL, forms.size()); |
| 144 ASSERT_EQ(3UL, forms[0].fields.size()); | 144 ASSERT_EQ(3UL, forms[0].fields.size()); |
| 145 | 145 |
| 146 expected.form_control_type = "text"; | 146 expected.form_control_type = "text"; |
| 147 expected.max_length = WebInputElement::defaultMaxLength(); | 147 expected.max_length = WebInputElement::defaultMaxLength(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 ASSERT_NE(nullptr, message); | 204 ASSERT_NE(nullptr, message); |
| 205 AutofillHostMsg_FormsSeen::Param params; | 205 AutofillHostMsg_FormsSeen::Param params; |
| 206 AutofillHostMsg_FormsSeen::Read(message, ¶ms); | 206 AutofillHostMsg_FormsSeen::Read(message, ¶ms); |
| 207 std::vector<FormData> forms = std::get<0>(params); | 207 std::vector<FormData> forms = std::get<0>(params); |
| 208 ASSERT_EQ(1UL, forms.size()); | 208 ASSERT_EQ(1UL, forms.size()); |
| 209 ASSERT_EQ(7UL, forms[0].fields.size()); | 209 ASSERT_EQ(7UL, forms[0].fields.size()); |
| 210 | 210 |
| 211 render_thread_->sink().ClearMessages(); | 211 render_thread_->sink().ClearMessages(); |
| 212 | 212 |
| 213 ExecuteJavaScriptForTests("AddFields()"); | 213 ExecuteJavaScriptForTests("AddFields()"); |
| 214 msg_loop_.RunUntilIdle(); | |
| 215 | 214 |
| 215 WaitForAutofillDidAssociateFormControl(); |
| 216 message = render_thread_->sink().GetFirstMessageMatching( | 216 message = render_thread_->sink().GetFirstMessageMatching( |
| 217 AutofillHostMsg_FormsSeen::ID); | 217 AutofillHostMsg_FormsSeen::ID); |
| 218 ASSERT_NE(nullptr, message); | 218 ASSERT_NE(nullptr, message); |
| 219 AutofillHostMsg_FormsSeen::Read(message, ¶ms); | 219 AutofillHostMsg_FormsSeen::Read(message, ¶ms); |
| 220 forms = std::get<0>(params); | 220 forms = std::get<0>(params); |
| 221 ASSERT_EQ(1UL, forms.size()); | 221 ASSERT_EQ(1UL, forms.size()); |
| 222 ASSERT_EQ(9UL, forms[0].fields.size()); | 222 ASSERT_EQ(9UL, forms[0].fields.size()); |
| 223 | 223 |
| 224 FormFieldData expected; | 224 FormFieldData expected; |
| 225 | 225 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 256 AutofillHostMsg_TextFieldDidChange::ID)); | 256 AutofillHostMsg_TextFieldDidChange::ID)); |
| 257 | 257 |
| 258 // A user gesture will send a message to the browser. | 258 // A user gesture will send a message to the browser. |
| 259 EnableUserGestureSimulationForAutofill(); | 259 EnableUserGestureSimulationForAutofill(); |
| 260 SimulateUserInputChangeForElement(&full_name, "Alice"); | 260 SimulateUserInputChangeForElement(&full_name, "Alice"); |
| 261 ASSERT_NE(nullptr, render_thread_->sink().GetFirstMessageMatching( | 261 ASSERT_NE(nullptr, render_thread_->sink().GetFirstMessageMatching( |
| 262 AutofillHostMsg_TextFieldDidChange::ID)); | 262 AutofillHostMsg_TextFieldDidChange::ID)); |
| 263 } | 263 } |
| 264 | 264 |
| 265 } // namespace autofill | 265 } // namespace autofill |
| OLD | NEW |