| 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 "components/autofill/browser/wallet/wallet_test_util.h" | 5 #include "components/autofill/browser/wallet/wallet_test_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 int FutureYear() { | 24 int FutureYear() { |
| 25 // "In the Year 3000." - Richie "LaBamba" Rosenberg | 25 // "In the Year 3000." - Richie "LaBamba" Rosenberg |
| 26 return 3000; | 26 return 3000; |
| 27 } | 27 } |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 scoped_ptr<WalletItems::MaskedInstrument> GetTestMaskedInstrumentWithId( | 31 scoped_ptr<WalletItems::MaskedInstrument> |
| 32 const std::string& id) { | 32 GetTestMaskedInstrumentWithIdAndAddress( |
| 33 const std::string& id, scoped_ptr<Address> address) { |
| 33 return scoped_ptr<WalletItems::MaskedInstrument>( | 34 return scoped_ptr<WalletItems::MaskedInstrument>( |
| 34 new WalletItems::MaskedInstrument(ASCIIToUTF16("descriptive_name"), | 35 new WalletItems::MaskedInstrument(ASCIIToUTF16("descriptive_name"), |
| 35 WalletItems::MaskedInstrument::VISA, | 36 WalletItems::MaskedInstrument::VISA, |
| 36 std::vector<base::string16>(), | 37 std::vector<base::string16>(), |
| 37 ASCIIToUTF16("1111"), | 38 ASCIIToUTF16("1111"), |
| 38 12, | 39 12, |
| 39 FutureYear(), | 40 FutureYear(), |
| 40 GetTestAddress(), | 41 address.Pass(), |
| 41 WalletItems::MaskedInstrument::VALID, | 42 WalletItems::MaskedInstrument::VALID, |
| 42 id)); | 43 id)); |
| 43 } | 44 } |
| 44 | 45 |
| 46 scoped_ptr<WalletItems::MaskedInstrument> GetTestMaskedInstrumentWithId( |
| 47 const std::string& id) { |
| 48 return GetTestMaskedInstrumentWithIdAndAddress(id, GetTestAddress()); |
| 49 } |
| 50 |
| 45 scoped_ptr<Address> GetTestAddress() { | 51 scoped_ptr<Address> GetTestAddress() { |
| 46 return scoped_ptr<Address>(new Address("US", | 52 return scoped_ptr<Address>(new Address("US", |
| 47 ASCIIToUTF16("recipient_name"), | 53 ASCIIToUTF16("recipient_name"), |
| 48 ASCIIToUTF16("address_line_1"), | 54 ASCIIToUTF16("address_line_1"), |
| 49 ASCIIToUTF16("address_line_2"), | 55 ASCIIToUTF16("address_line_2"), |
| 50 ASCIIToUTF16("locality_name"), | 56 ASCIIToUTF16("locality_name"), |
| 51 ASCIIToUTF16("admin_area_name"), | 57 ASCIIToUTF16("admin_area_name"), |
| 52 ASCIIToUTF16("postal_code_number"), | 58 ASCIIToUTF16("postal_code_number"), |
| 53 ASCIIToUTF16("phone_number"), | 59 ASCIIToUTF16("phone_number"), |
| 54 std::string())); | 60 std::string())); |
| 55 } | 61 } |
| 56 | 62 |
| 63 scoped_ptr<Address> GetTestMinimalAddress() { |
| 64 scoped_ptr<Address> address = GetTestAddress(); |
| 65 address->set_is_complete_address(false); |
| 66 return address.Pass(); |
| 67 } |
| 68 |
| 57 scoped_ptr<FullWallet> GetTestFullWallet() { | 69 scoped_ptr<FullWallet> GetTestFullWallet() { |
| 58 base::Time::Exploded exploded; | 70 base::Time::Exploded exploded; |
| 59 base::Time::Now().LocalExplode(&exploded); | 71 base::Time::Now().LocalExplode(&exploded); |
| 60 return scoped_ptr<FullWallet>(new FullWallet(FutureYear(), | 72 return scoped_ptr<FullWallet>(new FullWallet(FutureYear(), |
| 61 12, | 73 12, |
| 62 "iin", | 74 "iin", |
| 63 "rest", | 75 "rest", |
| 64 GetTestAddress(), | 76 GetTestAddress(), |
| 65 GetTestShippingAddress(), | 77 GetTestShippingAddress(), |
| 66 std::vector<RequiredAction>())); | 78 std::vector<RequiredAction>())); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 return scoped_ptr<WalletItems>( | 138 return scoped_ptr<WalletItems>( |
| 127 new wallet::WalletItems(std::vector<RequiredAction>(), | 139 new wallet::WalletItems(std::vector<RequiredAction>(), |
| 128 "google_transaction_id", | 140 "google_transaction_id", |
| 129 "default_instrument_id", | 141 "default_instrument_id", |
| 130 "default_address_id", | 142 "default_address_id", |
| 131 "obfuscated_gaia_id")); | 143 "obfuscated_gaia_id")); |
| 132 } | 144 } |
| 133 | 145 |
| 134 } // namespace wallet | 146 } // namespace wallet |
| 135 } // namespace autofill | 147 } // namespace autofill |
| OLD | NEW |