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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 const std::vector<std::string>& control_types) { | 158 const std::vector<std::string>& control_types) { |
159 ASSERT_EQ(labels.size(), names.size()); | 159 ASSERT_EQ(labels.size(), names.size()); |
160 ASSERT_EQ(labels.size(), values.size()); | 160 ASSERT_EQ(labels.size(), values.size()); |
161 ASSERT_EQ(labels.size(), control_types.size()); | 161 ASSERT_EQ(labels.size(), control_types.size()); |
162 | 162 |
163 LoadHTML(html); | 163 LoadHTML(html); |
164 | 164 |
165 WebFrame* web_frame = GetMainFrame(); | 165 WebFrame* web_frame = GetMainFrame(); |
166 ASSERT_NE(nullptr, web_frame); | 166 ASSERT_NE(nullptr, web_frame); |
167 | 167 |
168 FormCache form_cache; | 168 FormCache form_cache(*web_frame); |
169 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 169 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
170 ASSERT_EQ(1U, forms.size()); | 170 ASSERT_EQ(1U, forms.size()); |
171 | 171 |
172 const FormData& form = forms[0]; | 172 const FormData& form = forms[0]; |
173 EXPECT_EQ(ASCIIToUTF16("TestForm"), form.name); | 173 EXPECT_EQ(ASCIIToUTF16("TestForm"), form.name); |
174 EXPECT_EQ(GURL(web_frame->document().url()), form.origin); | 174 EXPECT_EQ(GURL(web_frame->document().url()), form.origin); |
175 EXPECT_EQ(GURL("http://cnn.com"), form.action); | 175 EXPECT_EQ(GURL("http://cnn.com"), form.action); |
176 | 176 |
177 const std::vector<FormFieldData>& fields = form.fields; | 177 const std::vector<FormFieldData>& fields = form.fields; |
178 ASSERT_EQ(labels.size(), fields.size()); | 178 ASSERT_EQ(labels.size(), fields.size()); |
179 for (size_t i = 0; i < labels.size(); ++i) { | 179 for (size_t i = 0; i < labels.size(); ++i) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 void TestFormFillFunctions(const char* html, | 217 void TestFormFillFunctions(const char* html, |
218 const AutofillFieldCase* field_cases, | 218 const AutofillFieldCase* field_cases, |
219 size_t number_of_field_cases, | 219 size_t number_of_field_cases, |
220 FillFormFunction fill_form_function, | 220 FillFormFunction fill_form_function, |
221 GetValueFunction get_value_function) { | 221 GetValueFunction get_value_function) { |
222 LoadHTML(html); | 222 LoadHTML(html); |
223 | 223 |
224 WebFrame* web_frame = GetMainFrame(); | 224 WebFrame* web_frame = GetMainFrame(); |
225 ASSERT_NE(nullptr, web_frame); | 225 ASSERT_NE(nullptr, web_frame); |
226 | 226 |
227 FormCache form_cache; | 227 FormCache form_cache(*web_frame); |
228 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 228 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
229 ASSERT_EQ(1U, forms.size()); | 229 ASSERT_EQ(1U, forms.size()); |
230 | 230 |
231 // Get the input element we want to find. | 231 // Get the input element we want to find. |
232 WebInputElement input_element = GetInputElementById("firstname"); | 232 WebInputElement input_element = GetInputElementById("firstname"); |
233 | 233 |
234 // Find the form that contains the input element. | 234 // Find the form that contains the input element. |
235 FormData form_data; | 235 FormData form_data; |
236 FormFieldData field; | 236 FormFieldData field; |
237 EXPECT_TRUE(FindFormAndFieldForFormControlElement( | 237 EXPECT_TRUE(FindFormAndFieldForFormControlElement( |
238 input_element, &form_data, &field, autofill::REQUIRE_NONE)); | 238 input_element, &form_data, &field, autofill::REQUIRE_NONE)); |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 "<FORM name='TestForm2' action='http://zoo.com' method='post'>" | 967 "<FORM name='TestForm2' action='http://zoo.com' method='post'>" |
968 " <INPUT type='text' id='firstname' value='Jack'/>" | 968 " <INPUT type='text' id='firstname' value='Jack'/>" |
969 " <INPUT type='text' id='lastname' value='Adams'/>" | 969 " <INPUT type='text' id='lastname' value='Adams'/>" |
970 " <INPUT type='text' id='email' value='jack@example.com'/>" | 970 " <INPUT type='text' id='email' value='jack@example.com'/>" |
971 " <INPUT type='submit' name='reply-send' value='Send'/>" | 971 " <INPUT type='submit' name='reply-send' value='Send'/>" |
972 "</FORM>"); | 972 "</FORM>"); |
973 | 973 |
974 WebFrame* web_frame = GetMainFrame(); | 974 WebFrame* web_frame = GetMainFrame(); |
975 ASSERT_NE(nullptr, web_frame); | 975 ASSERT_NE(nullptr, web_frame); |
976 | 976 |
977 FormCache form_cache; | 977 FormCache form_cache(*web_frame); |
978 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 978 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
979 ASSERT_EQ(2U, forms.size()); | 979 ASSERT_EQ(2U, forms.size()); |
980 | 980 |
981 // First form. | 981 // First form. |
982 const FormData& form = forms[0]; | 982 const FormData& form = forms[0]; |
983 EXPECT_EQ(ASCIIToUTF16("TestForm"), form.name); | 983 EXPECT_EQ(ASCIIToUTF16("TestForm"), form.name); |
984 EXPECT_EQ(GURL(web_frame->document().url()), form.origin); | 984 EXPECT_EQ(GURL(web_frame->document().url()), form.origin); |
985 EXPECT_EQ(GURL("http://cnn.com"), form.action); | 985 EXPECT_EQ(GURL("http://cnn.com"), form.action); |
986 | 986 |
987 const std::vector<FormFieldData>& fields = form.fields; | 987 const std::vector<FormFieldData>& fields = form.fields; |
988 ASSERT_EQ(3U, fields.size()); | 988 ASSERT_EQ(3U, fields.size()); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 "<FORM id='testform' action='http://cnn.com' method='post'>" | 1030 "<FORM id='testform' action='http://cnn.com' method='post'>" |
1031 " <INPUT type='text' id='firstname' value='John'/>" | 1031 " <INPUT type='text' id='firstname' value='John'/>" |
1032 " <INPUT type='text' id='lastname' value='Smith'/>" | 1032 " <INPUT type='text' id='lastname' value='Smith'/>" |
1033 " <INPUT type='text' id='email' value='john@example.com'/>" | 1033 " <INPUT type='text' id='email' value='john@example.com'/>" |
1034 " <INPUT type='submit' name='reply-send' value='Send'/>" | 1034 " <INPUT type='submit' name='reply-send' value='Send'/>" |
1035 "</FORM>"); | 1035 "</FORM>"); |
1036 | 1036 |
1037 WebFrame* web_frame = GetMainFrame(); | 1037 WebFrame* web_frame = GetMainFrame(); |
1038 ASSERT_NE(nullptr, web_frame); | 1038 ASSERT_NE(nullptr, web_frame); |
1039 | 1039 |
1040 FormCache form_cache; | 1040 FormCache form_cache(*web_frame); |
1041 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 1041 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
1042 ASSERT_EQ(1U, forms.size()); | 1042 ASSERT_EQ(1U, forms.size()); |
1043 | 1043 |
1044 // Second call should give nothing as there are no new forms. | 1044 // Second call should give nothing as there are no new forms. |
1045 forms = form_cache.ExtractNewForms(*web_frame); | 1045 forms = form_cache.ExtractNewForms(); |
1046 ASSERT_TRUE(forms.empty()); | 1046 ASSERT_TRUE(forms.empty()); |
1047 | 1047 |
1048 // Append to the current form will re-extract. | 1048 // Append to the current form will re-extract. |
1049 ExecuteJavaScript( | 1049 ExecuteJavaScript( |
1050 "var newInput = document.createElement('input');" | 1050 "var newInput = document.createElement('input');" |
1051 "newInput.setAttribute('type', 'text');" | 1051 "newInput.setAttribute('type', 'text');" |
1052 "newInput.setAttribute('id', 'telephone');" | 1052 "newInput.setAttribute('id', 'telephone');" |
1053 "newInput.value = '12345';" | 1053 "newInput.value = '12345';" |
1054 "document.getElementById('testform').appendChild(newInput);"); | 1054 "document.getElementById('testform').appendChild(newInput);"); |
1055 msg_loop_.RunUntilIdle(); | 1055 msg_loop_.RunUntilIdle(); |
1056 | 1056 |
1057 forms = form_cache.ExtractNewForms(*web_frame); | 1057 forms = form_cache.ExtractNewForms(); |
1058 ASSERT_EQ(1U, forms.size()); | 1058 ASSERT_EQ(1U, forms.size()); |
1059 | 1059 |
1060 const std::vector<FormFieldData>& fields = forms[0].fields; | 1060 const std::vector<FormFieldData>& fields = forms[0].fields; |
1061 ASSERT_EQ(4U, fields.size()); | 1061 ASSERT_EQ(4U, fields.size()); |
1062 | 1062 |
1063 FormFieldData expected; | 1063 FormFieldData expected; |
1064 expected.form_control_type = "text"; | 1064 expected.form_control_type = "text"; |
1065 expected.max_length = WebInputElement::defaultMaxLength(); | 1065 expected.max_length = WebInputElement::defaultMaxLength(); |
1066 | 1066 |
1067 expected.name = ASCIIToUTF16("firstname"); | 1067 expected.name = ASCIIToUTF16("firstname"); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 "var newEmail=document.createElement('input');" | 1099 "var newEmail=document.createElement('input');" |
1100 "newEmail.setAttribute('type', 'text');" | 1100 "newEmail.setAttribute('type', 'text');" |
1101 "newEmail.setAttribute('id', 'second_email');" | 1101 "newEmail.setAttribute('id', 'second_email');" |
1102 "newEmail.value = 'bobhope@example.com';" | 1102 "newEmail.value = 'bobhope@example.com';" |
1103 "newForm.appendChild(newFirstname);" | 1103 "newForm.appendChild(newFirstname);" |
1104 "newForm.appendChild(newLastname);" | 1104 "newForm.appendChild(newLastname);" |
1105 "newForm.appendChild(newEmail);" | 1105 "newForm.appendChild(newEmail);" |
1106 "document.body.appendChild(newForm);"); | 1106 "document.body.appendChild(newForm);"); |
1107 msg_loop_.RunUntilIdle(); | 1107 msg_loop_.RunUntilIdle(); |
1108 | 1108 |
1109 web_frame = GetMainFrame(); | 1109 forms = form_cache.ExtractNewForms(); |
1110 forms = form_cache.ExtractNewForms(*web_frame); | |
1111 ASSERT_EQ(1U, forms.size()); | 1110 ASSERT_EQ(1U, forms.size()); |
1112 | 1111 |
1113 const std::vector<FormFieldData>& fields2 = forms[0].fields; | 1112 const std::vector<FormFieldData>& fields2 = forms[0].fields; |
1114 ASSERT_EQ(3U, fields2.size()); | 1113 ASSERT_EQ(3U, fields2.size()); |
1115 | 1114 |
1116 expected.name = ASCIIToUTF16("second_firstname"); | 1115 expected.name = ASCIIToUTF16("second_firstname"); |
1117 expected.value = ASCIIToUTF16("Bob"); | 1116 expected.value = ASCIIToUTF16("Bob"); |
1118 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[0]); | 1117 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[0]); |
1119 | 1118 |
1120 expected.name = ASCIIToUTF16("second_lastname"); | 1119 expected.name = ASCIIToUTF16("second_lastname"); |
1121 expected.value = ASCIIToUTF16("Hope"); | 1120 expected.value = ASCIIToUTF16("Hope"); |
1122 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[1]); | 1121 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[1]); |
1123 | 1122 |
1124 expected.name = ASCIIToUTF16("second_email"); | 1123 expected.name = ASCIIToUTF16("second_email"); |
1125 expected.value = ASCIIToUTF16("bobhope@example.com"); | 1124 expected.value = ASCIIToUTF16("bobhope@example.com"); |
1126 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[2]); | 1125 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[2]); |
1127 } | 1126 } |
1128 | 1127 |
1129 // We should not extract a form if it has too few fillable fields. | 1128 // We should not extract a form if it has too few fillable fields. |
1130 TEST_F(FormAutofillTest, ExtractFormsTooFewFields) { | 1129 TEST_F(FormAutofillTest, ExtractFormsTooFewFields) { |
1131 LoadHTML("<FORM name='TestForm' action='http://cnn.com' method='post'>" | 1130 LoadHTML("<FORM name='TestForm' action='http://cnn.com' method='post'>" |
1132 " <INPUT type='text' id='firstname' value='John'/>" | 1131 " <INPUT type='text' id='firstname' value='John'/>" |
1133 " <INPUT type='text' id='lastname' value='Smith'/>" | 1132 " <INPUT type='text' id='lastname' value='Smith'/>" |
1134 " <INPUT type='submit' name='reply-send' value='Send'/>" | 1133 " <INPUT type='submit' name='reply-send' value='Send'/>" |
1135 "</FORM>"); | 1134 "</FORM>"); |
1136 | 1135 |
1137 WebFrame* web_frame = GetMainFrame(); | 1136 WebFrame* web_frame = GetMainFrame(); |
1138 ASSERT_NE(nullptr, web_frame); | 1137 ASSERT_NE(nullptr, web_frame); |
1139 | 1138 |
1140 FormCache form_cache; | 1139 FormCache form_cache(*web_frame); |
1141 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 1140 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
1142 ASSERT_TRUE(forms.empty()); | 1141 ASSERT_TRUE(forms.empty()); |
1143 } | 1142 } |
1144 | 1143 |
1145 // We should not report additional forms for empty forms. | 1144 // We should not report additional forms for empty forms. |
1146 TEST_F(FormAutofillTest, ExtractFormsSkippedForms) { | 1145 TEST_F(FormAutofillTest, ExtractFormsSkippedForms) { |
1147 LoadHTML("<FORM name='TestForm' action='http://cnn.com' method='post'>" | 1146 LoadHTML("<FORM name='TestForm' action='http://cnn.com' method='post'>" |
1148 " <INPUT type='text' id='firstname' value='John'/>" | 1147 " <INPUT type='text' id='firstname' value='John'/>" |
1149 " <INPUT type='text' id='lastname' value='Smith'/>" | 1148 " <INPUT type='text' id='lastname' value='Smith'/>" |
1150 "</FORM>"); | 1149 "</FORM>"); |
1151 | 1150 |
1152 WebFrame* web_frame = GetMainFrame(); | 1151 WebFrame* web_frame = GetMainFrame(); |
1153 ASSERT_NE(nullptr, web_frame); | 1152 ASSERT_NE(nullptr, web_frame); |
1154 | 1153 |
1155 FormCache form_cache; | 1154 FormCache form_cache(*web_frame); |
1156 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 1155 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
1157 ASSERT_TRUE(forms.empty()); | 1156 ASSERT_TRUE(forms.empty()); |
1158 } | 1157 } |
1159 | 1158 |
1160 // We should not report additional forms for empty forms. | 1159 // We should not report additional forms for empty forms. |
1161 TEST_F(FormAutofillTest, ExtractFormsNoFields) { | 1160 TEST_F(FormAutofillTest, ExtractFormsNoFields) { |
1162 LoadHTML("<FORM name='TestForm' action='http://cnn.com' method='post'>" | 1161 LoadHTML("<FORM name='TestForm' action='http://cnn.com' method='post'>" |
1163 "</FORM>"); | 1162 "</FORM>"); |
1164 | 1163 |
1165 WebFrame* web_frame = GetMainFrame(); | 1164 WebFrame* web_frame = GetMainFrame(); |
1166 ASSERT_NE(nullptr, web_frame); | 1165 ASSERT_NE(nullptr, web_frame); |
1167 | 1166 |
1168 FormCache form_cache; | 1167 FormCache form_cache(*web_frame); |
1169 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 1168 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
1170 ASSERT_TRUE(forms.empty()); | 1169 ASSERT_TRUE(forms.empty()); |
1171 } | 1170 } |
1172 | 1171 |
1173 // We should not extract a form if it has too few fillable fields. | 1172 // We should not extract a form if it has too few fillable fields. |
1174 // Make sure radio and checkbox fields don't count. | 1173 // Make sure radio and checkbox fields don't count. |
1175 TEST_F(FormAutofillTest, ExtractFormsTooFewFieldsSkipsCheckable) { | 1174 TEST_F(FormAutofillTest, ExtractFormsTooFewFieldsSkipsCheckable) { |
1176 LoadHTML("<FORM name='TestForm' action='http://cnn.com' method='post'>" | 1175 LoadHTML("<FORM name='TestForm' action='http://cnn.com' method='post'>" |
1177 " <INPUT type='text' id='firstname' value='John'/>" | 1176 " <INPUT type='text' id='firstname' value='John'/>" |
1178 " <INPUT type='text' id='lastname' value='Smith'/>" | 1177 " <INPUT type='text' id='lastname' value='Smith'/>" |
1179 " <INPUT type='radio' id='a_radio' value='0'/>" | 1178 " <INPUT type='radio' id='a_radio' value='0'/>" |
1180 " <INPUT type='checkbox' id='a_check' value='1'/>" | 1179 " <INPUT type='checkbox' id='a_check' value='1'/>" |
1181 " <INPUT type='submit' name='reply-send' value='Send'/>" | 1180 " <INPUT type='submit' name='reply-send' value='Send'/>" |
1182 "</FORM>"); | 1181 "</FORM>"); |
1183 | 1182 |
1184 WebFrame* web_frame = GetMainFrame(); | 1183 WebFrame* web_frame = GetMainFrame(); |
1185 ASSERT_NE(nullptr, web_frame); | 1184 ASSERT_NE(nullptr, web_frame); |
1186 | 1185 |
1187 FormCache form_cache; | 1186 FormCache form_cache(*web_frame); |
1188 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 1187 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
1189 ASSERT_TRUE(forms.empty()); | 1188 ASSERT_TRUE(forms.empty()); |
1190 } | 1189 } |
1191 | 1190 |
1192 TEST_F(FormAutofillTest, WebFormElementToFormDataAutocomplete) { | 1191 TEST_F(FormAutofillTest, WebFormElementToFormDataAutocomplete) { |
1193 { | 1192 { |
1194 // Form is not auto-completable due to autocomplete=off. | 1193 // Form is not auto-completable due to autocomplete=off. |
1195 LoadHTML("<FORM name='TestForm' action='http://cnn.com' method='post'" | 1194 LoadHTML("<FORM name='TestForm' action='http://cnn.com' method='post'" |
1196 " autocomplete=off>" | 1195 " autocomplete=off>" |
1197 " <INPUT type='text' id='firstname' value='John'/>" | 1196 " <INPUT type='text' id='firstname' value='John'/>" |
1198 " <INPUT type='text' id='lastname' value='Smith'/>" | 1197 " <INPUT type='text' id='lastname' value='Smith'/>" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 " <INPUT type='text' id='lastname' value='Smith'/>" | 1272 " <INPUT type='text' id='lastname' value='Smith'/>" |
1274 " <INPUT type='text' id='email' value='john@example.com'" | 1273 " <INPUT type='text' id='email' value='john@example.com'" |
1275 "autocomplete='off' />" | 1274 "autocomplete='off' />" |
1276 " <INPUT type='text' id='phone' value='1.800.555.1234'/>" | 1275 " <INPUT type='text' id='phone' value='1.800.555.1234'/>" |
1277 " <INPUT type='submit' name='reply-send' value='Send'/>" | 1276 " <INPUT type='submit' name='reply-send' value='Send'/>" |
1278 "</FORM>"); | 1277 "</FORM>"); |
1279 | 1278 |
1280 WebFrame* web_frame = GetMainFrame(); | 1279 WebFrame* web_frame = GetMainFrame(); |
1281 ASSERT_NE(nullptr, web_frame); | 1280 ASSERT_NE(nullptr, web_frame); |
1282 | 1281 |
1283 FormCache form_cache; | 1282 FormCache form_cache(*web_frame); |
1284 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 1283 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
1285 ASSERT_EQ(1U, forms.size()); | 1284 ASSERT_EQ(1U, forms.size()); |
1286 | 1285 |
1287 // Get the input element we want to find. | 1286 // Get the input element we want to find. |
1288 WebInputElement input_element = GetInputElementById("firstname"); | 1287 WebInputElement input_element = GetInputElementById("firstname"); |
1289 | 1288 |
1290 // Find the form and verify it's the correct form. | 1289 // Find the form and verify it's the correct form. |
1291 FormData form; | 1290 FormData form; |
1292 FormFieldData field; | 1291 FormFieldData field; |
1293 EXPECT_TRUE(FindFormAndFieldForFormControlElement(input_element, | 1292 EXPECT_TRUE(FindFormAndFieldForFormControlElement(input_element, |
1294 &form, | 1293 &form, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1365 " <TEXTAREA id='street-address'>" | 1364 " <TEXTAREA id='street-address'>" |
1366 "123 Fantasy Ln. " | 1365 "123 Fantasy Ln. " |
1367 "Apt. 42" | 1366 "Apt. 42" |
1368 "</TEXTAREA>" | 1367 "</TEXTAREA>" |
1369 " <INPUT type='submit' name='reply-send' value='Send'/>" | 1368 " <INPUT type='submit' name='reply-send' value='Send'/>" |
1370 "</FORM>"); | 1369 "</FORM>"); |
1371 | 1370 |
1372 WebFrame* web_frame = GetMainFrame(); | 1371 WebFrame* web_frame = GetMainFrame(); |
1373 ASSERT_NE(nullptr, web_frame); | 1372 ASSERT_NE(nullptr, web_frame); |
1374 | 1373 |
1375 FormCache form_cache; | 1374 FormCache form_cache(*web_frame); |
1376 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 1375 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
1377 ASSERT_EQ(1U, forms.size()); | 1376 ASSERT_EQ(1U, forms.size()); |
1378 | 1377 |
1379 // Get the textarea element we want to find. | 1378 // Get the textarea element we want to find. |
1380 WebElement element = web_frame->document().getElementById("street-address"); | 1379 WebElement element = web_frame->document().getElementById("street-address"); |
1381 WebTextAreaElement textarea_element = element.to<WebTextAreaElement>(); | 1380 WebTextAreaElement textarea_element = element.to<WebTextAreaElement>(); |
1382 | 1381 |
1383 // Find the form and verify it's the correct form. | 1382 // Find the form and verify it's the correct form. |
1384 FormData form; | 1383 FormData form; |
1385 FormFieldData field; | 1384 FormFieldData field; |
1386 EXPECT_TRUE(FindFormAndFieldForFormControlElement(textarea_element, | 1385 EXPECT_TRUE(FindFormAndFieldForFormControlElement(textarea_element, |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2549 LoadHTML("<FORM name='TestForm' action='http://buh.com' method='post'>" | 2548 LoadHTML("<FORM name='TestForm' action='http://buh.com' method='post'>" |
2550 " <INPUT type='text' id='firstname' maxlength='5'/>" | 2549 " <INPUT type='text' id='firstname' maxlength='5'/>" |
2551 " <INPUT type='text' id='lastname' maxlength='7'/>" | 2550 " <INPUT type='text' id='lastname' maxlength='7'/>" |
2552 " <INPUT type='text' id='email' maxlength='9'/>" | 2551 " <INPUT type='text' id='email' maxlength='9'/>" |
2553 " <INPUT type='submit' name='reply-send' value='Send'/>" | 2552 " <INPUT type='submit' name='reply-send' value='Send'/>" |
2554 "</FORM>"); | 2553 "</FORM>"); |
2555 | 2554 |
2556 WebFrame* web_frame = GetMainFrame(); | 2555 WebFrame* web_frame = GetMainFrame(); |
2557 ASSERT_NE(nullptr, web_frame); | 2556 ASSERT_NE(nullptr, web_frame); |
2558 | 2557 |
2559 FormCache form_cache; | 2558 FormCache form_cache(*web_frame); |
2560 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 2559 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
2561 ASSERT_EQ(1U, forms.size()); | 2560 ASSERT_EQ(1U, forms.size()); |
2562 | 2561 |
2563 // Get the input element we want to find. | 2562 // Get the input element we want to find. |
2564 WebInputElement input_element = GetInputElementById("firstname"); | 2563 WebInputElement input_element = GetInputElementById("firstname"); |
2565 | 2564 |
2566 // Find the form that contains the input element. | 2565 // Find the form that contains the input element. |
2567 FormData form; | 2566 FormData form; |
2568 FormFieldData field; | 2567 FormFieldData field; |
2569 EXPECT_TRUE(FindFormAndFieldForFormControlElement(input_element, | 2568 EXPECT_TRUE(FindFormAndFieldForFormControlElement(input_element, |
2570 &form, | 2569 &form, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2647 LoadHTML("<FORM name='TestForm' action='http://buh.com' method='post'>" | 2646 LoadHTML("<FORM name='TestForm' action='http://buh.com' method='post'>" |
2648 " <INPUT type='text' id='firstname' maxlength='-1'/>" | 2647 " <INPUT type='text' id='firstname' maxlength='-1'/>" |
2649 " <INPUT type='text' id='lastname' maxlength='-10'/>" | 2648 " <INPUT type='text' id='lastname' maxlength='-10'/>" |
2650 " <INPUT type='text' id='email' maxlength='-13'/>" | 2649 " <INPUT type='text' id='email' maxlength='-13'/>" |
2651 " <INPUT type='submit' name='reply-send' value='Send'/>" | 2650 " <INPUT type='submit' name='reply-send' value='Send'/>" |
2652 "</FORM>"); | 2651 "</FORM>"); |
2653 | 2652 |
2654 WebFrame* web_frame = GetMainFrame(); | 2653 WebFrame* web_frame = GetMainFrame(); |
2655 ASSERT_NE(nullptr, web_frame); | 2654 ASSERT_NE(nullptr, web_frame); |
2656 | 2655 |
2657 FormCache form_cache; | 2656 FormCache form_cache(*web_frame); |
2658 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 2657 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
2659 ASSERT_EQ(1U, forms.size()); | 2658 ASSERT_EQ(1U, forms.size()); |
2660 | 2659 |
2661 // Get the input element we want to find. | 2660 // Get the input element we want to find. |
2662 WebInputElement input_element = GetInputElementById("firstname"); | 2661 WebInputElement input_element = GetInputElementById("firstname"); |
2663 | 2662 |
2664 // Find the form that contains the input element. | 2663 // Find the form that contains the input element. |
2665 FormData form; | 2664 FormData form; |
2666 FormFieldData field; | 2665 FormFieldData field; |
2667 EXPECT_TRUE(FindFormAndFieldForFormControlElement(input_element, | 2666 EXPECT_TRUE(FindFormAndFieldForFormControlElement(input_element, |
2668 &form, | 2667 &form, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2726 LoadHTML("<FORM name='TestForm' action='http://buh.com' method='post'>" | 2725 LoadHTML("<FORM name='TestForm' action='http://buh.com' method='post'>" |
2727 " <INPUT type='text' id='firstname'/>" | 2726 " <INPUT type='text' id='firstname'/>" |
2728 " <INPUT type='text' id='lastname'/>" | 2727 " <INPUT type='text' id='lastname'/>" |
2729 " <INPUT type='text' id='email'/>" | 2728 " <INPUT type='text' id='email'/>" |
2730 " <INPUT type='submit' value='Send'/>" | 2729 " <INPUT type='submit' value='Send'/>" |
2731 "</FORM>"); | 2730 "</FORM>"); |
2732 | 2731 |
2733 WebFrame* web_frame = GetMainFrame(); | 2732 WebFrame* web_frame = GetMainFrame(); |
2734 ASSERT_NE(nullptr, web_frame); | 2733 ASSERT_NE(nullptr, web_frame); |
2735 | 2734 |
2736 FormCache form_cache; | 2735 FormCache form_cache(*web_frame); |
2737 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 2736 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
2738 ASSERT_EQ(1U, forms.size()); | 2737 ASSERT_EQ(1U, forms.size()); |
2739 | 2738 |
2740 // Get the input element we want to find. | 2739 // Get the input element we want to find. |
2741 WebInputElement input_element = GetInputElementById("firstname"); | 2740 WebInputElement input_element = GetInputElementById("firstname"); |
2742 | 2741 |
2743 // Find the form that contains the input element. | 2742 // Find the form that contains the input element. |
2744 FormData form; | 2743 FormData form; |
2745 FormFieldData field; | 2744 FormFieldData field; |
2746 EXPECT_TRUE(FindFormAndFieldForFormControlElement(input_element, | 2745 EXPECT_TRUE(FindFormAndFieldForFormControlElement(input_element, |
2747 &form, | 2746 &form, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2814 "<FORM action='http://abc.com' method='post'>" | 2813 "<FORM action='http://abc.com' method='post'>" |
2815 " <INPUT type='text' id='apple'/>" | 2814 " <INPUT type='text' id='apple'/>" |
2816 " <INPUT type='text' id='banana'/>" | 2815 " <INPUT type='text' id='banana'/>" |
2817 " <INPUT type='text' id='cantelope'/>" | 2816 " <INPUT type='text' id='cantelope'/>" |
2818 " <INPUT type='submit' value='Send'/>" | 2817 " <INPUT type='submit' value='Send'/>" |
2819 "</FORM>"); | 2818 "</FORM>"); |
2820 | 2819 |
2821 WebFrame* web_frame = GetMainFrame(); | 2820 WebFrame* web_frame = GetMainFrame(); |
2822 ASSERT_NE(nullptr, web_frame); | 2821 ASSERT_NE(nullptr, web_frame); |
2823 | 2822 |
2824 FormCache form_cache; | 2823 FormCache form_cache(*web_frame); |
2825 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 2824 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
2826 ASSERT_EQ(2U, forms.size()); | 2825 ASSERT_EQ(2U, forms.size()); |
2827 | 2826 |
2828 // Get the input element we want to find. | 2827 // Get the input element we want to find. |
2829 WebInputElement input_element = GetInputElementById("apple"); | 2828 WebInputElement input_element = GetInputElementById("apple"); |
2830 | 2829 |
2831 // Find the form that contains the input element. | 2830 // Find the form that contains the input element. |
2832 FormData form; | 2831 FormData form; |
2833 FormFieldData field; | 2832 FormFieldData field; |
2834 EXPECT_TRUE(FindFormAndFieldForFormControlElement(input_element, | 2833 EXPECT_TRUE(FindFormAndFieldForFormControlElement(input_element, |
2835 &form, | 2834 &form, |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3035 LoadHTML("<FORM name='TestForm' action='http://buh.com' method='post'>" | 3034 LoadHTML("<FORM name='TestForm' action='http://buh.com' method='post'>" |
3036 " <INPUT type='text' id='firstname'/>" | 3035 " <INPUT type='text' id='firstname'/>" |
3037 " <INPUT type='text' id='lastname'/>" | 3036 " <INPUT type='text' id='lastname'/>" |
3038 " <INPUT type='text' id='email'/>" | 3037 " <INPUT type='text' id='email'/>" |
3039 " <INPUT type='submit' value='Send'/>" | 3038 " <INPUT type='submit' value='Send'/>" |
3040 "</FORM>"); | 3039 "</FORM>"); |
3041 | 3040 |
3042 WebFrame* web_frame = GetMainFrame(); | 3041 WebFrame* web_frame = GetMainFrame(); |
3043 ASSERT_NE(nullptr, web_frame); | 3042 ASSERT_NE(nullptr, web_frame); |
3044 | 3043 |
3045 FormCache form_cache; | 3044 FormCache form_cache(*web_frame); |
3046 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 3045 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
3047 ASSERT_EQ(1U, forms.size()); | 3046 ASSERT_EQ(1U, forms.size()); |
3048 | 3047 |
3049 // Get the input element we want to find. | 3048 // Get the input element we want to find. |
3050 WebInputElement input_element = GetInputElementById("firstname"); | 3049 WebInputElement input_element = GetInputElementById("firstname"); |
3051 | 3050 |
3052 // Simulate typing by modifying the field value. | 3051 // Simulate typing by modifying the field value. |
3053 input_element.setValue(ASCIIToUTF16("Wy")); | 3052 input_element.setValue(ASCIIToUTF16("Wy")); |
3054 | 3053 |
3055 // Find the form that contains the input element. | 3054 // Find the form that contains the input element. |
3056 FormData form; | 3055 FormData form; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3148 " <TEXTAREA id='textarea-disabled' disabled='disabled'>" | 3147 " <TEXTAREA id='textarea-disabled' disabled='disabled'>" |
3149 " Banana!" | 3148 " Banana!" |
3150 " </TEXTAREA>" | 3149 " </TEXTAREA>" |
3151 " <TEXTAREA id='textarea-noAC' autocomplete='off'>Carrot?</TEXTAREA>" | 3150 " <TEXTAREA id='textarea-noAC' autocomplete='off'>Carrot?</TEXTAREA>" |
3152 " <INPUT type='submit' value='Send'/>" | 3151 " <INPUT type='submit' value='Send'/>" |
3153 "</FORM>"); | 3152 "</FORM>"); |
3154 | 3153 |
3155 WebFrame* web_frame = GetMainFrame(); | 3154 WebFrame* web_frame = GetMainFrame(); |
3156 ASSERT_NE(nullptr, web_frame); | 3155 ASSERT_NE(nullptr, web_frame); |
3157 | 3156 |
3158 FormCache form_cache; | 3157 FormCache form_cache(*web_frame); |
3159 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 3158 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
3160 ASSERT_EQ(1U, forms.size()); | 3159 ASSERT_EQ(1U, forms.size()); |
3161 | 3160 |
3162 // Set the auto-filled attribute. | 3161 // Set the auto-filled attribute. |
3163 WebInputElement firstname = GetInputElementById("firstname"); | 3162 WebInputElement firstname = GetInputElementById("firstname"); |
3164 firstname.setAutofilled(true); | 3163 firstname.setAutofilled(true); |
3165 WebInputElement lastname = GetInputElementById("lastname"); | 3164 WebInputElement lastname = GetInputElementById("lastname"); |
3166 lastname.setAutofilled(true); | 3165 lastname.setAutofilled(true); |
3167 WebInputElement month = GetInputElementById("month"); | 3166 WebInputElement month = GetInputElementById("month"); |
3168 month.setAutofilled(true); | 3167 month.setAutofilled(true); |
3169 WebInputElement textarea = GetInputElementById("textarea"); | 3168 WebInputElement textarea = GetInputElementById("textarea"); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3255 " <OPTION>AA</OPTION>" | 3254 " <OPTION>AA</OPTION>" |
3256 " <OPTION>AE</OPTION>" | 3255 " <OPTION>AE</OPTION>" |
3257 " <OPTION>AK</OPTION>" | 3256 " <OPTION>AK</OPTION>" |
3258 " </SELECT>" | 3257 " </SELECT>" |
3259 " <INPUT type='submit' value='Send'/>" | 3258 " <INPUT type='submit' value='Send'/>" |
3260 "</FORM>"); | 3259 "</FORM>"); |
3261 | 3260 |
3262 WebFrame* web_frame = GetMainFrame(); | 3261 WebFrame* web_frame = GetMainFrame(); |
3263 ASSERT_NE(nullptr, web_frame); | 3262 ASSERT_NE(nullptr, web_frame); |
3264 | 3263 |
3265 FormCache form_cache; | 3264 FormCache form_cache(*web_frame); |
3266 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 3265 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
3267 ASSERT_EQ(1U, forms.size()); | 3266 ASSERT_EQ(1U, forms.size()); |
3268 | 3267 |
3269 // Set the auto-filled attribute. | 3268 // Set the auto-filled attribute. |
3270 WebInputElement firstname = GetInputElementById("firstname"); | 3269 WebInputElement firstname = GetInputElementById("firstname"); |
3271 firstname.setAutofilled(true); | 3270 firstname.setAutofilled(true); |
3272 WebInputElement lastname = GetInputElementById("lastname"); | 3271 WebInputElement lastname = GetInputElementById("lastname"); |
3273 lastname.setAutofilled(true); | 3272 lastname.setAutofilled(true); |
3274 | 3273 |
3275 // Set the value and auto-filled attribute of the state element. | 3274 // Set the value and auto-filled attribute of the state element. |
3276 WebSelectElement state = | 3275 WebSelectElement state = |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3329 " <INPUT type='text' id='lastname'/>" | 3328 " <INPUT type='text' id='lastname'/>" |
3330 " <INPUT type='text' id='email'/>" | 3329 " <INPUT type='text' id='email'/>" |
3331 " <INPUT type='email' id='email2'/>" | 3330 " <INPUT type='email' id='email2'/>" |
3332 " <INPUT type='tel' id='phone'/>" | 3331 " <INPUT type='tel' id='phone'/>" |
3333 " <INPUT type='submit' value='Send'/>" | 3332 " <INPUT type='submit' value='Send'/>" |
3334 "</FORM>"); | 3333 "</FORM>"); |
3335 | 3334 |
3336 WebFrame* web_frame = GetMainFrame(); | 3335 WebFrame* web_frame = GetMainFrame(); |
3337 ASSERT_NE(nullptr, web_frame); | 3336 ASSERT_NE(nullptr, web_frame); |
3338 | 3337 |
3339 FormCache form_cache; | 3338 FormCache form_cache(*web_frame); |
3340 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 3339 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
3341 ASSERT_EQ(1U, forms.size()); | 3340 ASSERT_EQ(1U, forms.size()); |
3342 | 3341 |
3343 // Set the auto-filled attribute. | 3342 // Set the auto-filled attribute. |
3344 WebInputElement firstname = GetInputElementById("firstname"); | 3343 WebInputElement firstname = GetInputElementById("firstname"); |
3345 firstname.setAutofilled(true); | 3344 firstname.setAutofilled(true); |
3346 WebInputElement lastname = GetInputElementById("lastname"); | 3345 WebInputElement lastname = GetInputElementById("lastname"); |
3347 lastname.setAutofilled(true); | 3346 lastname.setAutofilled(true); |
3348 WebInputElement email = GetInputElementById("email"); | 3347 WebInputElement email = GetInputElementById("email"); |
3349 email.setAutofilled(true); | 3348 email.setAutofilled(true); |
3350 WebInputElement email2 = GetInputElementById("email2"); | 3349 WebInputElement email2 = GetInputElementById("email2"); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3391 " <INPUT type='text' id='lastname'/>" | 3390 " <INPUT type='text' id='lastname'/>" |
3392 " <INPUT type='text' id='email'/>" | 3391 " <INPUT type='text' id='email'/>" |
3393 " <INPUT type='email' id='email2'/>" | 3392 " <INPUT type='email' id='email2'/>" |
3394 " <INPUT type='tel' id='phone'/>" | 3393 " <INPUT type='tel' id='phone'/>" |
3395 " <INPUT type='submit' value='Send'/>" | 3394 " <INPUT type='submit' value='Send'/>" |
3396 "</FORM>"); | 3395 "</FORM>"); |
3397 | 3396 |
3398 WebFrame* web_frame = GetMainFrame(); | 3397 WebFrame* web_frame = GetMainFrame(); |
3399 ASSERT_NE(nullptr, web_frame); | 3398 ASSERT_NE(nullptr, web_frame); |
3400 | 3399 |
3401 FormCache form_cache; | 3400 FormCache form_cache(*web_frame); |
3402 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 3401 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
3403 ASSERT_EQ(1U, forms.size()); | 3402 ASSERT_EQ(1U, forms.size()); |
3404 | 3403 |
3405 // Set the auto-filled attribute. | 3404 // Set the auto-filled attribute. |
3406 WebInputElement firstname = GetInputElementById("firstname"); | 3405 WebInputElement firstname = GetInputElementById("firstname"); |
3407 firstname.setAutofilled(true); | 3406 firstname.setAutofilled(true); |
3408 WebInputElement lastname = GetInputElementById("lastname"); | 3407 WebInputElement lastname = GetInputElementById("lastname"); |
3409 lastname.setAutofilled(true); | 3408 lastname.setAutofilled(true); |
3410 WebInputElement email = GetInputElementById("email"); | 3409 WebInputElement email = GetInputElementById("email"); |
3411 email.setAutofilled(true); | 3410 email.setAutofilled(true); |
3412 WebInputElement email2 = GetInputElementById("email2"); | 3411 WebInputElement email2 = GetInputElementById("email2"); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3453 " <INPUT type='text' id='lastname'/>" | 3452 " <INPUT type='text' id='lastname'/>" |
3454 " <INPUT type='text' id='email'/>" | 3453 " <INPUT type='text' id='email'/>" |
3455 " <INPUT type='email' id='email2'/>" | 3454 " <INPUT type='email' id='email2'/>" |
3456 " <INPUT type='tel' id='phone'/>" | 3455 " <INPUT type='tel' id='phone'/>" |
3457 " <INPUT type='submit' value='Send'/>" | 3456 " <INPUT type='submit' value='Send'/>" |
3458 "</FORM>"); | 3457 "</FORM>"); |
3459 | 3458 |
3460 WebFrame* web_frame = GetMainFrame(); | 3459 WebFrame* web_frame = GetMainFrame(); |
3461 ASSERT_NE(nullptr, web_frame); | 3460 ASSERT_NE(nullptr, web_frame); |
3462 | 3461 |
3463 FormCache form_cache; | 3462 FormCache form_cache(*web_frame); |
3464 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 3463 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
3465 ASSERT_EQ(1U, forms.size()); | 3464 ASSERT_EQ(1U, forms.size()); |
3466 | 3465 |
3467 // Set the auto-filled attribute. | 3466 // Set the auto-filled attribute. |
3468 WebInputElement firstname = GetInputElementById("firstname"); | 3467 WebInputElement firstname = GetInputElementById("firstname"); |
3469 firstname.setAutofilled(true); | 3468 firstname.setAutofilled(true); |
3470 WebInputElement lastname = GetInputElementById("lastname"); | 3469 WebInputElement lastname = GetInputElementById("lastname"); |
3471 lastname.setAutofilled(true); | 3470 lastname.setAutofilled(true); |
3472 WebInputElement email = GetInputElementById("email"); | 3471 WebInputElement email = GetInputElementById("email"); |
3473 email.setAutofilled(true); | 3472 email.setAutofilled(true); |
3474 WebInputElement email2 = GetInputElementById("email2"); | 3473 WebInputElement email2 = GetInputElementById("email2"); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3516 " <INPUT type='text' id='firstname' value='Wyatt'/>" | 3515 " <INPUT type='text' id='firstname' value='Wyatt'/>" |
3517 " <INPUT type='text' id='lastname' value='Earp'/>" | 3516 " <INPUT type='text' id='lastname' value='Earp'/>" |
3518 " <INPUT type='email' id='email' value='wyatt@earp.com'/>" | 3517 " <INPUT type='email' id='email' value='wyatt@earp.com'/>" |
3519 " <INPUT type='tel' id='phone' value='650-777-9999'/>" | 3518 " <INPUT type='tel' id='phone' value='650-777-9999'/>" |
3520 " <INPUT type='submit' value='Send'/>" | 3519 " <INPUT type='submit' value='Send'/>" |
3521 "</FORM>"); | 3520 "</FORM>"); |
3522 | 3521 |
3523 WebFrame* web_frame = GetMainFrame(); | 3522 WebFrame* web_frame = GetMainFrame(); |
3524 ASSERT_NE(nullptr, web_frame); | 3523 ASSERT_NE(nullptr, web_frame); |
3525 | 3524 |
3526 FormCache form_cache; | 3525 FormCache form_cache(*web_frame); |
3527 std::vector<FormData> forms = form_cache.ExtractNewForms(*web_frame); | 3526 std::vector<FormData> forms = form_cache.ExtractNewForms(); |
3528 ASSERT_EQ(1U, forms.size()); | 3527 ASSERT_EQ(1U, forms.size()); |
3529 | 3528 |
3530 // Set the autofilled attribute. | 3529 // Set the autofilled attribute. |
3531 WebInputElement firstname = GetInputElementById("firstname"); | 3530 WebInputElement firstname = GetInputElementById("firstname"); |
3532 firstname.setAutofilled(false); | 3531 firstname.setAutofilled(false); |
3533 WebInputElement lastname = GetInputElementById("lastname"); | 3532 WebInputElement lastname = GetInputElementById("lastname"); |
3534 lastname.setAutofilled(true); | 3533 lastname.setAutofilled(true); |
3535 WebInputElement email = GetInputElementById("email"); | 3534 WebInputElement email = GetInputElementById("email"); |
3536 email.setAutofilled(true); | 3535 email.setAutofilled(true); |
3537 WebInputElement phone = GetInputElementById("phone"); | 3536 WebInputElement phone = GetInputElementById("phone"); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3842 frame->document().all(), &fieldsets); | 3841 frame->document().all(), &fieldsets); |
3843 ASSERT_EQ(0U, control_elements.size()); | 3842 ASSERT_EQ(0U, control_elements.size()); |
3844 ASSERT_EQ(0U, fieldsets.size()); | 3843 ASSERT_EQ(0U, fieldsets.size()); |
3845 | 3844 |
3846 FormData form; | 3845 FormData form; |
3847 EXPECT_FALSE(UnownedFormElementsAndFieldSetsToFormData( | 3846 EXPECT_FALSE(UnownedFormElementsAndFieldSetsToFormData( |
3848 fieldsets, control_elements, dummy_origin, extract_mask, &form)); | 3847 fieldsets, control_elements, dummy_origin, extract_mask, &form)); |
3849 } | 3848 } |
3850 | 3849 |
3851 } // namespace autofill | 3850 } // namespace autofill |
OLD | NEW |