summaryrefslogtreecommitdiffstats
path: root/components/autofill
diff options
context:
space:
mode:
authorestade <estade@chromium.org>2015-01-08 23:23:37 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-09 07:24:19 +0000
commit73d492a77a681c6ca680f703ee60bcd29660cc83 (patch)
treebeac8cba9922f01a63e926cfef6952b51adc1934 /components/autofill
parent5c777688fcd93c3d9604c6a8eb2556f669311d77 (diff)
downloadchromium_src-73d492a77a681c6ca680f703ee60bcd29660cc83.zip
chromium_src-73d492a77a681c6ca680f703ee60bcd29660cc83.tar.gz
chromium_src-73d492a77a681c6ca680f703ee60bcd29660cc83.tar.bz2
Make IsLocalDuplicateOfServerCard separator-insensitive
BUG=none Review URL: https://codereview.chromium.org/791053009 Cr-Commit-Position: refs/heads/master@{#310723}
Diffstat (limited to 'components/autofill')
-rw-r--r--components/autofill/core/browser/credit_card.cc2
-rw-r--r--components/autofill/core/browser/credit_card_unittest.cc3
2 files changed, 4 insertions, 1 deletions
diff --git a/components/autofill/core/browser/credit_card.cc b/components/autofill/core/browser/credit_card.cc
index 8cfc8b2..4dced27 100644
--- a/components/autofill/core/browser/credit_card.cc
+++ b/components/autofill/core/browser/credit_card.cc
@@ -599,7 +599,7 @@ bool CreditCard::IsLocalDuplicateOfServerCard(const CreditCard& other) const {
return true;
if (other.record_type() == FULL_SERVER_CARD)
- return number_ == other.number_;
+ return StripSeparators(number_) == StripSeparators(other.number_);
// For masked cards, this is the best we can do to compare card numbers.
return TypeAndLastFourDigits() == other.TypeAndLastFourDigits();
diff --git a/components/autofill/core/browser/credit_card_unittest.cc b/components/autofill/core/browser/credit_card_unittest.cc
index 7f80a5c..5d399be 100644
--- a/components/autofill/core/browser/credit_card_unittest.cc
+++ b/components/autofill/core/browser/credit_card_unittest.cc
@@ -186,6 +186,9 @@ TEST(CreditCardTest, Compare) {
{ LOCAL_CARD, "", "423456789012", "", "",
MASKED_SERVER_CARD, "John Dillinger", "9012", "01", "2010", kMasterCard,
false },
+ { LOCAL_CARD, "John Dillinger", "4234-5678-9012", "01", "2010",
+ FULL_SERVER_CARD, "John Dillinger", "423456789012", "01", "2010", nullptr,
+ true },
};
for (size_t i = 0; i < arraysize(test_cases); ++i) {