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

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: dumb test is dumb 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 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 form_structure()->field(2)->value); 1454 form_structure()->field(2)->value);
1455 EXPECT_EQ(billing_profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS), 1455 EXPECT_EQ(billing_profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS),
1456 form_structure()->field(3)->value); 1456 form_structure()->field(3)->value);
1457 1457
1458 EXPECT_NE(form_structure()->field(1)->value, 1458 EXPECT_NE(form_structure()->field(1)->value,
1459 form_structure()->field(0)->value); 1459 form_structure()->field(0)->value);
1460 EXPECT_NE(form_structure()->field(3)->value, 1460 EXPECT_NE(form_structure()->field(3)->value,
1461 form_structure()->field(2)->value); 1461 form_structure()->field(2)->value);
1462 } 1462 }
1463 1463
1464 // Test asking for different pieces of the name.
1465 TEST_F(AutofillDialogControllerTest, NamePieces) {
1466 const char* const attributes[] = {
1467 "shipping name",
1468 "billing name",
1469 "billing given-name",
1470 "billing family-name",
1471 "billing additional-name",
1472 "cc-csc"
1473 };
1474
1475 FormData form_data;
1476 for (size_t i = 0; i < arraysize(attributes); ++i) {
1477 FormFieldData field;
1478 field.autocomplete_attribute.assign(attributes[i]);
1479 form_data.fields.push_back(field);
1480 }
1481
1482 SetUpControllerWithFormData(form_data);
1483 SwitchToAutofill();
1484
1485 // Billing.
1486 AutofillProfile test_profile(test::GetVerifiedProfile());
1487 test_profile.SetRawInfo(NAME_FULL, ASCIIToUTF16("Fabian Jackson von Nacho"));
1488 controller()->GetTestingManager()->AddTestingProfile(&test_profile);
1489
1490 // Credit card.
1491 CreditCard credit_card(test::GetVerifiedCreditCard());
1492 controller()->GetTestingManager()->AddTestingCreditCard(&credit_card);
1493
1494 // Make shipping name different from billing.
1495 AutofillProfile test_profile2(test::GetVerifiedProfile2());
1496 test_profile2.SetRawInfo(NAME_FULL, ASCIIToUTF16("Don Ford"));
1497 controller()->GetTestingManager()->AddTestingProfile(&test_profile2);
1498 ui::MenuModel* shipping_model =
1499 controller()->MenuModelForSection(SECTION_SHIPPING);
1500 shipping_model->ActivatedAt(2);
1501
1502 controller()->OnAccept();
1503
1504 EXPECT_EQ(NAME_FULL, form_structure()->field(0)->Type().GetStorableType());
1505 EXPECT_EQ(ASCIIToUTF16("Don Ford"),
1506 form_structure()->field(0)->value);
1507
1508 EXPECT_EQ(NAME_FULL, form_structure()->field(1)->Type().GetStorableType());
1509 EXPECT_EQ(ASCIIToUTF16("Fabian Jackson von Nacho"),
1510 form_structure()->field(1)->value);
1511
1512 EXPECT_EQ(NAME_FIRST, form_structure()->field(2)->Type().GetStorableType());
1513 EXPECT_EQ(ASCIIToUTF16("Fabian"),
1514 form_structure()->field(2)->value);
1515
1516 EXPECT_EQ(NAME_LAST, form_structure()->field(3)->Type().GetStorableType());
1517 EXPECT_EQ(ASCIIToUTF16("von Nacho"),
1518 form_structure()->field(3)->value);
1519
1520 EXPECT_EQ(NAME_MIDDLE, form_structure()->field(4)->Type().GetStorableType());
1521 EXPECT_EQ(ASCIIToUTF16("Jackson"),
1522 form_structure()->field(4)->value);
1523 }
1524
1464 TEST_F(AutofillDialogControllerTest, AcceptLegalDocuments) { 1525 TEST_F(AutofillDialogControllerTest, AcceptLegalDocuments) {
1465 for (size_t i = 0; i < 2; ++i) { 1526 for (size_t i = 0; i < 2; ++i) {
1466 SCOPED_TRACE(testing::Message() << "Case " << i); 1527 SCOPED_TRACE(testing::Message() << "Case " << i);
1467 1528
1468 EXPECT_CALL(*controller()->GetTestingWalletClient(), 1529 EXPECT_CALL(*controller()->GetTestingWalletClient(),
1469 AcceptLegalDocuments(_, _)); 1530 AcceptLegalDocuments(_, _));
1470 EXPECT_CALL(*controller()->GetTestingWalletClient(), GetFullWallet(_)); 1531 EXPECT_CALL(*controller()->GetTestingWalletClient(), GetFullWallet(_));
1471 EXPECT_CALL(*controller(), LoadRiskFingerprintData()); 1532 EXPECT_CALL(*controller(), LoadRiskFingerprintData());
1472 1533
1473 EXPECT_TRUE(controller()->LegalDocumentLinks().empty()); 1534 EXPECT_TRUE(controller()->LegalDocumentLinks().empty());
(...skipping 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after
3499 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(2)->value); 3560 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(2)->value);
3500 EXPECT_EQ(ADDRESS_HOME_COUNTRY, 3561 EXPECT_EQ(ADDRESS_HOME_COUNTRY,
3501 form_structure()->field(3)->Type().GetStorableType()); 3562 form_structure()->field(3)->Type().GetStorableType());
3502 EXPECT_EQ(ASCIIToUTF16("US"), form_structure()->field(3)->value); 3563 EXPECT_EQ(ASCIIToUTF16("US"), form_structure()->field(3)->value);
3503 EXPECT_EQ(ADDRESS_HOME_COUNTRY, 3564 EXPECT_EQ(ADDRESS_HOME_COUNTRY,
3504 form_structure()->field(4)->Type().GetStorableType()); 3565 form_structure()->field(4)->Type().GetStorableType());
3505 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(4)->value); 3566 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(4)->value);
3506 } 3567 }
3507 3568
3508 } // namespace autofill 3569 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_common.cc ('k') | components/autofill/core/browser/autofill_profile_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698