OLD | NEW |
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 "components/autofill/content/browser/wallet/wallet_address.h" |
| 6 |
| 7 #include <memory> |
| 8 |
5 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
6 #include "base/logging.h" | 10 #include "base/logging.h" |
7 #include "base/memory/scoped_ptr.h" | |
8 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
9 #include "base/values.h" | 12 #include "base/values.h" |
10 #include "components/autofill/content/browser/wallet/wallet_address.h" | |
11 #include "components/autofill/content/browser/wallet/wallet_test_util.h" | 13 #include "components/autofill/content/browser/wallet/wallet_test_util.h" |
12 #include "components/autofill/core/browser/autofill_profile.h" | 14 #include "components/autofill/core/browser/autofill_profile.h" |
13 #include "components/autofill/core/browser/autofill_test_utils.h" | 15 #include "components/autofill/core/browser/autofill_test_utils.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
15 | 17 |
16 using base::ASCIIToUTF16; | 18 using base::ASCIIToUTF16; |
17 | 19 |
18 namespace { | 20 namespace { |
19 | 21 |
20 const char kAddressMissingObjectId[] = | 22 const char kAddressMissingObjectId[] = |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 } // anonymous namespace | 214 } // anonymous namespace |
213 | 215 |
214 namespace autofill { | 216 namespace autofill { |
215 namespace wallet { | 217 namespace wallet { |
216 | 218 |
217 class WalletAddressTest : public testing::Test { | 219 class WalletAddressTest : public testing::Test { |
218 public: | 220 public: |
219 WalletAddressTest() {} | 221 WalletAddressTest() {} |
220 protected: | 222 protected: |
221 void SetUpDictionary(const std::string& json) { | 223 void SetUpDictionary(const std::string& json) { |
222 scoped_ptr<base::Value> value = base::JSONReader::Read(json); | 224 std::unique_ptr<base::Value> value = base::JSONReader::Read(json); |
223 DCHECK(value.get()); | 225 DCHECK(value.get()); |
224 DCHECK(value->IsType(base::Value::TYPE_DICTIONARY)); | 226 DCHECK(value->IsType(base::Value::TYPE_DICTIONARY)); |
225 dict_.reset(static_cast<base::DictionaryValue*>(value.release())); | 227 dict_.reset(static_cast<base::DictionaryValue*>(value.release())); |
226 } | 228 } |
227 | 229 |
228 scoped_ptr<const base::DictionaryValue> dict_; | 230 std::unique_ptr<const base::DictionaryValue> dict_; |
229 }; | 231 }; |
230 | 232 |
231 TEST_F(WalletAddressTest, AddressEqualsIgnoreID) { | 233 TEST_F(WalletAddressTest, AddressEqualsIgnoreID) { |
232 Address address1("US", | 234 Address address1("US", |
233 ASCIIToUTF16("recipient_name"), | 235 ASCIIToUTF16("recipient_name"), |
234 StreetAddress("address_line_1", "address_line_2"), | 236 StreetAddress("address_line_1", "address_line_2"), |
235 ASCIIToUTF16("locality_name"), | 237 ASCIIToUTF16("locality_name"), |
236 ASCIIToUTF16("dependent_locality_name"), | 238 ASCIIToUTF16("dependent_locality_name"), |
237 ASCIIToUTF16("administrative_area_name"), | 239 ASCIIToUTF16("administrative_area_name"), |
238 ASCIIToUTF16("postal_code_number"), | 240 ASCIIToUTF16("postal_code_number"), |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 ASCIIToUTF16("postal_code_number"), | 592 ASCIIToUTF16("postal_code_number"), |
591 ASCIIToUTF16("sorting_code"), | 593 ASCIIToUTF16("sorting_code"), |
592 ASCIIToUTF16("phone_number"), | 594 ASCIIToUTF16("phone_number"), |
593 "id1", | 595 "id1", |
594 "language_code"); | 596 "language_code"); |
595 EXPECT_EQ(base::string16(), address3.GetInfo(type, "en-US")); | 597 EXPECT_EQ(base::string16(), address3.GetInfo(type, "en-US")); |
596 } | 598 } |
597 | 599 |
598 } // namespace wallet | 600 } // namespace wallet |
599 } // namespace autofill | 601 } // namespace autofill |
OLD | NEW |