Commit 0c4021c2 authored by Shanfeng Zhang's avatar Shanfeng Zhang Committed by Commit Bot

[Autofill] Add a test for empty cardholder name

Bug: None
Change-Id: Ie29f7c76a60ec8b7f4c0b383fe8ca3eb6ed009a2
Reviewed-on: https://chromium-review.googlesource.com/826246Reviewed-by: default avatarMathieu Perreault <mathp@chromium.org>
Commit-Queue: Mathieu Perreault <mathp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524068}
parent 86df16e2
......@@ -76,6 +76,7 @@ class AutofillWalletSyncableService
FRIEND_TEST_ALL_PREFIXES(AutofillWalletSyncableServiceTest,
CopyRelevantMetadataFromDisk_KeepUseStats);
FRIEND_TEST_ALL_PREFIXES(AutofillWalletSyncableServiceTest, NewWalletCard);
FRIEND_TEST_ALL_PREFIXES(AutofillWalletSyncableServiceTest, EmptyNameOnCard);
syncer::SyncMergeResult SetSyncData(const syncer::SyncDataList& data_list);
......
......@@ -222,4 +222,28 @@ TEST(AutofillWalletSyncableServiceTest, NewWalletCard) {
EXPECT_EQ(arbitrary_time, wallet_cards.back().use_date());
}
// Verify that name on card can be empty.
TEST(AutofillWalletSyncableServiceTest, EmptyNameOnCard) {
std::vector<CreditCard> wallet_cards;
std::vector<AutofillProfile> wallet_addresses;
syncer::SyncDataList data_list;
// Create a Sync data for a card and its billing address.
data_list.push_back(CreateSyncDataForWalletCreditCard(
"card1" /* id */, "1" /* billing_address_id */));
AutofillWalletSyncableService::PopulateWalletCardsAndAddresses(
data_list, &wallet_cards, &wallet_addresses);
ASSERT_EQ(1U, wallet_cards.size());
// Make sure card holder name can be empty.
EXPECT_TRUE(
wallet_cards.back().GetRawInfo(autofill::CREDIT_CARD_NAME_FULL).empty());
EXPECT_TRUE(
wallet_cards.back().GetRawInfo(autofill::CREDIT_CARD_NAME_FIRST).empty());
EXPECT_TRUE(
wallet_cards.back().GetRawInfo(autofill::CREDIT_CARD_NAME_LAST).empty());
}
} // namespace autofill
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment