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

Side by Side Diff: components/autofill/core/browser/credit_card_unittest.cc

Issue 2739743003: [Merge M58] Adopt UI review feedback (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « components/autofill/core/browser/credit_card.cc ('k') | components/autofill_strings.grdp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 "518765432109" /* Mastercard */, "12", "2021"); 922 "518765432109" /* Mastercard */, "12", "2021");
923 923
924 static const struct { 924 static const struct {
925 const char* show_expiration_date; 925 const char* show_expiration_date;
926 const std::string& app_locale; 926 const std::string& app_locale;
927 base::string16 added_to_autofill_date; 927 base::string16 added_to_autofill_date;
928 base::string16 last_used_date; 928 base::string16 last_used_date;
929 base::string16 last_used_year_ago; 929 base::string16 last_used_year_ago;
930 } kTestCases[] = { 930 } kTestCases[] = {
931 // only show last used date. 931 // only show last used date.
932 {"false", "en_US", ASCIIToUTF16("Added: Dec 09"), 932 {"false", "en_US", ASCIIToUTF16("Added Dec 09"),
933 ASCIIToUTF16("Last used: Nov 30"), 933 ASCIIToUTF16("Last used Nov 30"),
934 ASCIIToUTF16("Last used over a year ago")}, 934 ASCIIToUTF16("Last used over a year ago")},
935 // show expiration date and last used date. 935 // show expiration date and last used date.
936 {"true", "en_US", ASCIIToUTF16("Exp: 01/21, added: Dec 09"), 936 {"true", "en_US", ASCIIToUTF16("Exp: 01/21, added Dec 09"),
937 ASCIIToUTF16("Exp: 04/21, last used: Nov 30"), 937 ASCIIToUTF16("Exp: 04/21, last used Nov 30"),
938 ASCIIToUTF16("Exp: 12/21, last used over a year ago")}, 938 ASCIIToUTF16("Exp: 12/21, last used over a year ago")},
939 }; 939 };
940 940
941 variations::testing::VariationParamsManager variation_params_; 941 variations::testing::VariationParamsManager variation_params_;
942 942
943 for (const auto& test_case : kTestCases) { 943 for (const auto& test_case : kTestCases) {
944 variation_params_.SetVariationParamsWithFeatureAssociations( 944 variation_params_.SetVariationParamsWithFeatureAssociations(
945 kAutofillCreditCardLastUsedDateDisplay.name, 945 kAutofillCreditCardLastUsedDateDisplay.name,
946 {{kAutofillCreditCardLastUsedDateShowExpirationDateKey, 946 {{kAutofillCreditCardLastUsedDateShowExpirationDateKey,
947 test_case.show_expiration_date}}, 947 test_case.show_expiration_date}},
948 {kAutofillCreditCardLastUsedDateDisplay.name}); 948 {kAutofillCreditCardLastUsedDateDisplay.name});
949 949
950 EXPECT_EQ(test_case.added_to_autofill_date, 950 EXPECT_EQ(test_case.added_to_autofill_date,
951 credit_card0.GetLastUsedDateForDisplay(test_case.app_locale)); 951 credit_card0.GetLastUsedDateForDisplay(test_case.app_locale));
952 EXPECT_EQ(test_case.last_used_date, 952 EXPECT_EQ(test_case.last_used_date,
953 credit_card1.GetLastUsedDateForDisplay(test_case.app_locale)); 953 credit_card1.GetLastUsedDateForDisplay(test_case.app_locale));
954 EXPECT_EQ(test_case.last_used_year_ago, 954 EXPECT_EQ(test_case.last_used_year_ago,
955 credit_card2.GetLastUsedDateForDisplay(test_case.app_locale)); 955 credit_card2.GetLastUsedDateForDisplay(test_case.app_locale));
956 variation_params_.ClearAllVariationParams(); 956 variation_params_.ClearAllVariationParams();
957 } 957 }
958 } 958 }
959 959
960 } // namespace autofill 960 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/credit_card.cc ('k') | components/autofill_strings.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698