Lines Matching defs:form
147 // Populates |form| with data corresponding to a simple address form.
148 // Note that this actually appends fields to the form data, which can be useful
150 void CreateTestAddressFormData(FormData* form) {
151 form->name = ASCIIToUTF16("MyForm");
152 form->method = ASCIIToUTF16("POST");
153 form->origin = GURL("http://myform.com/form.html");
154 form->action = GURL("http://myform.com/submit.html");
155 form->user_submitted = true;
160 form->fields.push_back(field);
163 form->fields.push_back(field);
166 form->fields.push_back(field);
169 form->fields.push_back(field);
172 form->fields.push_back(field);
175 form->fields.push_back(field);
178 form->fields.push_back(field);
181 form->fields.push_back(field);
184 form->fields.push_back(field);
187 form->fields.push_back(field);
190 form->fields.push_back(field);
193 form->fields.push_back(field);
196 // Populates |form| with data corresponding to a simple credit card form.
197 // Note that this actually appends fields to the form data, which can be useful
199 void CreateTestCreditCardFormData(FormData* form,
202 form->name = ASCIIToUTF16("MyForm");
203 form->method = ASCIIToUTF16("POST");
205 form->origin = GURL("https://myform.com/form.html");
206 form->action = GURL("https://myform.com/submit.html");
208 form->origin = GURL("http://myform.com/form.html");
209 form->action = GURL("http://myform.com/submit.html");
211 form->user_submitted = true;
216 form->fields.push_back(field);
219 form->fields.push_back(field);
223 form->fields.push_back(field);
227 form->fields.push_back(field);
230 form->fields.push_back(field);
293 EXPECT_EQ(GURL("https://myform.com/form.html"), filled_form.origin);
296 EXPECT_EQ(GURL("http://myform.com/form.html"), filled_form.origin);
458 void AddSeenForm(FormStructure* form) {
459 form_structures()->push_back(form);
493 const webkit_glue::FormData& form,
495 autofill_manager_->OnQueryFormFieldAutofill(query_id, form, field);
498 void GetAutofillSuggestions(const webkit_glue::FormData& form,
500 GetAutofillSuggestions(kDefaultPageID, form, field);
512 void FormSubmitted(const FormData& form) {
513 autofill_manager_->OnFormSubmitted(form);
517 const webkit_glue::FormData& form,
520 autofill_manager_->OnFillAutofillFormData(query_id, form, field, unique_id);
579 explicit TestFormStructure(const FormData& form) : FormStructure(form) {}
601 // Test that we return all address profile suggestions when all form fields are
604 // Set up our form data.
605 FormData form;
606 CreateTestAddressFormData(&form);
607 std::vector<FormData> forms(1, form);
610 const FormField& field = form.fields[0];
611 GetAutofillSuggestions(form, field);
644 // selected form field has been partially filled out.
646 // Set up our form data.
647 FormData form;
648 CreateTestAddressFormData(&form);
649 std::vector<FormData> forms(1, form);
655 GetAutofillSuggestions(form, field);
679 // Test that we return no suggestions when the form has no relevant fields.
681 // Set up our form data.
682 FormData form;
683 form.name = ASCIIToUTF16("MyForm");
684 form.method = ASCIIToUTF16("POST");
685 form.origin = GURL("http://myform.com/form.html");
686 form.action = GURL("http://myform.com/submit.html");
687 form.user_submitted = true;
692 form.fields.push_back(field);
695 form.fields.push_back(field);
697 form.fields.push_back(field);
699 form.fields.push_back(field);
701 std::vector<FormData> forms(1, form);
704 GetAutofillSuggestions(form, field);
710 // Set up our form data.
711 FormData form;
712 CreateTestAddressFormData(&form);
713 std::vector<FormData> forms(1, form);
723 const FormField& field = form.fields[0];
724 GetAutofillSuggestions(form, field);
756 // Set up our form data.
757 FormData form;
758 CreateTestAddressFormData(&form);
759 std::vector<FormData> forms(1, form);
765 const FormField& field = form.fields[0];
766 GetAutofillSuggestions(form, field);
771 // unavailable when the form method is GET rather than POST.
773 // Set up our form data.
774 FormData form;
775 CreateTestAddressFormData(&form);
776 form.method = ASCIIToUTF16("GET");
777 std::vector<FormData> forms(1, form);
780 const FormField& field = form.fields[0];
781 GetAutofillSuggestions(form, field);
809 GetAutofillSuggestions(kPageID2, form, field);
833 GetAutofillSuggestions(form, field);
837 // Test that we return all credit card profile suggestions when all form fields
840 // Set up our form data.
841 FormData form;
842 CreateTestCreditCardFormData(&form, true, false);
843 std::vector<FormData> forms(1, form);
846 FormField field = form.fields[1];
847 GetAutofillSuggestions(form, field);
881 // selected form field has been partially filled out.
883 // Set up our form data.
884 FormData form;
885 CreateTestCreditCardFormData(&form, true, false);
886 std::vector<FormData> forms(1, form);
892 GetAutofillSuggestions(form, field);
916 // Test that we return credit card profile suggestions when the selected form
919 // Set up our form data.
920 FormData form;
921 CreateTestCreditCardFormData(&form, true, false);
922 std::vector<FormData> forms(1, form);
925 const FormField& field = form.fields[0];
926 GetAutofillSuggestions(form, field);
960 // are unavailable when the form is not https.
962 // Set up our form data.
963 FormData form;
964 CreateTestCreditCardFormData(&form, false, false);
965 std::vector<FormData> forms(1, form);
968 const FormField& field = form.fields[0];
969 GetAutofillSuggestions(form, field);
997 GetAutofillSuggestions(kPageID2, form, field);
1020 GetAutofillSuggestions(form, field);
1036 // Set up our form data.
1037 FormData form;
1038 CreateTestCreditCardFormData(&form, true, false);
1039 std::vector<FormData> forms(1, form);
1042 FormField field = form.fields[1];
1043 GetAutofillSuggestions(form, field);
1085 // Set up our form data.
1086 FormData form;
1087 CreateTestAddressFormData(&form);
1088 CreateTestCreditCardFormData(&form, true, false);
1089 std::vector<FormData> forms(1, form);
1092 FormField field = form.fields[0];
1093 GetAutofillSuggestions(form, field);
1125 GetAutofillSuggestions(kPageID2, form, field);
1157 // unavailable when the form is not https.
1159 // Set up our form data.
1160 FormData form;
1161 CreateTestAddressFormData(&form);
1162 CreateTestCreditCardFormData(&form, false, false);
1163 std::vector<FormData> forms(1, form);
1166 FormField field = form.fields[0];
1167 GetAutofillSuggestions(form, field);
1199 GetAutofillSuggestions(kPageID2, form, field);
1221 GetAutofillSuggestions(form, field);
1227 // Set up our form data.
1228 FormData form;
1229 CreateTestAddressFormData(&form);
1230 std::vector<FormData> forms(1, form);
1233 const FormField& field = form.fields[0];
1234 GetAutofillSuggestions(form, field);
1276 // Set up our form data.
1277 FormData form;
1278 CreateTestAddressFormData(&form);
1279 std::vector<FormData> forms(1, form);
1283 form.fields[2].is_autofilled = true;
1284 const FormField& field = form.fields[0];
1285 GetAutofillSuggestions(form, field);
1314 // Set up our form data.
1315 FormData form;
1316 CreateTestAddressFormData(&form);
1320 form.fields.push_back(field);
1321 std::vector<FormData> forms(1, form);
1324 GetAutofillSuggestions(form, field);
1357 // Set up our form data.
1358 FormData form;
1359 CreateTestAddressFormData(&form);
1360 std::vector<FormData> forms(1, form);
1370 FormField& field = form.fields[0];
1373 GetAutofillSuggestions(form, field);
1398 // unfilled form.
1400 // Set up our form data.
1401 FormData form;
1402 CreateTestAddressFormData(&form);
1403 std::vector<FormData> forms(1, form);
1418 FormField& field = form.fields[0];
1421 GetAutofillSuggestions(form, field);
1445 // form. This is the per-field "override" case.
1447 // Set up our form data.
1448 FormData form;
1449 CreateTestAddressFormData(&form);
1450 std::vector<FormData> forms(1, form);
1465 FormField& field = form.fields[0];
1468 GetAutofillSuggestions(form, field);
1495 // Test that we correctly fill an address form.
1497 // Set up our form data.
1498 FormData form;
1499 CreateTestAddressFormData(&form);
1500 std::vector<FormData> forms(1, form);
1506 kDefaultPageID, form, form.fields[0],
1515 // Test that we correctly fill a credit card form.
1517 // Set up our form data.
1518 FormData form;
1519 CreateTestCreditCardFormData(&form, true, false);
1520 std::vector<FormData> forms(1, form);
1526 kDefaultPageID, form, *form.fields.begin(),
1535 // Test that we correctly fill a credit card form with month input type.
1541 // Set up our form data.
1542 FormData form;
1543 CreateTestCreditCardFormData(&form, true, true);
1544 std::vector<FormData> forms(1, form);
1550 kDefaultPageID, form, *form.fields.begin(),
1561 // Test that we correctly fill a credit card form with month input type.
1567 // Set up our form data.
1568 FormData form;
1569 CreateTestCreditCardFormData(&form, true, true);
1570 std::vector<FormData> forms(1, form);
1576 kDefaultPageID, form, *form.fields.begin(),
1586 // Test that we correctly fill a credit card form with month input type.
1592 // Set up our form data.
1593 FormData form;
1594 CreateTestCreditCardFormData(&form, true, true);
1595 std::vector<FormData> forms(1, form);
1601 kDefaultPageID, form, *form.fields.begin(),
1611 // Test that we correctly fill a credit card form with month input type.
1618 // Set up our form data.
1619 FormData form;
1620 CreateTestCreditCardFormData(&form, true, true);
1621 std::vector<FormData> forms(1, form);
1627 kDefaultPageID, form, *form.fields.begin(),
1637 // Test that we correctly fill a combined address and credit card form.
1639 // Set up our form data.
1640 FormData form;
1641 CreateTestAddressFormData(&form);
1642 CreateTestCreditCardFormData(&form, true, false);
1643 std::vector<FormData> forms(1, form);
1649 FillAutofillFormData(kDefaultPageID, form, form.fields[0],
1664 kPageID2, form, form.fields.back(),
1675 // Test that we correctly fill a form that has multiple logical sections, e.g.
1678 // Set up our form data.
1679 FormData form;
1680 CreateTestAddressFormData(&form);
1681 const size_t kAddressFormSize = form.fields.size();
1682 CreateTestAddressFormData(&form);
1683 for (size_t i = kAddressFormSize; i < form.fields.size(); ++i) {
1685 form.fields[i].name = form.fields[i].name + ASCIIToUTF16("_");
1687 std::vector<FormData> forms(1, form);
1693 FillAutofillFormData(kDefaultPageID, form, form.fields[0],
1704 for (size_t i = kAddressFormSize; i < form.fields.size(); ++i) {
1718 FillAutofillFormData(kPageID2, form, form.fields[kAddressFormSize + 9],
1725 ASSERT_EQ(results.fields.size(), form.fields.size());
1747 // Test that we correctly fill a form that has a single logical section with
1750 // Set up our form data.
1751 FormData form;
1752 CreateTestAddressFormData(&form);
1756 form.fields.push_back(field);
1758 std::vector<FormData> forms(1, form);
1761 // Fill the form.
1764 FillAutofillFormData(kDefaultPageID, form, form.fields[0],
1774 // The remainder of the form should be filled as usual.
1779 // Test that we correctly fill a previously auto-filled form.
1781 // Set up our form data.
1782 FormData form;
1783 CreateTestAddressFormData(&form);
1785 form.fields[4].is_autofilled = true;
1786 CreateTestCreditCardFormData(&form, true, false);
1787 std::vector<FormData> forms(1, form);
1794 kDefaultPageID, form, *form.fields.begin(),
1811 kPageID2, form, form.fields.back(),
1823 for (std::vector<FormField>::iterator iter = form.fields.begin();
1824 iter != form.fields.end();
1831 kPageID3, form, *form.fields.rbegin(),
1846 // Set up our form data.
1847 FormData form;
1848 form.name = ASCIIToUTF16("MyPhoneForm");
1849 form.method = ASCIIToUTF16("POST");
1850 form.origin = GURL("http://myform.com/phone_form.html");
1851 form.action = GURL("http://myform.com/phone_submit.html");
1852 form.user_submitted = true;
1858 form.fields.push_back(field);
1862 form.fields.push_back(field);
1866 form.fields.push_back(field);
1870 form.fields.push_back(field);
1874 form.fields.push_back(field);
1876 std::vector<FormData> forms(1, form);
1896 page_id, form, *form.fields.begin(),
1915 // Test that we can still fill a form when a field has been removed from it.
1917 // Set up our form data.
1918 FormData form;
1919 CreateTestAddressFormData(&form);
1924 form.fields.insert(form.fields.begin() + 3, field);
1926 std::vector<FormData> forms(1, form);
1930 form.fields.erase(form.fields.begin() + 3);
1935 kDefaultPageID, form, form.fields[0],
1944 // Test that we can still fill a form when a field has been added to it.
1946 // The offset of the fax field in the address form.
1949 // Set up our form data.
1950 FormData form;
1951 CreateTestAddressFormData(&form);
1954 std::vector<FormField>::iterator pos = form.fields.begin() + kFaxFieldOffset;
1956 pos = form.fields.erase(pos);
1958 std::vector<FormData> forms(1, form);
1962 form.fields.insert(pos, field);
1967 kDefaultPageID, form, form.fields[0],
1976 // Test that we are able to save form data when forms are submitted.
1978 // Set up our form data.
1979 FormData form;
1980 CreateTestAddressFormData(&form);
1981 std::vector<FormData> forms(1, form);
1984 // Fill the form.
1987 FillAutofillFormData(kDefaultPageID, form, form.fields[0],
1995 // Simulate form submission. We should call into the PDM to try to save the
2001 // Test that we are able to save form data when forms are submitted and we only
2004 // Set up our form data.
2005 FormData form;
2006 CreateTestAddressFormData(&form);
2008 // Simulate having seen this form on page load.
2010 TestFormStructure* form_structure = new TestFormStructure(form);
2015 for (size_t i = 0; i < form.fields.size(); ++i) {
2022 // Fill the form.
2025 FillAutofillFormData(kDefaultPageID, form, form.fields[0],
2033 // Simulate form submission. We should call into the PDM to try to save the