Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Unified Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 1694443004: [Autofill] Add credit card first and last name heuristics predictions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_manager_unittest.cc
diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc
index 3588d9d34e9a2b4e8548d1e9ea34e7835f2eed6f..b66f15f6a3da6111cddc3a20fd601302be7d1730 100644
--- a/components/autofill/core/browser/autofill_manager_unittest.cc
+++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -1979,6 +1979,42 @@ TEST_F(AutofillManagerTest, FillCreditCardFormYearMonth) {
kDefaultPageID, false, "2012", "04");
}
+// Test that we correctly fill a credit card form with first and last cardholder
+// name.
+TEST_F(AutofillManagerTest, FillCreditCardFormSplitName) {
+ // Set up our form data.
+ FormData form;
+ form.name = ASCIIToUTF16("MyForm");
+ form.origin = GURL("https://myform.com/form.html");
+ form.action = GURL("https://myform.com/submit.html");
+
+ FormFieldData field;
+ test::CreateTestFormField("Card Name", "cardname", "", "text", &field);
+ form.fields.push_back(field);
+ test::CreateTestFormField("Last Name", "cardlastname", "", "text", &field);
+ form.fields.push_back(field);
+ test::CreateTestFormField("Card Number", "cardnumber", "", "text", &field);
+ form.fields.push_back(field);
+ test::CreateTestFormField("CVC", "cvc", "", "text", &field);
+ form.fields.push_back(field);
+
+ std::vector<FormData> forms(1, form);
+ FormsSeen(forms);
+
+ const char guid[] = "00000000-0000-0000-0000-000000000004";
+ int response_page_id = 0;
+ FormData response_data;
+ FillAutofillFormDataAndSaveResults(kDefaultPageID, form, *form.fields.begin(),
+ MakeFrontendID(guid, std::string()),
+ &response_page_id, &response_data);
+ ExpectFilledField("Card Name", "cardname", "Elvis", "text",
+ response_data.fields[0]);
+ ExpectFilledField("Last Name", "cardlastname", "Presley", "text",
+ response_data.fields[1]);
+ ExpectFilledField("Card Number", "cardnumber", "4234567890123456", "text",
+ response_data.fields[2]);
+}
+
// Test that we correctly fill a combined address and credit card form.
TEST_F(AutofillManagerTest, FillAddressAndCreditCardForm) {
// Set up our form data.

Powered by Google App Engine
This is Rietveld 408576698