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

Unified Diff: components/autofill/core/browser/credit_card_unittest.cc

Issue 2711543002: Experiment to add bank name in autofill ui. (Closed)
Patch Set: add more unit test Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/credit_card_unittest.cc
diff --git a/components/autofill/core/browser/credit_card_unittest.cc b/components/autofill/core/browser/credit_card_unittest.cc
index 81f2b885aebb7435efb022c0f628ff7570c18d9a..71d1a7caa4d239503afdb048ab77bed4c0483afc 100644
--- a/components/autofill/core/browser/credit_card_unittest.cc
+++ b/components/autofill/core/browser/credit_card_unittest.cc
@@ -8,6 +8,7 @@
#include "base/macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/autofill/core/browser/autofill_experiments.h"
@@ -142,6 +143,20 @@ TEST(CreditCardTest, PreviewSummaryAndTypeAndLastFourDigitsStrings) {
base::string16 obfuscated5 = credit_card5.TypeAndLastFourDigits();
EXPECT_EQ(UTF8ToUTF16("Card" + kUTF8MidlineEllipsis + "5100"),
obfuscated5);
+
+ // Case 6: Have everything and show bank name.
+ CreditCard credit_card6(base::GenerateGUID(), "https://www.example.com/");
+ test::SetCreditCardInfo(
+ &credit_card6, "John Dillinger", "5105 1051 0510 5100", "01", "2010");
+ credit_card6.SetBankName(UTF8ToUTF16("Chase"));
+ base::test::ScopedFeatureList scoped_feature_list_;
+ scoped_feature_list_.InitAndEnableFeature(kAutofillCreditCardBankNameDisplay);
+ base::string16 summary6 = credit_card6.Label();
+ EXPECT_EQ(UTF8ToUTF16("MasterCard" + kUTF8MidlineEllipsis + "5100, 01/2010"),
+ summary6);
Jared Saul 2017/02/22 02:49:45 What's the difference between the summary/Label in
+ base::string16 obfuscated6 = credit_card6.TypeAndLastFourDigits();
+ EXPECT_EQ(UTF8ToUTF16("Chase" + kUTF8MidlineEllipsis + "5100"),
+ obfuscated6);
}
TEST(CreditCardTest, AssignmentOperator) {

Powered by Google App Engine
This is Rietveld 408576698