Lines Matching refs:field

70   FormFieldData field;
71 field.label = ASCIIToUTF16("username");
72 field.name = ASCIIToUTF16("username");
73 field.form_control_type = "text";
74 form.fields.push_back(field);
76 field.label = ASCIIToUTF16("password");
77 field.name = ASCIIToUTF16("password");
78 field.form_control_type = "password";
79 form.fields.push_back(field);
81 field.label = base::string16();
82 field.name = ASCIIToUTF16("Submit");
83 field.form_control_type = "submit";
84 form.fields.push_back(field);
86 field.label = ASCIIToUTF16("address1");
87 field.name = ASCIIToUTF16("address1");
88 field.form_control_type = "text";
89 field.should_autocomplete = false;
90 form.fields.push_back(field);
103 FormFieldData field;
104 field.label = ASCIIToUTF16("username");
105 field.name = ASCIIToUTF16("username");
106 field.form_control_type = "text";
107 form.fields.push_back(field);
109 field.label = ASCIIToUTF16("password");
110 field.name = ASCIIToUTF16("password");
111 field.form_control_type = "password";
112 form.fields.push_back(field);
114 field.label = ASCIIToUTF16("state");
115 field.name = ASCIIToUTF16("state");
116 field.form_control_type = "select-one";
117 form.fields.push_back(field);
119 field.label = base::string16();
120 field.name = ASCIIToUTF16("Submit");
121 field.form_control_type = "submit";
122 form.fields.push_back(field);
129 // Add a field with should_autocomplete=false.
130 field.label = ASCIIToUTF16("address1");
131 field.name = ASCIIToUTF16("address1");
132 field.form_control_type = "text";
133 field.should_autocomplete = false;
134 form.fields.push_back(field);
138 // DetermineHeuristicTypes also assign field type for fields with
161 FormFieldData field;
163 field.label = ASCIIToUTF16("username");
164 field.name = ASCIIToUTF16("username");
165 field.form_control_type = "text";
166 form.fields.push_back(field);
168 field.label = ASCIIToUTF16("password");
169 field.name = ASCIIToUTF16("password");
170 field.form_control_type = "password";
171 form.fields.push_back(field);
173 field.label = base::string16();
174 field.name = ASCIIToUTF16("Submit");
175 field.form_control_type = "submit";
176 form.fields.push_back(field);
183 field.label = ASCIIToUTF16("First Name");
184 field.name = ASCIIToUTF16("firstname");
185 field.form_control_type = "text";
186 form.fields.push_back(field);
188 field.label = ASCIIToUTF16("Last Name");
189 field.name = ASCIIToUTF16("lastname");
190 field.form_control_type = "text";
191 form.fields.push_back(field);
198 field.label = ASCIIToUTF16("Email");
199 field.name = ASCIIToUTF16("email");
200 field.form_control_type = "email";
201 form.fields.push_back(field);
236 FormFieldData field;
237 field.label = ASCIIToUTF16("username");
238 field.name = ASCIIToUTF16("username");
239 field.form_control_type = "text";
240 form.fields.push_back(field);
252 // We have only one text field, should not be parsed.
257 field.label = ASCIIToUTF16("First Name");
258 field.name = ASCIIToUTF16("firstname");
259 field.form_control_type = "text";
260 form.fields.push_back(field);
262 field.label = ASCIIToUTF16("Last Name");
263 field.name = ASCIIToUTF16("lastname");
264 field.form_control_type = "text";
265 form.fields.push_back(field);
289 // field.
292 field.label = ASCIIToUTF16("Email");
293 field.name = ASCIIToUTF16("email");
294 field.form_control_type = "email";
295 form.fields.push_back(field);
297 field.label = ASCIIToUTF16("State");
298 field.name = ASCIIToUTF16("state");
299 field.form_control_type = "select-one";
300 form.fields.push_back(field);
302 field.label = ASCIIToUTF16("Country");
303 field.name = ASCIIToUTF16("country");
304 field.form_control_type = "select-one";
305 form.fields.push_back(field);
321 FormFieldData field;
322 field.form_control_type = "text";
324 field.label = ASCIIToUTF16("First Name");
325 field.name = ASCIIToUTF16("firstname");
326 form.fields.push_back(field);
328 field.label = ASCIIToUTF16("Last Name");
329 field.name = ASCIIToUTF16("lastname");
330 form.fields.push_back(field);
332 field.label = ASCIIToUTF16("Email");
333 field.name = ASCIIToUTF16("email");
334 form.fields.push_back(field);
336 field.label = ASCIIToUTF16("Phone");
337 field.name = ASCIIToUTF16("phone");
338 form.fields.push_back(field);
340 field.label = ASCIIToUTF16("Address");
341 field.name = ASCIIToUTF16("address");
342 form.fields.push_back(field);
344 field.label = ASCIIToUTF16("City");
345 field.name = ASCIIToUTF16("city");
346 form.fields.push_back(field);
348 field.label = ASCIIToUTF16("Zip code");
349 field.name = ASCIIToUTF16("zipcode");
350 form.fields.push_back(field);
352 field.label = base::string16();
353 field.name = ASCIIToUTF16("Submit");
354 field.form_control_type = "submit";
355 form.fields.push_back(field);
366 EXPECT_EQ(NAME_FIRST, form_structure->field(0)->heuristic_type());
368 EXPECT_EQ(NAME_LAST, form_structure->field(1)->heuristic_type());
370 EXPECT_EQ(EMAIL_ADDRESS, form_structure->field(2)->heuristic_type());
373 form_structure->field(3)->heuristic_type());
375 EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(4)->heuristic_type());
377 EXPECT_EQ(ADDRESS_HOME_CITY, form_structure->field(5)->heuristic_type());
379 EXPECT_EQ(ADDRESS_HOME_ZIP, form_structure->field(6)->heuristic_type());
381 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(7)->heuristic_type());
390 FormFieldData field;
391 field.form_control_type = "text";
393 field.label = base::string16();
394 field.name = ASCIIToUTF16("field1");
395 field.autocomplete_attribute = "given-name";
396 form.fields.push_back(field);
398 field.label = base::string16();
399 field.name = ASCIIToUTF16("field2");
400 field.autocomplete_attribute = "family-name";
401 form.fields.push_back(field);
403 field.label = base::string16();
404 field.name = ASCIIToUTF16("field3");
405 field.autocomplete_attribute = "email";
406 form.fields.push_back(field);
416 EXPECT_EQ(HTML_TYPE_GIVEN_NAME, form_structure->field(0)->html_type());
417 EXPECT_EQ(HTML_TYPE_FAMILY_NAME, form_structure->field(1)->html_type());
418 EXPECT_EQ(HTML_TYPE_EMAIL, form_structure->field(2)->html_type());
419 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(0)->heuristic_type());
420 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(1)->heuristic_type());
421 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(2)->heuristic_type());
431 FormFieldData field;
432 field.form_control_type = "text";
434 field.label = base::string16();
435 field.name = ASCIIToUTF16("field1");
436 field.autocomplete_attribute = "tel-local";
437 form.fields.push_back(field);
439 field.label = base::string16();
440 field.name = ASCIIToUTF16("field2");
441 field.autocomplete_attribute = "tel-local-prefix";
442 form.fields.push_back(field);
444 field.label = base::string16();
445 field.name = ASCIIToUTF16("field3");
446 field.autocomplete_attribute = "tel-local-suffix";
447 form.fields.push_back(field);
457 EXPECT_EQ(HTML_TYPE_TEL_LOCAL, form_structure->field(0)->html_type());
458 EXPECT_EQ(AutofillField::IGNORED, form_structure->field(0)->phone_part());
459 EXPECT_EQ(HTML_TYPE_TEL_LOCAL_PREFIX, form_structure->field(1)->html_type());
461 form_structure->field(1)->phone_part());
462 EXPECT_EQ(HTML_TYPE_TEL_LOCAL_SUFFIX, form_structure->field(2)->html_type());
464 form_structure->field(2)->phone_part());
467 // If at least one field includes type hints in the 'autocomplete' attribute, we
475 FormFieldData field;
476 field.form_control_type = "text";
478 field.label = ASCIIToUTF16("First Name");
479 field.name = ASCIIToUTF16("firstname");
480 form.fields.push_back(field);
482 field.label = ASCIIToUTF16("Last Name");
483 field.name = ASCIIToUTF16("lastname");
484 form.fields.push_back(field);
486 field.label = ASCIIToUTF16("Email");
487 field.name = ASCIIToUTF16("email");
488 form.fields.push_back(field);
498 EXPECT_EQ(NAME_FIRST, form_structure->field(0)->heuristic_type());
499 EXPECT_EQ(NAME_LAST, form_structure->field(1)->heuristic_type());
500 EXPECT_EQ(EMAIL_ADDRESS, form_structure->field(2)->heuristic_type());
502 // Now update the first form field to include an 'autocomplete' attribute.
512 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(0)->heuristic_type());
513 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(1)->heuristic_type());
514 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(2)->heuristic_type());
523 FormFieldData field;
524 field.form_control_type = "text";
528 field.autocomplete_attribute = "email";
529 form.fields.push_back(field);
532 field.autocomplete_attribute = "section-foo email";
533 form.fields.push_back(field);
537 field.autocomplete_attribute = "shipping email";
538 form.fields.push_back(field);
539 field.autocomplete_attribute = "billing email";
540 form.fields.push_back(field);
543 field.autocomplete_attribute = "section-foo shipping email";
544 form.fields.push_back(field);
545 field.autocomplete_attribute = "section-foo billing email";
546 form.fields.push_back(field);
550 field.autocomplete_attribute = "section--foo email";
551 form.fields.push_back(field);
557 field.autocomplete_attribute = "section--shipping email";
558 form.fields.push_back(field);
561 field.autocomplete_attribute = "section-foo cc-number";
562 form.fields.push_back(field);
576 section_names.insert(form_structure.field(i)->section());
587 FormFieldData field;
588 field.form_control_type = "text";
592 field.autocomplete_attribute = "email";
593 form.fields.push_back(field);
596 field.autocomplete_attribute = "section- email";
597 form.fields.push_back(field);
600 field.autocomplete_attribute = "garbage section-foo email";
601 form.fields.push_back(field);
602 field.autocomplete_attribute = "garbage section-bar email";
603 form.fields.push_back(field);
604 field.autocomplete_attribute = "garbage shipping email";
605 form.fields.push_back(field);
606 field.autocomplete_attribute = "garbage billing email";
607 form.fields.push_back(field);
620 section_names.insert(form_structure.field(i)->section());
631 FormFieldData field;
632 field.form_control_type = "text";
634 field.autocomplete_attribute = "section-foo email";
635 form.fields.push_back(field);
636 field.autocomplete_attribute = "section-foo address-line1";
637 form.fields.push_back(field);
650 section_names.insert(form_structure.field(i)->section());
661 FormFieldData field;
662 field.form_control_type = "text";
664 field.name = ASCIIToUTF16("one");
665 field.autocomplete_attribute = "address-line1";
666 form.fields.push_back(field);
667 field.name = base::string16();
668 field.autocomplete_attribute = "section-foo email";
669 form.fields.push_back(field);
670 field.name = base::string16();
671 field.autocomplete_attribute = "name";
672 form.fields.push_back(field);
673 field.name = ASCIIToUTF16("two");
674 field.autocomplete_attribute = "address-line1";
675 form.fields.push_back(field);
687 EXPECT_EQ(ASCIIToUTF16("one"), form_structure.field(0)->name);
688 EXPECT_EQ(ASCIIToUTF16("two"), form_structure.field(3)->name);
689 EXPECT_EQ(form_structure.field(0)->section(),
690 form_structure.field(3)->section());
698 FormFieldData field;
699 field.form_control_type = "text";
701 field.label = ASCIIToUTF16("Your First Name:");
702 field.name = ASCIIToUTF16("bill.first");
703 form.fields.push_back(field);
705 field.label = ASCIIToUTF16("Your Last Name:");
706 field.name = ASCIIToUTF16("bill.last");
707 form.fields.push_back(field);
709 field.label = ASCIIToUTF16("Street Address Line 1:");
710 field.name = ASCIIToUTF16("bill.street1");
711 form.fields.push_back(field);
713 field.label = ASCIIToUTF16("Street Address Line 2:");
714 field.name = ASCIIToUTF16("bill.street2");
715 form.fields.push_back(field);
717 field.label = ASCIIToUTF16("City");
718 field.name = ASCIIToUTF16("bill.city");
719 form.fields.push_back(field);
721 field.label = ASCIIToUTF16("State (U.S.):");
722 field.name = ASCIIToUTF16("bill.state");
723 form.fields.push_back(field);
725 field.label = ASCIIToUTF16("Zip/Postal Code:");
726 field.name = ASCIIToUTF16("BillTo.PostalCode");
727 form.fields.push_back(field);
729 field.label = ASCIIToUTF16("Country:");
730 field.name = ASCIIToUTF16("bill.country");
731 form.fields.push_back(field);
733 field.label = ASCIIToUTF16("Phone Number:");
734 field.name = ASCIIToUTF16("BillTo.Phone");
735 form.fields.push_back(field);
737 field.label = base::string16();
738 field.name = ASCIIToUTF16("Submit");
739 field.form_control_type = "submit";
740 form.fields.push_back(field);
749 EXPECT_EQ(NAME_FIRST, form_structure->field(0)->heuristic_type());
751 EXPECT_EQ(NAME_LAST, form_structure->field(1)->heuristic_type());
753 EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(2)->heuristic_type());
755 EXPECT_EQ(ADDRESS_HOME_LINE2, form_structure->field(3)->heuristic_type());
757 EXPECT_EQ(ADDRESS_HOME_CITY, form_structure->field(4)->heuristic_type());
759 EXPECT_EQ(ADDRESS_HOME_STATE, form_structure->field(5)->heuristic_type());
761 EXPECT_EQ(ADDRESS_HOME_ZIP, form_structure->field(6)->heuristic_type());
763 EXPECT_EQ(ADDRESS_HOME_COUNTRY, form_structure->field(7)->heuristic_type());
766 form_structure->field(8)->heuristic_type());
768 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(9)->heuristic_type());
776 FormFieldData field;
777 field.form_control_type = "text";
779 field.label = ASCIIToUTF16("E-mail address");
780 field.name = ASCIIToUTF16("email");
781 form.fields.push_back(field);
783 field.label = ASCIIToUTF16("Full name");
784 field.name = ASCIIToUTF16("name");
785 form.fields.push_back(field);
787 field.label = ASCIIToUTF16("Company");
788 field.name = ASCIIToUTF16("company");
789 form.fields.push_back(field);
791 field.label = ASCIIToUTF16("Address");
792 field.name = ASCIIToUTF16("address");
793 form.fields.push_back(field);
795 field.label = ASCIIToUTF16("City");
796 field.name = ASCIIToUTF16("city");
797 form.fields.push_back(field);
799 field.label = ASCIIToUTF16("Zip Code");
800 field.name = ASCIIToUTF16("Home.PostalCode");
801 form.fields.push_back(field);
803 field.label = base::string16();
804 field.name = ASCIIToUTF16("Submit");
805 field.value = ASCIIToUTF16("continue");
806 field.form_control_type = "submit";
807 form.fields.push_back(field);
816 EXPECT_EQ(EMAIL_ADDRESS, form_structure->field(0)->heuristic_type());
818 EXPECT_EQ(NAME_FULL, form_structure->field(1)->heuristic_type());
820 EXPECT_EQ(COMPANY_NAME, form_structure->field(2)->heuristic_type());
822 EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(3)->heuristic_type());
824 EXPECT_EQ(ADDRESS_HOME_CITY, form_structure->field(4)->heuristic_type());
826 EXPECT_EQ(ADDRESS_HOME_ZIP, form_structure->field(5)->heuristic_type());
828 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(6)->heuristic_type());
839 FormFieldData field;
840 field.form_control_type = "text";
842 field.label = ASCIIToUTF16("First Name");
843 field.name = base::string16();
844 form.fields.push_back(field);
846 field.label = ASCIIToUTF16("Last Name");
847 field.name = base::string16();
848 form.fields.push_back(field);
850 field.label = ASCIIToUTF16("Email");
851 field.name = base::string16();
852 form.fields.push_back(field);
854 field.label = ASCIIToUTF16("Phone");
855 field.name = base::string16();
856 form.fields.push_back(field);
858 field.label = ASCIIToUTF16("Address");
859 field.name = base::string16();
860 form.fields.push_back(field);
862 field.label = ASCIIToUTF16("Address");
863 field.name = base::string16();
864 form.fields.push_back(field);
866 field.label = ASCIIToUTF16("Zip code");
867 field.name = base::string16();
868 form.fields.push_back(field);
870 field.label = base::string16();
871 field.name = ASCIIToUTF16("Submit");
872 field.form_control_type = "submit";
873 form.fields.push_back(field);
882 EXPECT_EQ(NAME_FIRST, form_structure->field(0)->heuristic_type());
884 EXPECT_EQ(NAME_LAST, form_structure->field(1)->heuristic_type());
886 EXPECT_EQ(EMAIL_ADDRESS, form_structure->field(2)->heuristic_type());
889 form_structure->field(3)->heuristic_type());
891 EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(4)->heuristic_type());
893 EXPECT_EQ(ADDRESS_HOME_LINE2, form_structure->field(5)->heuristic_type());
895 EXPECT_EQ(ADDRESS_HOME_ZIP, form_structure->field(6)->heuristic_type());
897 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(7)->heuristic_type());
905 FormFieldData field;
906 field.form_control_type = "text";
908 field.label = ASCIIToUTF16("Name on Card");
909 field.name = ASCIIToUTF16("name_on_card");
910 form.fields.push_back(field);
912 field.label = ASCIIToUTF16("Card Number");
913 field.name = ASCIIToUTF16("card_number");
914 form.fields.push_back(field);
916 field.label = ASCIIToUTF16("Exp Month");
917 field.name = ASCIIToUTF16("ccmonth");
918 form.fields.push_back(field);
920 field.label = ASCIIToUTF16("Exp Year");
921 field.name = ASCIIToUTF16("ccyear");
922 form.fields.push_back(field);
924 field.label = ASCIIToUTF16("Verification");
925 field.name = ASCIIToUTF16("verification");
926 form.fields.push_back(field);
928 field.label = base::string16();
929 field.name = ASCIIToUTF16("Submit");
930 field.form_control_type = "submit";
931 form.fields.push_back(field);
940 EXPECT_EQ(CREDIT_CARD_NAME, form_structure->field(0)->heuristic_type());
942 EXPECT_EQ(CREDIT_CARD_NUMBER, form_structure->field(1)->heuristic_type());
944 EXPECT_EQ(CREDIT_CARD_EXP_MONTH, form_structure->field(2)->heuristic_type());
947 form_structure->field(3)->heuristic_type());
950 form_structure->field(4)->heuristic_type());
952 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(5)->heuristic_type());
960 FormFieldData field;
961 field.form_control_type = "text";
963 field.label = ASCIIToUTF16("Name on Card");
964 field.name = ASCIIToUTF16("name_on_card");
965 form.fields.push_back(field);
967 // This is not a field we know how to process. But we should skip over it
969 field.label = ASCIIToUTF16("Card image");
970 field.name = ASCIIToUTF16("card_image");
971 form.fields.push_back(field);
973 field.label = ASCIIToUTF16("Card Number");
974 field.name = ASCIIToUTF16("card_number");
975 form.fields.push_back(field);
977 field.label = ASCIIToUTF16("Exp Month");
978 field.name = ASCIIToUTF16("ccmonth");
979 form.fields.push_back(field);
981 field.label = ASCIIToUTF16("Exp Year");
982 field.name = ASCIIToUTF16("ccyear");
983 form.fields.push_back(field);
985 field.label = ASCIIToUTF16("Verification");
986 field.name = ASCIIToUTF16("verification");
987 form.fields.push_back(field);
989 field.label = base::string16();
990 field.name = ASCIIToUTF16("Submit");
991 field.form_control_type = "submit";
992 form.fields.push_back(field);
1001 EXPECT_EQ(CREDIT_CARD_NAME, form_structure->field(0)->heuristic_type());
1003 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(1)->heuristic_type());
1005 EXPECT_EQ(CREDIT_CARD_NUMBER, form_structure->field(2)->heuristic_type());
1007 EXPECT_EQ(CREDIT_CARD_EXP_MONTH, form_structure->field(3)->heuristic_type());
1010 form_structure->field(4)->heuristic_type());
1013 form_structure->field(5)->heuristic_type());
1015 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(6)->heuristic_type());
1023 FormFieldData field;
1024 field.form_control_type = "text";
1026 field.label = ASCIIToUTF16("Address Line1");
1027 field.name = ASCIIToUTF16("Address");
1028 form.fields.push_back(field);
1030 field.label = ASCIIToUTF16("Address Line2");
1031 field.name = ASCIIToUTF16("Address");
1032 form.fields.push_back(field);
1034 field.label = ASCIIToUTF16("Address Line3");
1035 field.name = ASCIIToUTF16("Address");
1036 form.fields.push_back(field);
1038 field.label = ASCIIToUTF16("City");
1039 field.name = ASCIIToUTF16("city");
1040 form.fields.push_back(field);
1049 EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(0)->heuristic_type());
1051 EXPECT_EQ(ADDRESS_HOME_LINE2, form_structure->field(1)->heuristic_type());
1053 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(2)->heuristic_type());
1055 EXPECT_EQ(ADDRESS_HOME_CITY, form_structure->field(3)->heuristic_type());
1064 FormFieldData field;
1065 field.form_control_type = "text";
1067 field.label = ASCIIToUTF16("Address Line1");
1068 field.name = ASCIIToUTF16("shipping.address.addressLine1");
1069 form.fields.push_back(field);
1071 field.label = ASCIIToUTF16("Address Line2");
1072 field.name = ASCIIToUTF16("shipping.address.addressLine2");
1073 form.fields.push_back(field);
1075 field.label = ASCIIToUTF16("Address Line3");
1076 field.name = ASCIIToUTF16("billing.address.addressLine3");
1077 form.fields.push_back(field);
1079 field.label = ASCIIToUTF16("Address Line4");
1080 field.name = ASCIIToUTF16("billing.address.addressLine4");
1081 form.fields.push_back(field);
1089 EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(0)->heuristic_type());
1091 EXPECT_EQ(ADDRESS_HOME_LINE2, form_structure->field(1)->heuristic_type());
1093 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(2)->heuristic_type());
1095 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(3)->heuristic_type());
1108 FormFieldData field;
1109 field.form_control_type = "text";
1111 field.label = ASCIIToUTF16("Street:");
1112 field.name = ASCIIToUTF16("FOPIH_RgWebCC_0_IHAddress_ads1");
1113 form.fields.push_back(field);
1115 field.label = ASCIIToUTF16("Suite or Apt:");
1116 field.name = ASCIIToUTF16("FOPIH_RgWebCC_0_IHAddress_adap");
1117 form.fields.push_back(field);
1119 field.label = ASCIIToUTF16("Street address second line");
1120 field.name = ASCIIToUTF16("FOPIH_RgWebCC_0_IHAddress_ads2");
1121 form.fields.push_back(field);
1123 field.label = ASCIIToUTF16("City:");
1124 field.name = ASCIIToUTF16("FOPIH_RgWebCC_0_IHAddress_adct");
1125 form.fields.push_back(field);
1134 EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(0)->heuristic_type());
1136 EXPECT_EQ(ADDRESS_HOME_LINE2, form_structure->field(1)->heuristic_type());
1138 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(2)->heuristic_type());
1140 EXPECT_EQ(ADDRESS_HOME_CITY, form_structure->field(3)->heuristic_type());
1151 FormFieldData field;
1152 field.form_control_type = "text";
1154 field.label = ASCIIToUTF16("Address Line1");
1155 field.name = ASCIIToUTF16("address1");
1156 form.fields.push_back(field);
1158 field.label = ASCIIToUTF16("Floor number, suite number, etc");
1159 field.name = ASCIIToUTF16("address2");
1160 form.fields.push_back(field);
1162 field.label = ASCIIToUTF16("City:");
1163 field.name = ASCIIToUTF16("city");
1164 form.fields.push_back(field);
1173 EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(0)->heuristic_type());
1175 EXPECT_EQ(ADDRESS_HOME_LINE2, form_structure->field(1)->heuristic_type());
1177 EXPECT_EQ(ADDRESS_HOME_CITY, form_structure->field(2)->heuristic_type());
1185 FormFieldData field;
1186 field.form_control_type = "text";
1188 field.label = ASCIIToUTF16("Address Line1");
1189 field.name = ASCIIToUTF16("Address");
1190 form.fields.push_back(field);
1192 field.label = ASCIIToUTF16("Address Line2");
1193 field.name = ASCIIToUTF16("Address");
1194 form.fields.push_back(field);
1196 field.label = ASCIIToUTF16("State/Province/Region");
1197 field.name = ASCIIToUTF16("State");
1198 form.fields.push_back(field);
1207 EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(0)->heuristic_type());
1209 EXPECT_EQ(ADDRESS_HOME_LINE2, form_structure->field(1)->heuristic_type());
1211 EXPECT_EQ(ADDRESS_HOME_STATE, form_structure->field(2)->heuristic_type());
1220 FormFieldData field;
1221 field.form_control_type = "text";
1223 field.label = ASCIIToUTF16("First Name*:");
1224 field.name = ASCIIToUTF16("editBillingAddress$firstNameBox");
1225 form.fields.push_back(field);
1227 field.label = ASCIIToUTF16("Last Name*:");
1228 field.name = ASCIIToUTF16("editBillingAddress$lastNameBox");
1229 form.fields.push_back(field);
1231 field.label = ASCIIToUTF16("Company Name:");
1232 field.name = ASCIIToUTF16("editBillingAddress$companyBox");
1233 form.fields.push_back(field);
1235 field.label = ASCIIToUTF16("Address*:");
1236 field.name = ASCIIToUTF16("editBillingAddress$addressLine1Box");
1237 form.fields.push_back(field);
1239 field.label = ASCIIToUTF16("Apt/Suite :");
1240 field.name = ASCIIToUTF16("editBillingAddress$addressLine2Box");
1241 form.fields.push_back(field);
1243 field.label = ASCIIToUTF16("City*:");
1244 field.name = ASCIIToUTF16("editBillingAddress$cityBox");
1245 form.fields.push_back(field);
1247 field.label = ASCIIToUTF16("State/Province*:");
1248 field.name = ASCIIToUTF16("editBillingAddress$stateDropDown");
1249 form.fields.push_back(field);
1251 field.label = ASCIIToUTF16("Country*:");
1252 field.name = ASCIIToUTF16("editBillingAddress$countryDropDown");
1253 form.fields.push_back(field);
1255 field.label = ASCIIToUTF16("Postal Code*:");
1256 field.name = ASCIIToUTF16("editBillingAddress$zipCodeBox");
1257 form.fields.push_back(field);
1259 field.label = ASCIIToUTF16("Phone*:");
1260 field.name = ASCIIToUTF16("editBillingAddress$phoneBox");
1261 form.fields.push_back(field);
1263 field.label = ASCIIToUTF16("Email Address*:");
1264 field.name = ASCIIToUTF16("email$emailBox");
1265 form.fields.push_back(field);
1273 EXPECT_EQ(NAME_FIRST, form_structure->field(0)->heuristic_type());
1274 EXPECT_EQ(NAME_LAST, form_structure->field(1)->heuristic_type());
1275 EXPECT_EQ(COMPANY_NAME, form_structure->field(2)->heuristic_type());
1276 EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(3)->heuristic_type());
1277 EXPECT_EQ(ADDRESS_HOME_LINE2, form_structure->field(4)->heuristic_type());
1278 EXPECT_EQ(ADDRESS_HOME_CITY, form_structure->field(5)->heuristic_type());
1279 EXPECT_EQ(ADDRESS_HOME_STATE, form_structure->field(6)->heuristic_type());
1280 EXPECT_EQ(ADDRESS_HOME_COUNTRY, form_structure->field(7)->heuristic_type());
1281 EXPECT_EQ(ADDRESS_HOME_ZIP, form_structure->field(8)->heuristic_type());
1283 form_structure->field(9)->heuristic_type());
1284 EXPECT_EQ(EMAIL_ADDRESS, form_structure->field(10)->heuristic_type());
1292 FormFieldData field;
1293 field.form_control_type = "text";
1295 field.label = ASCIIToUTF16("Phone:");
1296 field.name = ASCIIToUTF16("dayphone1");
1297 field.max_length = 0;
1298 form.fields.push_back(field);
1300 field.label = ASCIIToUTF16("-");
1301 field.name = ASCIIToUTF16("dayphone2");
1302 field.max_length = 3; // Size of prefix is 3.
1303 form.fields.push_back(field);
1305 field.label = ASCIIToUTF16("-");
1306 field.name = ASCIIToUTF16("dayphone3");
1307 field.max_length = 4; // Size of suffix is 4. If unlimited size is
1310 form.fields.push_back(field);
1312 field.label = ASCIIToUTF16("ext.:");
1313 field.name = ASCIIToUTF16("dayphone4");
1314 field.max_length = 0;
1315 form.fields.push_back(field);
1324 EXPECT_EQ(PHONE_HOME_CITY_CODE, form_structure->field(0)->heuristic_type());
1327 form_structure->field(1)->heuristic_type());
1330 form_structure->field(2)->heuristic_type());
1332 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(3)->heuristic_type());
1340 FormFieldData field;
1341 field.form_control_type = "text";
1343 field.label = ASCIIToUTF16("Name on Card");
1344 field.name = ASCIIToUTF16("name_on_card");
1345 form.fields.push_back(field);
1347 field.label = ASCIIToUTF16("Address");
1348 field.name = ASCIIToUTF16("billing_address");
1349 form.fields.push_back(field);
1351 field.label = ASCIIToUTF16("Card Number");
1352 field.name = ASCIIToUTF16("card_number");
1353 form.fields.push_back(field);
1355 field.label = ASCIIToUTF16("Expiration Date");
1356 field.name = ASCIIToUTF16("expiration_month");
1357 form.fields.push_back(field);
1359 field.label = ASCIIToUTF16("Expiration Year");
1360 field.name = ASCIIToUTF16("expiration_year");
1361 form.fields.push_back(field);
1372 EXPECT_EQ(CREDIT_CARD_NAME, form_structure->field(0)->heuristic_type());
1374 EXPECT_EQ(ADDRESS_HOME_LINE1, form_structure->field(1)->heuristic_type());
1376 EXPECT_EQ(CREDIT_CARD_NUMBER, form_structure->field(2)->heuristic_type());
1378 EXPECT_EQ(CREDIT_CARD_EXP_MONTH, form_structure->field(3)->heuristic_type());
1381 form_structure->field(4)->heuristic_type());
1389 FormFieldData field;
1390 field.form_control_type = "text";
1392 field.label = ASCIIToUTF16("Card number");
1393 field.name = ASCIIToUTF16("ccnumber");
1394 form.fields.push_back(field);
1396 field.label = ASCIIToUTF16("First name");
1397 field.name = ASCIIToUTF16("first_name");
1398 form.fields.push_back(field);
1400 field.label = ASCIIToUTF16("Last name");
1401 field.name = ASCIIToUTF16("last_name");
1402 form.fields.push_back(field);
1404 field.label = ASCIIToUTF16("Expiration date");
1405 field.name = ASCIIToUTF16("ccexpiresmonth");
1406 form.fields.push_back(field);
1408 field.label = base::string16();
1409 field.name = ASCIIToUTF16("ccexpiresyear");
1410 form.fields.push_back(field);
1412 field.label = ASCIIToUTF16("cvc number");
1413 field.name = ASCIIToUTF16("csc");
1414 form.fields.push_back(field);
1425 EXPECT_EQ(CREDIT_CARD_NUMBER, form_structure->field(0)->heuristic_type());
1427 EXPECT_EQ(CREDIT_CARD_NAME, form_structure->field(1)->heuristic_type());
1429 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(2)->heuristic_type());
1431 EXPECT_EQ(CREDIT_CARD_EXP_MONTH, form_structure->field(3)->heuristic_type());
1434 form_structure->field(4)->heuristic_type());
1437 form_structure->field(5)->heuristic_type());
1444 FormFieldData field;
1445 field.form_control_type = "text";
1447 field.label = ASCIIToUTF16("Name on Card");
1448 field.name = ASCIIToUTF16("name_on_card");
1449 form.fields.push_back(field);
1451 field.label = ASCIIToUTF16("Address");
1452 field.name = ASCIIToUTF16("billing_address");
1453 form.fields.push_back(field);
1455 field.label = ASCIIToUTF16("Card Number");
1456 field.name = ASCIIToUTF16("card_number");
1457 form.fields.push_back(field);
1459 field.label = ASCIIToUTF16("Expiration Date");
1460 field.name = ASCIIToUTF16("expiration_month");
1461 form.fields.push_back(field);
1463 field.label = ASCIIToUTF16("Expiration Year");
1464 field.name = ASCIIToUTF16("expiration_year");
1465 form.fields.push_back(field);
1467 // Add checkable field.
1482 "signature=\"11337937696949187602\"><field signature=\"412125936\"/>"
1483 "<field signature=\"1917667676\"/><field signature=\"2226358947\"/>"
1484 "<field signature=\"747221617\"/><field signature=\"4108155786\"/></form>"
1504 field.label = ASCIIToUTF16("Address");
1505 field.name = ASCIIToUTF16("address");
1506 form.fields.push_back(field);
1520 "signature=\"11337937696949187602\"><field signature=\"412125936\"/>"
1521 "<field signature=\"1917667676\"/><field signature=\"2226358947\"/>"
1522 "<field signature=\"747221617\"/><field signature=\"4108155786\"/></form>"
1523 "<form signature=\"8308881815906226214\"><field signature=\"412125936\"/>"
1524 "<field signature=\"1917667676\"/><field signature=\"2226358947\"/>"
1525 "<field signature=\"747221617\"/><field signature=\"4108155786\"/><field "
1526 "signature=\"509334676\"/><field signature=\"509334676\"/><field "
1527 "signature=\"509334676\"/><field signature=\"509334676\"/><field "
1535 field.label = ASCIIToUTF16("Address");
1536 field.name = ASCIIToUTF16("address");
1537 malformed_form.fields.push_back(field);
1567 FormFieldData field;
1568 field.form_control_type = "text";
1570 field.label = ASCIIToUTF16("First Name");
1571 field.name = ASCIIToUTF16("firstname");
1572 form.fields.push_back(field);
1576 field.label = ASCIIToUTF16("Last Name");
1577 field.name = ASCIIToUTF16("lastname");
1578 form.fields.push_back(field);
1582 field.label = ASCIIToUTF16("Email");
1583 field.name = ASCIIToUTF16("email");
1584 field.form_control_type = "email";
1585 form.fields.push_back(field);
1589 field.label = ASCIIToUTF16("Phone");
1590 field.name = ASCIIToUTF16("phone");
1591 field.form_control_type = "number";
1592 form.fields.push_back(field);
1596 field.label = ASCIIToUTF16("Country");
1597 field.name = ASCIIToUTF16("country");
1598 field.form_control_type = "select-one";
1599 form.fields.push_back(field);
1603 // Add checkable field.
1616 form_structure->field(i)->set_possible_types(possible_field_types[i]);
1636 "<field signature=\"3763331450\" autofilltype=\"3\"/>"
1637 "<field signature=\"3494530716\" autofilltype=\"5\"/>"
1638 "<field signature=\"1029417091\" autofilltype=\"9\"/>"
1639 "<field signature=\"466116101\" autofilltype=\"14\"/>"
1640 "<field signature=\"2799270304\" autofilltype=\"36\"/>"
1649 "<field signature=\"3763331450\" autofilltype=\"3\"/>"
1650 "<field signature=\"3494530716\" autofilltype=\"5\"/>"
1651 "<field signature=\"1029417091\" autofilltype=\"9\"/>"
1652 "<field signature=\"466116101\" autofilltype=\"14\"/>"
1653 "<field signature=\"2799270304\" autofilltype=\"36\"/>"
1659 field.label = ASCIIToUTF16("Address");
1660 field.name = ASCIIToUTF16("address");
1661 field.form_control_type = "text";
1662 form.fields.push_back(field);
1673 form_structure->field(i)->set_possible_types(possible_field_types[i]);
1681 "<field signature=\"3763331450\" autofilltype=\"3\"/>"
1682 "<field signature=\"3494530716\" autofilltype=\"5\"/>"
1683 "<field signature=\"1029417091\" autofilltype=\"9\"/>"
1684 "<field signature=\"466116101\" autofilltype=\"14\"/>"
1685 "<field signature=\"2799270304\" autofilltype=\"36\"/>"
1686 "<field signature=\"509334676\" autofilltype=\"30\"/>"
1687 "<field signature=\"509334676\" autofilltype=\"31\"/>"
1688 "<field signature=\"509334676\" autofilltype=\"37\"/>"
1689 "<field signature=\"509334676\" autofilltype=\"38\"/>"
1690 "<field signature=\"509334676\" autofilltype=\"30\"/>"
1691 "<field signature=\"509334676\" autofilltype=\"31\"/>"
1692 "<field signature=\"509334676\" autofilltype=\"37\"/>"
1693 "<field signature=\"509334676\" autofilltype=\"38\"/>"
1699 field.label = ASCIIToUTF16("Address");
1700 field.name = ASCIIToUTF16("address");
1701 field.form_control_type = "text";
1702 form.fields.push_back(field);
1712 form_structure->field(i)->set_possible_types(possible_field_types[i]);
1725 FormFieldData field;
1726 field.form_control_type = "text";
1728 field.label = ASCIIToUTF16("First Name");
1729 field.name = ASCIIToUTF16("firstname");
1730 form.fields.push_back(field);
1734 field.label = ASCIIToUTF16("Last Name");
1735 field.name = ASCIIToUTF16("lastname");
1736 form.fields.push_back(field);
1740 field.label = ASCIIToUTF16("Email");
1741 field.name = ASCIIToUTF16("email");
1742 field.form_control_type = "email";
1743 form.fields.push_back(field);
1747 field.label = ASCIIToUTF16("Phone");
1748 field.name = ASCIIToUTF16("phone");
1749 field.form_control_type = "number";
1750 form.fields.push_back(field);
1754 field.label = ASCIIToUTF16("Country");
1755 field.name = ASCIIToUTF16("country");
1756 field.form_control_type = "select-one";
1757 form.fields.push_back(field);
1761 // Add checkable field.
1774 form_structure->field(i)->set_possible_types(possible_field_types[i]);
1804 field.label = ASCIIToUTF16("Address");
1805 field.name = ASCIIToUTF16("address");
1806 field.form_control_type = "text";
1807 form.fields.push_back(field);
1818 form_structure->field(i)->set_possible_types(possible_field_types[i]);
1849 FormFieldData field;
1850 field.form_control_type = "text";
1852 field.label = ASCIIToUTF16("First Name");
1853 field.name = ASCIIToUTF16("first");
1854 form.fields.push_back(field);
1856 field.label = ASCIIToUTF16("Last Name");
1857 field.name = ASCIIToUTF16("last");
1858 form.fields.push_back(field);
1860 field.label = ASCIIToUTF16("Email");
1861 field.name = ASCIIToUTF16("email");
1862 form.fields.push_back(field);
1869 form_structure.field(i)->set_possible_types(unknown_type);
1883 "<field signature=\"1089846351\" autofilltype=\"1\"/>"
1884 "<field signature=\"2404144663\" autofilltype=\"1\"/>"
1885 "<field signature=\"420638584\" autofilltype=\"1\"/>"
1913 "<field signature=\"1089846351\" autofilltype=\"1\"/>"
1914 "<field signature=\"2404144663\" autofilltype=\"1\"/>"
1915 "<field signature=\"420638584\" autofilltype=\"1\"/>"
1967 "<field signature=\"1089846351\" autofilltype=\"1\"/>"
1968 "<field signature=\"2404144663\" autofilltype=\"1\"/>"
1969 "<field signature=\"420638584\" autofilltype=\"1\"/>"
1999 "<field signature=\"1089846351\" autofilltype=\"1\"/>"
2000 "<field signature=\"2404144663\" autofilltype=\"1\"/>"
2001 "<field signature=\"420638584\" autofilltype=\"1\"/>"
2067 "<field signature=\"1089846351\" autofilltype=\"1\"/>"
2068 "<field signature=\"2404144663\" autofilltype=\"1\"/>"
2069 "<field signature=\"420638584\" autofilltype=\"1\"/>"
2097 // Check that multiple types for the field are processed correctly.
2103 FormFieldData field;
2104 field.form_control_type = "text";
2106 field.label = ASCIIToUTF16("email");
2107 field.name = ASCIIToUTF16("email");
2108 form.fields.push_back(field);
2112 field.label = ASCIIToUTF16("First Name");
2113 field.name = ASCIIToUTF16("first");
2114 form.fields.push_back(field);
2118 field.label = ASCIIToUTF16("Last Name");
2119 field.name = ASCIIToUTF16("last");
2120 form.fields.push_back(field);
2124 field.label = ASCIIToUTF16("Address");
2125 field.name = ASCIIToUTF16("address");
2126 form.fields.push_back(field);
2133 form_structure->field(i)->set_possible_types(possible_field_types[i]);
2143 "<field signature=\"420638584\" autofilltype=\"9\"/>"
2144 "<field signature=\"1089846351\" autofilltype=\"3\"/>"
2145 "<field signature=\"2404144663\" autofilltype=\"5\"/>"
2146 "<field signature=\"509334676\" autofilltype=\"30\"/>"
2149 // Match third field as both first and last.
2151 form_structure->field(2)->set_possible_types(possible_field_types[2]);
2158 "<field signature=\"420638584\" autofilltype=\"9\"/>"
2159 "<field signature=\"1089846351\" autofilltype=\"3\"/>"
2160 "<field signature=\"2404144663\" autofilltype=\"3\"/>"
2161 "<field signature=\"2404144663\" autofilltype=\"5\"/>"
2162 "<field signature=\"509334676\" autofilltype=\"30\"/>"
2166 form_structure->field(form_structure->field_count() - 1)->set_possible_types(
2174 "<field signature=\"420638584\" autofilltype=\"9\"/>"
2175 "<field signature=\"1089846351\" autofilltype=\"3\"/>"
2176 "<field signature=\"2404144663\" autofilltype=\"3\"/>"
2177 "<field signature=\"2404144663\" autofilltype=\"5\"/>"
2178 "<field signature=\"509334676\" autofilltype=\"30\"/>"
2179 "<field signature=\"509334676\" autofilltype=\"31\"/>"
2185 form_structure->field(form_structure->field_count() - 1)->set_possible_types(
2193 "<field signature=\"420638584\" autofilltype=\"9\"/>"
2194 "<field signature=\"1089846351\" autofilltype=\"3\"/>"
2195 "<field signature=\"2404144663\" autofilltype=\"3\"/>"
2196 "<field signature=\"2404144663\" autofilltype=\"5\"/>"
2197 "<field signature=\"509334676\" autofilltype=\"30\"/>"
2198 "<field signature=\"509334676\" autofilltype=\"60\"/>"
2209 FormFieldData field;
2210 field.form_control_type = "text";
2212 field.label = ASCIIToUTF16("email");
2213 field.name = ASCIIToUTF16("email");
2214 form.fields.push_back(field);
2216 field.label = ASCIIToUTF16("First Name");
2217 field.name = ASCIIToUTF16("first");
2218 form.fields.push_back(field);
2221 field.label = ASCIIToUTF16("Select");
2222 field.name = ASCIIToUTF16("Select");
2223 field.form_control_type = "checkbox";
2224 field.is_checkable = true;
2225 form.fields.push_back(field);
2251 field.is_checkable = false;
2252 field.label = ASCIIToUTF16("Random Field label");
2253 field.name = ASCIIToUTF16("random1234");
2254 field.form_control_type = "text";
2255 form.fields.push_back(field);
2256 field.label = ASCIIToUTF16("Random Field label2");
2257 field.name = ASCIIToUTF16("random12345");
2258 form.fields.push_back(field);
2259 field.label = ASCIIToUTF16("Random Field label3");
2260 field.name = ASCIIToUTF16("1random12345678");
2261 form.fields.push_back(field);
2262 field.label = ASCIIToUTF16("Random Field label3");
2263 field.name = ASCIIToUTF16("12345random");
2264 form.fields.push_back(field);
2280 FormFieldData field;
2281 field.label = ASCIIToUTF16("username");
2282 field.name = ASCIIToUTF16("username");
2283 field.form_control_type = "text";
2284 form.fields.push_back(field);
2286 field.label = ASCIIToUTF16("password");
2287 field.name = ASCIIToUTF16("password");
2288 field.form_control_type = "password";
2289 form.fields.push_back(field);
2291 field.label = base::string16();
2292 field.name = ASCIIToUTF16("Submit");
2293 field.form_control_type = "submit";
2294 form.fields.push_back(field);
2311 FormFieldData field;
2312 field.label = ASCIIToUTF16("username");
2313 field.name = ASCIIToUTF16("username");
2314 field.form_control_type = "text";
2315 form.fields.push_back(field);
2317 field.label = ASCIIToUTF16("select");
2318 field.name = ASCIIToUTF16("select");
2319 field.form_control_type = "checkbox";
2320 field.is_checkable = true;
2321 form.fields.push_back(field);
2323 field.label = base::string16();
2324 field.name = ASCIIToUTF16("email");
2325 field.form_control_type = "text";
2326 field.is_checkable = false;
2327 form.fields.push_back(field);
2338 "signature=\"18006745212084723782\"><field signature=\"239111655\"/>"
2339 "<field signature=\"420638584\"/></form></autofillquery>";