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

Side by Side Diff: components/autofill/browser/wallet/instrument_unittest.cc

Issue 14425010: Handle expired Autofill credit cards in autofill dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "base/values.h" 6 #include "base/values.h"
7 #include "components/autofill/browser/wallet/instrument.h" 7 #include "components/autofill/browser/wallet/instrument.h"
8 #include "components/autofill/browser/wallet/wallet_address.h" 8 #include "components/autofill/browser/wallet/wallet_address.h"
9 #include "components/autofill/browser/wallet/wallet_test_util.h" 9 #include "components/autofill/browser/wallet/wallet_test_util.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 EXPECT_FALSE(instrument.IsValid()); 153 EXPECT_FALSE(instrument.IsValid());
154 } 154 }
155 155
156 TEST(Instrument, ToDictionary) { 156 TEST(Instrument, ToDictionary) {
157 base::DictionaryValue expected; 157 base::DictionaryValue expected;
158 expected.SetString("type", "CREDIT_CARD"); 158 expected.SetString("type", "CREDIT_CARD");
159 expected.SetInteger("credit_card.exp_month", 12); 159 expected.SetInteger("credit_card.exp_month", 12);
160 expected.SetInteger("credit_card.exp_year", 2015); 160 expected.SetInteger("credit_card.exp_year", 2015);
161 expected.SetString("credit_card.last_4_digits", kLastFourDigits); 161 expected.SetString("credit_card.last_4_digits", kLastFourDigits);
162 expected.SetString("credit_card.fop_type", "VISA"); 162 expected.SetString("credit_card.fop_type", "VISA");
163 expected.SetString("credit_card.address.country_name_code", 163 expected.SetString("credit_card.address.country_name_code", "US");
164 "ship_country_name_code");
165 expected.SetString("credit_card.address.recipient_name", 164 expected.SetString("credit_card.address.recipient_name",
166 "ship_recipient_name"); 165 "ship_recipient_name");
167 expected.SetString("credit_card.address.locality_name", 166 expected.SetString("credit_card.address.locality_name",
168 "ship_locality_name"); 167 "ship_locality_name");
169 expected.SetString("credit_card.address.administrative_area_name", 168 expected.SetString("credit_card.address.administrative_area_name",
170 "ship_admin_area_name"); 169 "ship_admin_area_name");
171 expected.SetString("credit_card.address.postal_code_number", 170 expected.SetString("credit_card.address.postal_code_number",
172 "ship_postal_code_number"); 171 "ship_postal_code_number");
173 base::ListValue* address_lines = new base::ListValue(); 172 base::ListValue* address_lines = new base::ListValue();
174 address_lines->AppendString("ship_address_line_1"); 173 address_lines->AppendString("ship_address_line_1");
175 address_lines->AppendString("ship_address_line_2"); 174 address_lines->AppendString("ship_address_line_2");
176 expected.Set("credit_card.address.address_line", address_lines); 175 expected.Set("credit_card.address.address_line", address_lines);
177 176
178 Instrument instrument(ASCIIToUTF16(kPrimaryAccountNumber), 177 Instrument instrument(ASCIIToUTF16(kPrimaryAccountNumber),
179 ASCIIToUTF16(kCardVerificationNumber), 178 ASCIIToUTF16(kCardVerificationNumber),
180 12, 179 12,
181 2015, 180 2015,
182 Instrument::VISA, 181 Instrument::VISA,
183 GetTestShippingAddress().Pass()); 182 GetTestShippingAddress().Pass());
184 183
185 EXPECT_TRUE(expected.Equals(instrument.ToDictionary().get())); 184 EXPECT_TRUE(expected.Equals(instrument.ToDictionary().get()));
186 } 185 }
187 186
188 } // namespace wallet 187 } // namespace wallet
189 } // namespace autofill 188 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698