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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc

Issue 310463005: Fill in more name fields with requestAutocomplete (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: todo Created 6 years, 6 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: chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
index 30dff1ad446064a77ccc706a63fc31e1f7889143..e617f222f0ca1e5ab3a69bdf8df3cbbbd1c745d6 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
@@ -1461,6 +1461,67 @@ TEST_F(AutofillDialogControllerTest, BillingVsShippingStreetAddress) {
form_structure()->field(2)->value);
}
+// Test asking for different pieces of the name.
+TEST_F(AutofillDialogControllerTest, NamePieces) {
+ const char* const attributes[] = {
+ "shipping name",
+ "billing name",
+ "billing given-name",
+ "billing family-name",
+ "billing additional-name",
+ "cc-csc"
+ };
+
+ FormData form_data;
+ for (size_t i = 0; i < arraysize(attributes); ++i) {
+ FormFieldData field;
+ field.autocomplete_attribute.assign(attributes[i]);
+ form_data.fields.push_back(field);
+ }
+
+ SetUpControllerWithFormData(form_data);
+ SwitchToAutofill();
+
+ // Billing.
+ AutofillProfile test_profile(test::GetVerifiedProfile());
+ test_profile.SetRawInfo(NAME_FULL, ASCIIToUTF16("Fabian Jackson von Nacho"));
+ controller()->GetTestingManager()->AddTestingProfile(&test_profile);
+
+ // Credit card.
+ CreditCard credit_card(test::GetVerifiedCreditCard());
+ controller()->GetTestingManager()->AddTestingCreditCard(&credit_card);
+
+ // Make shipping name different from billing.
+ AutofillProfile test_profile2(test::GetVerifiedProfile2());
+ test_profile2.SetRawInfo(NAME_FULL, ASCIIToUTF16("Don Ford"));
+ controller()->GetTestingManager()->AddTestingProfile(&test_profile2);
+ ui::MenuModel* shipping_model =
+ controller()->MenuModelForSection(SECTION_SHIPPING);
+ shipping_model->ActivatedAt(2);
+
+ controller()->OnAccept();
+
+ EXPECT_EQ(NAME_FULL, form_structure()->field(0)->Type().GetStorableType());
+ EXPECT_EQ(ASCIIToUTF16("Don Ford"),
+ form_structure()->field(0)->value);
+
+ EXPECT_EQ(NAME_FULL, form_structure()->field(1)->Type().GetStorableType());
+ EXPECT_EQ(ASCIIToUTF16("Fabian Jackson von Nacho"),
+ form_structure()->field(1)->value);
+
+ EXPECT_EQ(NAME_FIRST, form_structure()->field(2)->Type().GetStorableType());
+ EXPECT_EQ(ASCIIToUTF16("Fabian"),
+ form_structure()->field(2)->value);
+
+ EXPECT_EQ(NAME_LAST, form_structure()->field(3)->Type().GetStorableType());
+ EXPECT_EQ(ASCIIToUTF16("von Nacho"),
+ form_structure()->field(3)->value);
+
+ EXPECT_EQ(NAME_MIDDLE, form_structure()->field(4)->Type().GetStorableType());
+ EXPECT_EQ(ASCIIToUTF16("Jackson"),
+ form_structure()->field(4)->value);
+}
+
TEST_F(AutofillDialogControllerTest, AcceptLegalDocuments) {
for (size_t i = 0; i < 2; ++i) {
SCOPED_TRACE(testing::Message() << "Case " << i);

Powered by Google App Engine
This is Rietveld 408576698