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

Side by Side 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: rename 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <map> 5 #include <map>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 form_structure()->field(2)->value); 1453 form_structure()->field(2)->value);
1454 EXPECT_EQ(billing_profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS), 1454 EXPECT_EQ(billing_profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS),
1455 form_structure()->field(3)->value); 1455 form_structure()->field(3)->value);
1456 1456
1457 EXPECT_NE(form_structure()->field(1)->value, 1457 EXPECT_NE(form_structure()->field(1)->value,
1458 form_structure()->field(0)->value); 1458 form_structure()->field(0)->value);
1459 EXPECT_NE(form_structure()->field(3)->value, 1459 EXPECT_NE(form_structure()->field(3)->value,
1460 form_structure()->field(2)->value); 1460 form_structure()->field(2)->value);
1461 } 1461 }
1462 1462
1463 // Test asking for different pieces of the name.
1464 TEST_F(AutofillDialogControllerTest, NamePieces) {
1465 const char* const attributes[] = {
1466 "shipping name",
1467 "billing name",
1468 "billing given-name",
1469 "billing family-name",
1470 "billing additional-name",
1471 "cc-csc"
1472 };
1473
1474 FormData form_data;
1475 for (size_t i = 0; i < arraysize(attributes); ++i) {
1476 FormFieldData field;
1477 field.autocomplete_attribute.assign(attributes[i]);
1478 form_data.fields.push_back(field);
1479 }
1480
1481 SetUpControllerWithFormData(form_data);
1482 SwitchToAutofill();
1483
1484 // Billing.
1485 AutofillProfile test_profile(test::GetVerifiedProfile());
1486 test_profile.SetRawInfo(NAME_FULL, ASCIIToUTF16("Fabian Jackson von Nacho"));
1487 controller()->GetTestingManager()->AddTestingProfile(&test_profile);
1488
1489 // Credit card.
1490 CreditCard credit_card(test::GetVerifiedCreditCard());
1491 controller()->GetTestingManager()->AddTestingCreditCard(&credit_card);
1492
1493 // Make shipping name different from billing.
1494 AutofillProfile test_profile2(test::GetVerifiedProfile2());
1495 test_profile2.SetRawInfo(NAME_FULL, ASCIIToUTF16("Don Ford"));
1496 controller()->GetTestingManager()->AddTestingProfile(&test_profile2);
1497 ui::MenuModel* shipping_model =
1498 controller()->MenuModelForSection(SECTION_SHIPPING);
1499 shipping_model->ActivatedAt(2);
1500
1501 controller()->OnAccept();
1502
1503 EXPECT_EQ(NAME_FULL, form_structure()->field(0)->Type().GetStorableType());
1504 EXPECT_EQ(ASCIIToUTF16("Don Ford"),
1505 form_structure()->field(0)->value);
1506
1507 EXPECT_EQ(NAME_FULL, form_structure()->field(1)->Type().GetStorableType());
1508 EXPECT_EQ(ASCIIToUTF16("Fabian Jackson von Nacho"),
1509 form_structure()->field(1)->value);
1510
1511 EXPECT_EQ(NAME_FIRST, form_structure()->field(2)->Type().GetStorableType());
1512 EXPECT_EQ(ASCIIToUTF16("Fabian"),
1513 form_structure()->field(2)->value);
1514
1515 EXPECT_EQ(NAME_LAST, form_structure()->field(3)->Type().GetStorableType());
1516 EXPECT_EQ(ASCIIToUTF16("von Nacho"),
1517 form_structure()->field(3)->value);
1518
1519 EXPECT_EQ(NAME_MIDDLE, form_structure()->field(4)->Type().GetStorableType());
1520 EXPECT_EQ(ASCIIToUTF16("Jackson"),
1521 form_structure()->field(4)->value);
1522 }
1523
1463 TEST_F(AutofillDialogControllerTest, AcceptLegalDocuments) { 1524 TEST_F(AutofillDialogControllerTest, AcceptLegalDocuments) {
1464 for (size_t i = 0; i < 2; ++i) { 1525 for (size_t i = 0; i < 2; ++i) {
1465 SCOPED_TRACE(testing::Message() << "Case " << i); 1526 SCOPED_TRACE(testing::Message() << "Case " << i);
1466 1527
1467 EXPECT_CALL(*controller()->GetTestingWalletClient(), 1528 EXPECT_CALL(*controller()->GetTestingWalletClient(),
1468 AcceptLegalDocuments(_, _)); 1529 AcceptLegalDocuments(_, _));
1469 EXPECT_CALL(*controller()->GetTestingWalletClient(), GetFullWallet(_)); 1530 EXPECT_CALL(*controller()->GetTestingWalletClient(), GetFullWallet(_));
1470 EXPECT_CALL(*controller(), LoadRiskFingerprintData()); 1531 EXPECT_CALL(*controller(), LoadRiskFingerprintData());
1471 1532
1472 EXPECT_TRUE(controller()->LegalDocumentLinks().empty()); 1533 EXPECT_TRUE(controller()->LegalDocumentLinks().empty());
(...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after
3528 controller()->MenuModelForSection(SECTION_CC_BILLING)->ActivatedAt(2); 3589 controller()->MenuModelForSection(SECTION_CC_BILLING)->ActivatedAt(2);
3529 3590
3530 FieldValueMap outputs; 3591 FieldValueMap outputs;
3531 outputs[NAME_FULL] = ASCIIToUTF16("madonna"); 3592 outputs[NAME_FULL] = ASCIIToUTF16("madonna");
3532 controller()->GetView()->SetUserInput(SECTION_CC_BILLING, outputs); 3593 controller()->GetView()->SetUserInput(SECTION_CC_BILLING, outputs);
3533 3594
3534 ASSERT_NO_FATAL_FAILURE(SwitchToAutofill()); 3595 ASSERT_NO_FATAL_FAILURE(SwitchToAutofill());
3535 } 3596 }
3536 3597
3537 } // namespace autofill 3598 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698