| Index: components/autofill/core/browser/personal_data_manager_unittest.cc
|
| diff --git a/components/autofill/core/browser/personal_data_manager_unittest.cc b/components/autofill/core/browser/personal_data_manager_unittest.cc
|
| index 81724d770096a898f8baf4328aaffdba718b398c..9caeddb64aec15b535fc0b6bca9a97f1ad1bf266 100644
|
| --- a/components/autofill/core/browser/personal_data_manager_unittest.cc
|
| +++ b/components/autofill/core/browser/personal_data_manager_unittest.cc
|
| @@ -2746,4 +2746,57 @@ TEST_F(PersonalDataManagerTest, MaxTimesToShowAddressBookPrompt) {
|
| }
|
| #endif // defined(OS_MACOSX) && !defined(OS_IOS)
|
|
|
| +TEST_F(PersonalDataManagerTest, AppendCreditCardSuggetions) {
|
| + // These GUIDs are alphabetical to make validating expectations easier.
|
| + CreditCard credit_card[3];
|
| + CreditCard credit_card0("087151C8-6AB1-487C-9095-28E80BE5DA15",
|
| + "https://www.example.com");
|
| + test::SetCreditCardInfo(&credit_card0,
|
| + "Clyde Barrow",
|
| + "347666888555" /* American Express */,
|
| + "04",
|
| + "2015");
|
| + personal_data_->AddCreditCard(credit_card0);
|
| +
|
| + CreditCard credit_card1("6141084B-72D7-4B73-90CF-3D6AC154673B",
|
| + "https://www.example.com");
|
| + test::SetCreditCardInfo(&credit_card1, "John Dillinger", "", "01", "2010");
|
| + personal_data_->AddCreditCard(credit_card1);
|
| +
|
| + CreditCard credit_card2("702149C1-EE28-4213-A3B9-DA243FFF021B",
|
| + "https://www.example.com");
|
| + test::SetCreditCardInfo(
|
| + &credit_card2, "Bonnie Parker", "518765432109" /* Mastercard */, "", "");
|
| + personal_data_->AddCreditCard(credit_card2);
|
| +
|
| + // Add cards to list.
|
| + credit_card[0] = credit_card0;
|
| + credit_card[1] = credit_card1;
|
| + credit_card[2] = credit_card2;
|
| +
|
| + EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged())
|
| + .WillOnce(QuitMainMessageLoop());
|
| + base::MessageLoop::current()->Run();
|
| +
|
| + std::vector<base::string16> values;
|
| + std::vector<base::string16> labels;
|
| + std::vector<base::string16> icons;
|
| + std::vector<PersonalDataManager::GUIDPair> guid_pairs;
|
| + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(credit_card); ++i)
|
| + personal_data_->AppendCreditCardSuggetions(&credit_card[i],
|
| + AutofillType(CREDIT_CARD_NUMBER),
|
| + base::string16(),
|
| + &values,
|
| + &labels,
|
| + &icons,
|
| + &guid_pairs);
|
| +
|
| + ASSERT_EQ(2U, values.size());
|
| + ASSERT_EQ(values.size(), labels.size());
|
| + EXPECT_EQ(ASCIIToUTF16("********8555"), values[0]);
|
| + EXPECT_EQ(ASCIIToUTF16("04/15"), labels[0]);
|
| + EXPECT_EQ(ASCIIToUTF16("********2109"), values[1]);
|
| + EXPECT_EQ(base::string16(), labels[1]);
|
| +}
|
| +
|
| } // namespace autofill
|
|
|