| OLD | NEW |
| 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 15 matching lines...) Expand all Loading... |
| 26 12, | 26 12, |
| 27 2015, | 27 2015, |
| 28 Instrument::VISA, | 28 Instrument::VISA, |
| 29 GetTestShippingAddress().Pass()); | 29 GetTestShippingAddress().Pass()); |
| 30 | 30 |
| 31 EXPECT_EQ(ASCIIToUTF16(kLastFourDigits), instrument.last_four_digits()); | 31 EXPECT_EQ(ASCIIToUTF16(kLastFourDigits), instrument.last_four_digits()); |
| 32 EXPECT_TRUE(instrument.IsValid()); | 32 EXPECT_TRUE(instrument.IsValid()); |
| 33 } | 33 } |
| 34 | 34 |
| 35 TEST(Instrument, NoPrimaryAccountNumberIsInvalid) { | 35 TEST(Instrument, NoPrimaryAccountNumberIsInvalid) { |
| 36 Instrument instrument(string16(), | 36 Instrument instrument(base::string16(), |
| 37 ASCIIToUTF16(kCardVerificationNumber), | 37 ASCIIToUTF16(kCardVerificationNumber), |
| 38 12, | 38 12, |
| 39 2015, | 39 2015, |
| 40 Instrument::VISA, | 40 Instrument::VISA, |
| 41 GetTestShippingAddress().Pass()); | 41 GetTestShippingAddress().Pass()); |
| 42 | 42 |
| 43 EXPECT_FALSE(instrument.IsValid()); | 43 EXPECT_FALSE(instrument.IsValid()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 TEST(Instrument, TooShortPrimaryAccountNumberIsInvalid) { | 46 TEST(Instrument, TooShortPrimaryAccountNumberIsInvalid) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 71 12, | 71 12, |
| 72 2015, | 72 2015, |
| 73 Instrument::VISA, | 73 Instrument::VISA, |
| 74 GetTestShippingAddress().Pass()); | 74 GetTestShippingAddress().Pass()); |
| 75 | 75 |
| 76 EXPECT_FALSE(instrument.IsValid()); | 76 EXPECT_FALSE(instrument.IsValid()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 TEST(Instrument, NoCardVerificationNumberIsInvalid) { | 79 TEST(Instrument, NoCardVerificationNumberIsInvalid) { |
| 80 Instrument instrument(ASCIIToUTF16(kPrimaryAccountNumber), | 80 Instrument instrument(ASCIIToUTF16(kPrimaryAccountNumber), |
| 81 string16(), | 81 base::string16(), |
| 82 12, | 82 12, |
| 83 2015, | 83 2015, |
| 84 Instrument::VISA, | 84 Instrument::VISA, |
| 85 GetTestShippingAddress().Pass()); | 85 GetTestShippingAddress().Pass()); |
| 86 | 86 |
| 87 EXPECT_FALSE(instrument.IsValid()); | 87 EXPECT_FALSE(instrument.IsValid()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 TEST(Instrument, TooShortCardVerificationNumberIsInvalid) { | 90 TEST(Instrument, TooShortCardVerificationNumberIsInvalid) { |
| 91 Instrument instrument(ASCIIToUTF16(kPrimaryAccountNumber), | 91 Instrument instrument(ASCIIToUTF16(kPrimaryAccountNumber), |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 12, | 180 12, |
| 181 2015, | 181 2015, |
| 182 Instrument::VISA, | 182 Instrument::VISA, |
| 183 GetTestShippingAddress().Pass()); | 183 GetTestShippingAddress().Pass()); |
| 184 | 184 |
| 185 EXPECT_TRUE(expected.Equals(instrument.ToDictionary().get())); | 185 EXPECT_TRUE(expected.Equals(instrument.ToDictionary().get())); |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace wallet | 188 } // namespace wallet |
| 189 } // namespace autofill | 189 } // namespace autofill |
| OLD | NEW |