Chromium Code Reviews| 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 "base/json/json_reader.h" | 5 #include "base/json/json_reader.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "components/autofill/content/browser/wallet/gaia_account.h" | 10 #include "components/autofill/content/browser/wallet/gaia_account.h" |
| 11 #include "components/autofill/content/browser/wallet/required_action.h" | 11 #include "components/autofill/content/browser/wallet/required_action.h" |
| 12 #include "components/autofill/content/browser/wallet/wallet_items.h" | 12 #include "components/autofill/content/browser/wallet/wallet_items.h" |
| 13 #include "components/autofill/content/browser/wallet/wallet_test_util.h" | |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 15 | 16 |
| 16 using base::ASCIIToUTF16; | 17 using base::ASCIIToUTF16; |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 const char kMaskedInstrument[] = | 21 const char kMaskedInstrument[] = |
| 21 "{" | 22 "{" |
| 22 " \"descriptive_name\":\"descriptive_name\"," | 23 " \"descriptive_name\":\"descriptive_name\"," |
| 23 " \"type\":\"VISA\"," | 24 " \"type\":\"VISA\"," |
| 24 " \"supported_currency\":" | 25 " \"supported_currency\":" |
| 25 " [" | 26 " [" |
| 26 " \"currency\"" | 27 " \"currency\"" |
| 27 " ]," | 28 " ]," |
| 28 " \"last_four_digits\":\"last_four_digits\"," | 29 " \"last_four_digits\":\"last_four_digits\"," |
| 29 " \"expiration_month\":12," | 30 " \"expiration_month\":12," |
| 30 " \"expiration_year\":2012," | 31 " \"expiration_year\":2012," |
| 31 " \"billing_address\":" | 32 " \"billing_address\":" |
| 32 " {" | 33 " {" |
| 33 " \"name\":\"name\"," | 34 " \"name\":\"name\"," |
| 34 " \"address1\":\"address1\"," | 35 " \"address1\":\"address1\"," |
| 35 " \"address2\":\"address2\"," | 36 " \"address2\":\"address2\"," |
| 36 " \"city\":\"city\"," | 37 " \"city\":\"city\"," |
| 38 " \"dependent_locality_name\":\"burough\"," | |
|
Dan Beam
2014/02/12 21:34:33
this is burough because billing addresses can be U
Evan Stade
2014/02/12 23:32:13
no, I made it burough for no particular reason; it
| |
| 37 " \"state\":\"state\"," | 39 " \"state\":\"state\"," |
| 38 " \"postal_code\":\"postal_code\"," | 40 " \"postal_code\":\"postal_code\"," |
| 41 " \"sorting_code\":\"sorting_code\"," | |
| 39 " \"phone_number\":\"phone_number\"," | 42 " \"phone_number\":\"phone_number\"," |
| 40 " \"country_code\":\"US\"," | 43 " \"country_code\":\"US\"," |
| 41 " \"type\":\"FULL\"" | 44 " \"type\":\"FULL\"" |
| 42 " }," | 45 " }," |
| 43 " \"status\":\"VALID\"," | 46 " \"status\":\"VALID\"," |
| 44 " \"object_id\":\"object_id\"" | 47 " \"object_id\":\"object_id\"" |
| 45 "}"; | 48 "}"; |
| 46 | 49 |
| 47 const char kMaskedInstrumentMissingStatus[] = | 50 const char kMaskedInstrumentMissingStatus[] = |
| 48 "{" | 51 "{" |
| 49 " \"descriptive_name\":\"descriptive_name\"," | 52 " \"descriptive_name\":\"descriptive_name\"," |
| 50 " \"type\":\"VISA\"," | 53 " \"type\":\"VISA\"," |
| 51 " \"supported_currency\":" | 54 " \"supported_currency\":" |
| 52 " [" | 55 " [" |
| 53 " \"currency\"" | 56 " \"currency\"" |
| 54 " ]," | 57 " ]," |
| 55 " \"last_four_digits\":\"last_four_digits\"," | 58 " \"last_four_digits\":\"last_four_digits\"," |
| 56 " \"expiration_month\":12," | 59 " \"expiration_month\":12," |
| 57 " \"expiration_year\":2012," | 60 " \"expiration_year\":2012," |
| 58 " \"billing_address\":" | 61 " \"billing_address\":" |
| 59 " {" | 62 " {" |
| 60 " \"name\":\"name\"," | 63 " \"name\":\"name\"," |
| 61 " \"address1\":\"address1\"," | 64 " \"address1\":\"address1\"," |
| 62 " \"address2\":\"address2\"," | 65 " \"address2\":\"address2\"," |
| 63 " \"city\":\"city\"," | 66 " \"city\":\"city\"," |
| 67 " \"dependent_locality_name\":\"burough\"," | |
| 64 " \"state\":\"state\"," | 68 " \"state\":\"state\"," |
| 65 " \"postal_code\":\"postal_code\"," | 69 " \"postal_code\":\"postal_code\"," |
| 70 " \"sorting_code\":\"sorting_code\"," | |
| 66 " \"phone_number\":\"phone_number\"," | 71 " \"phone_number\":\"phone_number\"," |
| 67 " \"country_code\":\"US\"" | 72 " \"country_code\":\"US\"" |
| 68 " }," | 73 " }," |
| 69 " \"object_id\":\"object_id\"," | 74 " \"object_id\":\"object_id\"," |
| 70 " \"amex_disallowed\":true" | 75 " \"amex_disallowed\":true" |
| 71 "}"; | 76 "}"; |
| 72 | 77 |
| 73 const char kMaskedInstrumentMissingType[] = | 78 const char kMaskedInstrumentMissingType[] = |
| 74 "{" | 79 "{" |
| 75 " \"descriptive_name\":\"descriptive_name\"," | 80 " \"descriptive_name\":\"descriptive_name\"," |
| 76 " \"supported_currency\":" | 81 " \"supported_currency\":" |
| 77 " [" | 82 " [" |
| 78 " \"currency\"" | 83 " \"currency\"" |
| 79 " ]," | 84 " ]," |
| 80 " \"last_four_digits\":\"last_four_digits\"," | 85 " \"last_four_digits\":\"last_four_digits\"," |
| 81 " \"expiration_month\":12," | 86 " \"expiration_month\":12," |
| 82 " \"expiration_year\":2012," | 87 " \"expiration_year\":2012," |
| 83 " \"billing_address\":" | 88 " \"billing_address\":" |
| 84 " {" | 89 " {" |
| 85 " \"name\":\"name\"," | 90 " \"name\":\"name\"," |
| 86 " \"address1\":\"address1\"," | 91 " \"address1\":\"address1\"," |
| 87 " \"address2\":\"address2\"," | 92 " \"address2\":\"address2\"," |
| 88 " \"city\":\"city\"," | 93 " \"city\":\"city\"," |
| 94 " \"dependent_locality_name\":\"burough\"," | |
| 89 " \"state\":\"state\"," | 95 " \"state\":\"state\"," |
| 90 " \"postal_code\":\"postal_code\"," | 96 " \"postal_code\":\"postal_code\"," |
| 97 " \"sorting_code\":\"sorting_code\"," | |
| 91 " \"phone_number\":\"phone_number\"," | 98 " \"phone_number\":\"phone_number\"," |
| 92 " \"country_code\":\"US\"" | 99 " \"country_code\":\"US\"" |
| 93 " }," | 100 " }," |
| 94 " \"status\":\"VALID\"," | 101 " \"status\":\"VALID\"," |
| 95 " \"object_id\":\"object_id\"" | 102 " \"object_id\":\"object_id\"" |
| 96 "}"; | 103 "}"; |
| 97 | 104 |
| 98 const char kMaskedInstrumentMissingLastFourDigits[] = | 105 const char kMaskedInstrumentMissingLastFourDigits[] = |
| 99 "{" | 106 "{" |
| 100 " \"descriptive_name\":\"descriptive_name\"," | 107 " \"descriptive_name\":\"descriptive_name\"," |
| 101 " \"type\":\"VISA\"," | 108 " \"type\":\"VISA\"," |
| 102 " \"supported_currency\":" | 109 " \"supported_currency\":" |
| 103 " [" | 110 " [" |
| 104 " \"currency\"" | 111 " \"currency\"" |
| 105 " ]," | 112 " ]," |
| 106 " \"expiration_month\":12," | 113 " \"expiration_month\":12," |
| 107 " \"expiration_year\":2012," | 114 " \"expiration_year\":2012," |
| 108 " \"billing_address\":" | 115 " \"billing_address\":" |
| 109 " {" | 116 " {" |
| 110 " \"name\":\"name\"," | 117 " \"name\":\"name\"," |
| 111 " \"address1\":\"address1\"," | 118 " \"address1\":\"address1\"," |
| 112 " \"address2\":\"address2\"," | 119 " \"address2\":\"address2\"," |
| 113 " \"city\":\"city\"," | 120 " \"city\":\"city\"," |
| 121 " \"dependent_locality_name\":\"burough\"," | |
| 114 " \"state\":\"state\"," | 122 " \"state\":\"state\"," |
| 115 " \"postal_code\":\"postal_code\"," | 123 " \"postal_code\":\"postal_code\"," |
| 124 " \"sorting_code\":\"sorting_code\"," | |
| 116 " \"phone_number\":\"phone_number\"," | 125 " \"phone_number\":\"phone_number\"," |
| 117 " \"country_code\":\"US\"" | 126 " \"country_code\":\"US\"" |
| 118 " }," | 127 " }," |
| 119 " \"status\":\"VALID\"," | 128 " \"status\":\"VALID\"," |
| 120 " \"object_id\":\"object_id\"" | 129 " \"object_id\":\"object_id\"" |
| 121 "}"; | 130 "}"; |
| 122 | 131 |
| 123 const char kMaskedInstrumentMissingAddress[] = | 132 const char kMaskedInstrumentMissingAddress[] = |
| 124 "{" | 133 "{" |
| 125 " \"descriptive_name\":\"descriptive_name\"," | 134 " \"descriptive_name\":\"descriptive_name\"," |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 144 " \"currency\"" | 153 " \"currency\"" |
| 145 " ]," | 154 " ]," |
| 146 " \"last_four_digits\":\"last_four_digits\"," | 155 " \"last_four_digits\":\"last_four_digits\"," |
| 147 " \"expiration_month\":12," | 156 " \"expiration_month\":12," |
| 148 " \"expiration_year\":2012," | 157 " \"expiration_year\":2012," |
| 149 " \"billing_address\":" | 158 " \"billing_address\":" |
| 150 " {" | 159 " {" |
| 151 " \"address1\":\"address1\"," | 160 " \"address1\":\"address1\"," |
| 152 " \"address2\":\"address2\"," | 161 " \"address2\":\"address2\"," |
| 153 " \"city\":\"city\"," | 162 " \"city\":\"city\"," |
| 163 " \"dependent_locality_name\":\"burough\"," | |
| 154 " \"state\":\"state\"," | 164 " \"state\":\"state\"," |
| 155 " \"phone_number\":\"phone_number\"," | 165 " \"phone_number\":\"phone_number\"," |
| 156 " \"country_code\":\"US\"" | 166 " \"country_code\":\"US\"" |
| 157 " }," | 167 " }," |
| 158 " \"status\":\"VALID\"," | 168 " \"status\":\"VALID\"," |
| 159 " \"object_id\":\"object_id\"" | 169 " \"object_id\":\"object_id\"" |
| 160 "}"; | 170 "}"; |
| 161 | 171 |
| 162 const char kMaskedInstrumentMissingObjectId[] = | 172 const char kMaskedInstrumentMissingObjectId[] = |
| 163 "{" | 173 "{" |
| 164 " \"descriptive_name\":\"descriptive_name\"," | 174 " \"descriptive_name\":\"descriptive_name\"," |
| 165 " \"type\":\"VISA\"," | 175 " \"type\":\"VISA\"," |
| 166 " \"supported_currency\":" | 176 " \"supported_currency\":" |
| 167 " [" | 177 " [" |
| 168 " \"currency\"" | 178 " \"currency\"" |
| 169 " ]," | 179 " ]," |
| 170 " \"last_four_digits\":\"last_four_digits\"," | 180 " \"last_four_digits\":\"last_four_digits\"," |
| 171 " \"expiration_month\":12," | 181 " \"expiration_month\":12," |
| 172 " \"expiration_year\":2012," | 182 " \"expiration_year\":2012," |
| 173 " \"billing_address\":" | 183 " \"billing_address\":" |
| 174 " {" | 184 " {" |
| 175 " \"name\":\"name\"," | 185 " \"name\":\"name\"," |
| 176 " \"address1\":\"address1\"," | 186 " \"address1\":\"address1\"," |
| 177 " \"address2\":\"address2\"," | 187 " \"address2\":\"address2\"," |
| 178 " \"city\":\"city\"," | 188 " \"city\":\"city\"," |
| 189 " \"dependent_locality_name\":\"burough\"," | |
| 179 " \"state\":\"state\"," | 190 " \"state\":\"state\"," |
| 180 " \"postal_code\":\"postal_code\"," | 191 " \"postal_code\":\"postal_code\"," |
| 181 " \"phone_number\":\"phone_number\"," | 192 " \"phone_number\":\"phone_number\"," |
| 182 " \"country_code\":\"US\"" | 193 " \"country_code\":\"US\"" |
| 183 " }," | 194 " }," |
| 184 " \"status\":\"VALID\"" | 195 " \"status\":\"VALID\"" |
| 185 "}"; | 196 "}"; |
| 186 | 197 |
| 187 const char kLegalDocument[] = | 198 const char kLegalDocument[] = |
| 188 "{" | 199 "{" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 " ]," | 317 " ]," |
| 307 " \"last_four_digits\":\"last_four_digits\"," | 318 " \"last_four_digits\":\"last_four_digits\"," |
| 308 " \"expiration_month\":12," | 319 " \"expiration_month\":12," |
| 309 " \"expiration_year\":2012," | 320 " \"expiration_year\":2012," |
| 310 " \"billing_address\":" | 321 " \"billing_address\":" |
| 311 " {" | 322 " {" |
| 312 " \"name\":\"name\"," | 323 " \"name\":\"name\"," |
| 313 " \"address1\":\"address1\"," | 324 " \"address1\":\"address1\"," |
| 314 " \"address2\":\"address2\"," | 325 " \"address2\":\"address2\"," |
| 315 " \"city\":\"city\"," | 326 " \"city\":\"city\"," |
| 327 " \"dependent_locality_name\":\"burough\"," | |
| 316 " \"state\":\"state\"," | 328 " \"state\":\"state\"," |
| 317 " \"postal_code\":\"postal_code\"," | 329 " \"postal_code\":\"postal_code\"," |
| 330 " \"sorting_code\":\"sorting_code\"," | |
| 318 " \"phone_number\":\"phone_number\"," | 331 " \"phone_number\":\"phone_number\"," |
| 319 " \"country_code\":\"US\"," | 332 " \"country_code\":\"US\"," |
| 320 " \"type\":\"FULL\"" | 333 " \"type\":\"FULL\"" |
| 321 " }," | 334 " }," |
| 322 " \"status\":\"VALID\"," | 335 " \"status\":\"VALID\"," |
| 323 " \"object_id\":\"object_id\"" | 336 " \"object_id\":\"object_id\"" |
| 324 " }" | 337 " }" |
| 325 " ]," | 338 " ]," |
| 326 " \"default_instrument_id\":\"default_instrument_id\"," | 339 " \"default_instrument_id\":\"default_instrument_id\"," |
| 327 " \"address\":" | 340 " \"address\":" |
| 328 " [" | 341 " [" |
| 329 " {" | 342 " {" |
| 330 " \"id\":\"id\"," | 343 " \"id\":\"id\"," |
| 331 " \"phone_number\":\"phone_number\"," | 344 " \"phone_number\":\"phone_number\"," |
| 332 " \"postal_address\":" | 345 " \"postal_address\":" |
| 333 " {" | 346 " {" |
| 334 " \"recipient_name\":\"recipient_name\"," | 347 " \"recipient_name\":\"recipient_name\"," |
| 335 " \"address_line\":" | 348 " \"address_line\":" |
| 336 " [" | 349 " [" |
| 337 " \"address_line_1\"," | 350 " \"address_line_1\"," |
| 338 " \"address_line_2\"" | 351 " \"address_line_2\"" |
| 339 " ]," | 352 " ]," |
| 340 " \"locality_name\":\"locality_name\"," | 353 " \"locality_name\":\"locality_name\"," |
| 354 " \"dependent_locality_name\":\"dependent_locality_name\"," | |
| 341 " \"administrative_area_name\":\"administrative_area_name\"," | 355 " \"administrative_area_name\":\"administrative_area_name\"," |
| 342 " \"postal_code_number\":\"postal_code_number\"," | 356 " \"postal_code_number\":\"postal_code_number\"," |
| 357 " \"sorting_code\":\"sorting_code\"," | |
| 343 " \"country_name_code\":\"US\"" | 358 " \"country_name_code\":\"US\"" |
| 344 " }" | 359 " }" |
| 345 " }" | 360 " }" |
| 346 " ]," | 361 " ]," |
| 347 " \"default_address_id\":\"default_address_id\"," | 362 " \"default_address_id\":\"default_address_id\"," |
| 348 " \"obfuscated_gaia_id\":\"ignore_this_value\"," | 363 " \"obfuscated_gaia_id\":\"ignore_this_value\"," |
| 349 " \"amex_disallowed\":true," | 364 " \"amex_disallowed\":true," |
| 350 " \"gaia_profile\":" | 365 " \"gaia_profile\":" |
| 351 " [" | 366 " [" |
| 352 " {" | 367 " {" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 434 } | 449 } |
| 435 | 450 |
| 436 TEST_F(WalletItemsTest, CreateMaskedInstrumentMissingObjectId) { | 451 TEST_F(WalletItemsTest, CreateMaskedInstrumentMissingObjectId) { |
| 437 SetUpDictionary(kMaskedInstrumentMissingObjectId); | 452 SetUpDictionary(kMaskedInstrumentMissingObjectId); |
| 438 EXPECT_EQ(NULL, | 453 EXPECT_EQ(NULL, |
| 439 WalletItems::MaskedInstrument::CreateMaskedInstrument(*dict).get()); | 454 WalletItems::MaskedInstrument::CreateMaskedInstrument(*dict).get()); |
| 440 } | 455 } |
| 441 | 456 |
| 442 TEST_F(WalletItemsTest, CreateMaskedInstrument) { | 457 TEST_F(WalletItemsTest, CreateMaskedInstrument) { |
| 443 SetUpDictionary(kMaskedInstrument); | 458 SetUpDictionary(kMaskedInstrument); |
| 444 scoped_ptr<Address> address(new Address("US", | 459 scoped_ptr<Address> address( |
| 445 ASCIIToUTF16("name"), | 460 new Address("US", |
| 446 ASCIIToUTF16("address1"), | 461 ASCIIToUTF16("name"), |
| 447 ASCIIToUTF16("address2"), | 462 StreetAddress("address1", "address2"), |
| 448 ASCIIToUTF16("city"), | 463 ASCIIToUTF16("city"), |
| 449 ASCIIToUTF16("state"), | 464 ASCIIToUTF16("burough"), |
| 450 ASCIIToUTF16("postal_code"), | 465 ASCIIToUTF16("state"), |
| 451 ASCIIToUTF16("phone_number"), | 466 ASCIIToUTF16("postal_code"), |
| 452 std::string())); | 467 ASCIIToUTF16("sorting_code"), |
| 468 ASCIIToUTF16("phone_number"), | |
| 469 std::string())); | |
| 453 std::vector<base::string16> supported_currencies; | 470 std::vector<base::string16> supported_currencies; |
| 454 supported_currencies.push_back(ASCIIToUTF16("currency")); | 471 supported_currencies.push_back(ASCIIToUTF16("currency")); |
| 455 WalletItems::MaskedInstrument masked_instrument( | 472 WalletItems::MaskedInstrument masked_instrument( |
| 456 ASCIIToUTF16("descriptive_name"), | 473 ASCIIToUTF16("descriptive_name"), |
| 457 WalletItems::MaskedInstrument::VISA, | 474 WalletItems::MaskedInstrument::VISA, |
| 458 supported_currencies, | 475 supported_currencies, |
| 459 ASCIIToUTF16("last_four_digits"), | 476 ASCIIToUTF16("last_four_digits"), |
| 460 12, | 477 12, |
| 461 2012, | 478 2012, |
| 462 address.Pass(), | 479 address.Pass(), |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 561 true)); | 578 true)); |
| 562 expected.AddAccount(user1.Pass()); | 579 expected.AddAccount(user1.Pass()); |
| 563 scoped_ptr<GaiaAccount> user2(GaiaAccount::CreateForTesting( | 580 scoped_ptr<GaiaAccount> user2(GaiaAccount::CreateForTesting( |
| 564 "user2@chromium.org", | 581 "user2@chromium.org", |
| 565 "obfuscated_gaia_id", | 582 "obfuscated_gaia_id", |
| 566 1, | 583 1, |
| 567 false)); | 584 false)); |
| 568 expected.AddAccount(user2.Pass()); | 585 expected.AddAccount(user2.Pass()); |
| 569 EXPECT_EQ("123456789", expected.ObfuscatedGaiaId()); | 586 EXPECT_EQ("123456789", expected.ObfuscatedGaiaId()); |
| 570 | 587 |
| 571 scoped_ptr<Address> billing_address(new Address("US", | 588 scoped_ptr<Address> billing_address( |
| 572 ASCIIToUTF16("name"), | 589 new Address("US", |
| 573 ASCIIToUTF16("address1"), | 590 ASCIIToUTF16("name"), |
| 574 ASCIIToUTF16("address2"), | 591 StreetAddress("address1", "address2"), |
| 575 ASCIIToUTF16("city"), | 592 ASCIIToUTF16("city"), |
| 576 ASCIIToUTF16("state"), | 593 ASCIIToUTF16("burough"), |
| 577 ASCIIToUTF16("postal_code"), | 594 ASCIIToUTF16("state"), |
| 578 ASCIIToUTF16("phone_number"), | 595 ASCIIToUTF16("postal_code"), |
| 579 std::string())); | 596 ASCIIToUTF16("sorting_code"), |
| 597 ASCIIToUTF16("phone_number"), | |
| 598 std::string())); | |
| 580 std::vector<base::string16> supported_currencies; | 599 std::vector<base::string16> supported_currencies; |
| 581 supported_currencies.push_back(ASCIIToUTF16("currency")); | 600 supported_currencies.push_back(ASCIIToUTF16("currency")); |
| 582 scoped_ptr<WalletItems::MaskedInstrument> masked_instrument( | 601 scoped_ptr<WalletItems::MaskedInstrument> masked_instrument( |
| 583 new WalletItems::MaskedInstrument(ASCIIToUTF16("descriptive_name"), | 602 new WalletItems::MaskedInstrument(ASCIIToUTF16("descriptive_name"), |
| 584 WalletItems::MaskedInstrument::VISA, | 603 WalletItems::MaskedInstrument::VISA, |
| 585 supported_currencies, | 604 supported_currencies, |
| 586 ASCIIToUTF16("last_four_digits"), | 605 ASCIIToUTF16("last_four_digits"), |
| 587 12, | 606 12, |
| 588 2012, | 607 2012, |
| 589 billing_address.Pass(), | 608 billing_address.Pass(), |
| 590 WalletItems::MaskedInstrument::VALID, | 609 WalletItems::MaskedInstrument::VALID, |
| 591 "object_id")); | 610 "object_id")); |
| 592 expected.AddInstrument(masked_instrument.Pass()); | 611 expected.AddInstrument(masked_instrument.Pass()); |
| 593 | 612 |
| 594 scoped_ptr<Address> shipping_address( | 613 scoped_ptr<Address> shipping_address( |
| 595 new Address("US", | 614 new Address("US", |
| 596 ASCIIToUTF16("recipient_name"), | 615 ASCIIToUTF16("recipient_name"), |
| 597 ASCIIToUTF16("address_line_1"), | 616 StreetAddress("address_line_1", "address_line_2"), |
| 598 ASCIIToUTF16("address_line_2"), | |
| 599 ASCIIToUTF16("locality_name"), | 617 ASCIIToUTF16("locality_name"), |
| 618 ASCIIToUTF16("dependent_locality_name"), | |
| 600 ASCIIToUTF16("administrative_area_name"), | 619 ASCIIToUTF16("administrative_area_name"), |
| 601 ASCIIToUTF16("postal_code_number"), | 620 ASCIIToUTF16("postal_code_number"), |
| 621 ASCIIToUTF16("sorting_code"), | |
| 602 ASCIIToUTF16("phone_number"), | 622 ASCIIToUTF16("phone_number"), |
| 603 "id")); | 623 "id")); |
| 604 expected.AddAddress(shipping_address.Pass()); | 624 expected.AddAddress(shipping_address.Pass()); |
| 605 EXPECT_EQ(expected, *WalletItems::CreateWalletItems(*dict)); | 625 EXPECT_EQ(expected, *WalletItems::CreateWalletItems(*dict)); |
| 606 | 626 |
| 607 // Now try with a legal document as well. | 627 // Now try with a legal document as well. |
| 608 SetUpDictionary(std::string(kWalletItems) + | 628 SetUpDictionary(std::string(kWalletItems) + |
| 609 std::string(kRequiredLegalDocument) + | 629 std::string(kRequiredLegalDocument) + |
| 610 std::string(kCloseJson)); | 630 std::string(kCloseJson)); |
| 611 scoped_ptr<WalletItems::LegalDocument> legal_document( | 631 scoped_ptr<WalletItems::LegalDocument> legal_document( |
| 612 new WalletItems::LegalDocument("doc_id", | 632 new WalletItems::LegalDocument("doc_id", |
| 613 ASCIIToUTF16("display_name"))); | 633 ASCIIToUTF16("display_name"))); |
| 614 expected.AddLegalDocument(legal_document.Pass()); | 634 expected.AddLegalDocument(legal_document.Pass()); |
| 615 expected.AddLegalDocument( | 635 expected.AddLegalDocument( |
| 616 WalletItems::LegalDocument::CreatePrivacyPolicyDocument()); | 636 WalletItems::LegalDocument::CreatePrivacyPolicyDocument()); |
| 617 | 637 |
| 618 EXPECT_EQ(expected, *WalletItems::CreateWalletItems(*dict)); | 638 EXPECT_EQ(expected, *WalletItems::CreateWalletItems(*dict)); |
| 619 } | 639 } |
| 620 | 640 |
| 621 } // namespace wallet | 641 } // namespace wallet |
| 622 } // namespace autofill | 642 } // namespace autofill |
| OLD | NEW |