| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/json/json_reader.h" | |
| 6 #include "base/logging.h" | |
| 7 #include "base/memory/scoped_ptr.h" | |
| 8 #include "base/utf_string_conversions.h" | |
| 9 #include "base/values.h" | |
| 10 #include "chrome/browser/autofill/wallet/required_action.h" | |
| 11 #include "chrome/browser/autofill/wallet/wallet_items.h" | |
| 12 #include "googleurl/src/gurl.h" | |
| 13 #include "testing/gtest/include/gtest/gtest.h" | |
| 14 | |
| 15 namespace { | |
| 16 | |
| 17 const char kMaskedInstrument[] = | |
| 18 "{" | |
| 19 " \"descriptive_name\":\"descriptive_name\"," | |
| 20 " \"type\":\"VISA\"," | |
| 21 " \"supported_currency\":" | |
| 22 " [" | |
| 23 " \"currency\"" | |
| 24 " ]," | |
| 25 " \"last_four_digits\":\"last_four_digits\"," | |
| 26 " \"expiration_month\":12," | |
| 27 " \"expiration_year\":2012," | |
| 28 " \"billing_address\":" | |
| 29 " {" | |
| 30 " \"name\":\"name\"," | |
| 31 " \"address1\":\"address1\"," | |
| 32 " \"address2\":\"address2\"," | |
| 33 " \"city\":\"city\"," | |
| 34 " \"state\":\"state\"," | |
| 35 " \"postal_code\":\"postal_code\"," | |
| 36 " \"phone_number\":\"phone_number\"," | |
| 37 " \"country_code\":\"country_code\"" | |
| 38 " }," | |
| 39 " \"status\":\"VALID\"," | |
| 40 " \"object_id\":\"object_id\"" | |
| 41 "}"; | |
| 42 | |
| 43 const char kMaskedInstrumentMissingStatus[] = | |
| 44 "{" | |
| 45 " \"descriptive_name\":\"descriptive_name\"," | |
| 46 " \"type\":\"VISA\"," | |
| 47 " \"supported_currency\":" | |
| 48 " [" | |
| 49 " \"currency\"" | |
| 50 " ]," | |
| 51 " \"last_four_digits\":\"last_four_digits\"," | |
| 52 " \"expiration_month\":12," | |
| 53 " \"expiration_year\":2012," | |
| 54 " \"billing_address\":" | |
| 55 " {" | |
| 56 " \"name\":\"name\"," | |
| 57 " \"address1\":\"address1\"," | |
| 58 " \"address2\":\"address2\"," | |
| 59 " \"city\":\"city\"," | |
| 60 " \"state\":\"state\"," | |
| 61 " \"postal_code\":\"postal_code\"," | |
| 62 " \"phone_number\":\"phone_number\"," | |
| 63 " \"country_code\":\"country_code\"" | |
| 64 " }," | |
| 65 " \"object_id\":\"object_id\"" | |
| 66 "}"; | |
| 67 | |
| 68 const char kMaskedInstrumentMissingType[] = | |
| 69 "{" | |
| 70 " \"descriptive_name\":\"descriptive_name\"," | |
| 71 " \"supported_currency\":" | |
| 72 " [" | |
| 73 " \"currency\"" | |
| 74 " ]," | |
| 75 " \"last_four_digits\":\"last_four_digits\"," | |
| 76 " \"expiration_month\":12," | |
| 77 " \"expiration_year\":2012," | |
| 78 " \"billing_address\":" | |
| 79 " {" | |
| 80 " \"name\":\"name\"," | |
| 81 " \"address1\":\"address1\"," | |
| 82 " \"address2\":\"address2\"," | |
| 83 " \"city\":\"city\"," | |
| 84 " \"state\":\"state\"," | |
| 85 " \"postal_code\":\"postal_code\"," | |
| 86 " \"phone_number\":\"phone_number\"," | |
| 87 " \"country_code\":\"country_code\"" | |
| 88 " }," | |
| 89 " \"status\":\"VALID\"," | |
| 90 " \"object_id\":\"object_id\"" | |
| 91 "}"; | |
| 92 | |
| 93 const char kMaskedInstrumentMissingLastFourDigits[] = | |
| 94 "{" | |
| 95 " \"descriptive_name\":\"descriptive_name\"," | |
| 96 " \"type\":\"VISA\"," | |
| 97 " \"supported_currency\":" | |
| 98 " [" | |
| 99 " \"currency\"" | |
| 100 " ]," | |
| 101 " \"expiration_month\":12," | |
| 102 " \"expiration_year\":2012," | |
| 103 " \"billing_address\":" | |
| 104 " {" | |
| 105 " \"name\":\"name\"," | |
| 106 " \"address1\":\"address1\"," | |
| 107 " \"address2\":\"address2\"," | |
| 108 " \"city\":\"city\"," | |
| 109 " \"state\":\"state\"," | |
| 110 " \"postal_code\":\"postal_code\"," | |
| 111 " \"phone_number\":\"phone_number\"," | |
| 112 " \"country_code\":\"country_code\"" | |
| 113 " }," | |
| 114 " \"status\":\"VALID\"," | |
| 115 " \"object_id\":\"object_id\"" | |
| 116 "}"; | |
| 117 | |
| 118 const char kMaskedInstrumentMissingAddress[] = | |
| 119 "{" | |
| 120 " \"descriptive_name\":\"descriptive_name\"," | |
| 121 " \"type\":\"VISA\"," | |
| 122 " \"supported_currency\":" | |
| 123 " [" | |
| 124 " \"currency\"" | |
| 125 " ]," | |
| 126 " \"last_four_digits\":\"last_four_digits\"," | |
| 127 " \"expiration_month\":12," | |
| 128 " \"expiration_year\":2012," | |
| 129 " \"status\":\"VALID\"," | |
| 130 " \"object_id\":\"object_id\"" | |
| 131 "}"; | |
| 132 | |
| 133 const char kMaskedInstrumentMalformedAddress[] = | |
| 134 "{" | |
| 135 " \"descriptive_name\":\"descriptive_name\"," | |
| 136 " \"type\":\"VISA\"," | |
| 137 " \"supported_currency\":" | |
| 138 " [" | |
| 139 " \"currency\"" | |
| 140 " ]," | |
| 141 " \"last_four_digits\":\"last_four_digits\"," | |
| 142 " \"expiration_month\":12," | |
| 143 " \"expiration_year\":2012," | |
| 144 " \"billing_address\":" | |
| 145 " {" | |
| 146 " \"address1\":\"address1\"," | |
| 147 " \"address2\":\"address2\"," | |
| 148 " \"city\":\"city\"," | |
| 149 " \"state\":\"state\"," | |
| 150 " \"phone_number\":\"phone_number\"," | |
| 151 " \"country_code\":\"country_code\"" | |
| 152 " }," | |
| 153 " \"status\":\"VALID\"," | |
| 154 " \"object_id\":\"object_id\"" | |
| 155 "}"; | |
| 156 | |
| 157 const char kMaskedInstrumentMissingObjectId[] = | |
| 158 "{" | |
| 159 " \"descriptive_name\":\"descriptive_name\"," | |
| 160 " \"type\":\"VISA\"," | |
| 161 " \"supported_currency\":" | |
| 162 " [" | |
| 163 " \"currency\"" | |
| 164 " ]," | |
| 165 " \"last_four_digits\":\"last_four_digits\"," | |
| 166 " \"expiration_month\":12," | |
| 167 " \"expiration_year\":2012," | |
| 168 " \"billing_address\":" | |
| 169 " {" | |
| 170 " \"name\":\"name\"," | |
| 171 " \"address1\":\"address1\"," | |
| 172 " \"address2\":\"address2\"," | |
| 173 " \"city\":\"city\"," | |
| 174 " \"state\":\"state\"," | |
| 175 " \"postal_code\":\"postal_code\"," | |
| 176 " \"phone_number\":\"phone_number\"," | |
| 177 " \"country_code\":\"country_code\"" | |
| 178 " }," | |
| 179 " \"status\":\"VALID\"" | |
| 180 "}"; | |
| 181 | |
| 182 const char kLegalDocument[] = | |
| 183 "{" | |
| 184 " \"legal_document_id\":\"doc_id\"," | |
| 185 " \"display_name\":\"display_name\"" | |
| 186 "}"; | |
| 187 | |
| 188 const char kLegalDocumentMissingDocumentId[] = | |
| 189 "{" | |
| 190 " \"display_name\":\"display_name\"" | |
| 191 "}"; | |
| 192 | |
| 193 const char kLegalDocumentMissingDisplayName[] = | |
| 194 "{" | |
| 195 " \"legal_document_id\":\"doc_id\"" | |
| 196 "}"; | |
| 197 | |
| 198 const char kWalletItemsWithRequiredActions[] = | |
| 199 "{" | |
| 200 " \"obfuscated_gaia_id\":\"\"," | |
| 201 " \"required_action\":" | |
| 202 " [" | |
| 203 " \" setup_wallet\"," | |
| 204 " \"AcCePt_ToS \"," | |
| 205 " \" \\tGAIA_auth \\n\\r\"," | |
| 206 " \"UPDATE_expiration_date\"," | |
| 207 " \"UPGRADE_min_ADDRESS \"," | |
| 208 " \" pAsSiVe_GAIA_auth \"," | |
| 209 " \" REQUIRE_PHONE_NUMBER\\t \"" | |
| 210 " ]" | |
| 211 "}"; | |
| 212 | |
| 213 const char kWalletItemsWithInvalidRequiredActions[] = | |
| 214 "{" | |
| 215 " \"obfuscated_gaia_id\":\"\"," | |
| 216 " \"required_action\":" | |
| 217 " [" | |
| 218 " \"verify_CVV\"," | |
| 219 " \"invalid_FORM_FIELD\"," | |
| 220 " \" 忍者の正体 \"" | |
| 221 " ]" | |
| 222 "}"; | |
| 223 | |
| 224 const char kWalletItemsMissingGoogleTransactionId[] = | |
| 225 "{" | |
| 226 " \"required_action\":" | |
| 227 " [" | |
| 228 " ]," | |
| 229 " \"instrument\":" | |
| 230 " [" | |
| 231 " {" | |
| 232 " \"descriptive_name\":\"descriptive_name\"," | |
| 233 " \"type\":\"VISA\"," | |
| 234 " \"supported_currency\":" | |
| 235 " [" | |
| 236 " \"currency\"" | |
| 237 " ]," | |
| 238 " \"last_four_digits\":\"last_four_digits\"," | |
| 239 " \"expiration_month\":12," | |
| 240 " \"expiration_year\":2012," | |
| 241 " \"billing_address\":" | |
| 242 " {" | |
| 243 " \"name\":\"name\"," | |
| 244 " \"address1\":\"address1\"," | |
| 245 " \"address2\":\"address2\"," | |
| 246 " \"city\":\"city\"," | |
| 247 " \"state\":\"state\"," | |
| 248 " \"postal_code\":\"postal_code\"," | |
| 249 " \"phone_number\":\"phone_number\"," | |
| 250 " \"country_code\":\"country_code\"" | |
| 251 " }," | |
| 252 " \"status\":\"VALID\"," | |
| 253 " \"object_id\":\"object_id\"" | |
| 254 " }" | |
| 255 " ]," | |
| 256 " \"default_instrument_id\":\"default_instrument_id\"," | |
| 257 " \"address\":" | |
| 258 " [" | |
| 259 " {" | |
| 260 " \"id\":\"id\"," | |
| 261 " \"phone_number\":\"phone_number\"," | |
| 262 " \"postal_address\":" | |
| 263 " {" | |
| 264 " \"recipient_name\":\"recipient_name\"," | |
| 265 " \"address_line_1\":\"address_line_1\"," | |
| 266 " \"address_line_2\":\"address_line_2\"," | |
| 267 " \"locality_name\":\"locality_name\"," | |
| 268 " \"administrative_area_name\":\"administrative_area_name\"," | |
| 269 " \"postal_code_number\":\"postal_code_number\"," | |
| 270 " \"country_name_code\":\"country_name_code\"" | |
| 271 " }" | |
| 272 " }" | |
| 273 " ]," | |
| 274 " \"default_address_id\":\"default_address_id\"," | |
| 275 " \"obfuscated_gaia_id\":\"obfuscated_gaia_id\"," | |
| 276 " \"required_legal_document\":" | |
| 277 " [" | |
| 278 " {" | |
| 279 " \"legal_document_id\":\"doc_id\"," | |
| 280 " \"display_name\":\"display_name\"" | |
| 281 " }" | |
| 282 " ]" | |
| 283 "}"; | |
| 284 | |
| 285 const char kWalletItems[] = | |
| 286 "{" | |
| 287 " \"required_action\":" | |
| 288 " [" | |
| 289 " ]," | |
| 290 " \"google_transaction_id\":\"google_transaction_id\"," | |
| 291 " \"instrument\":" | |
| 292 " [" | |
| 293 " {" | |
| 294 " \"descriptive_name\":\"descriptive_name\"," | |
| 295 " \"type\":\"VISA\"," | |
| 296 " \"supported_currency\":" | |
| 297 " [" | |
| 298 " \"currency\"" | |
| 299 " ]," | |
| 300 " \"last_four_digits\":\"last_four_digits\"," | |
| 301 " \"expiration_month\":12," | |
| 302 " \"expiration_year\":2012," | |
| 303 " \"billing_address\":" | |
| 304 " {" | |
| 305 " \"name\":\"name\"," | |
| 306 " \"address1\":\"address1\"," | |
| 307 " \"address2\":\"address2\"," | |
| 308 " \"city\":\"city\"," | |
| 309 " \"state\":\"state\"," | |
| 310 " \"postal_code\":\"postal_code\"," | |
| 311 " \"phone_number\":\"phone_number\"," | |
| 312 " \"country_code\":\"country_code\"" | |
| 313 " }," | |
| 314 " \"status\":\"VALID\"," | |
| 315 " \"object_id\":\"object_id\"" | |
| 316 " }" | |
| 317 " ]," | |
| 318 " \"default_instrument_id\":\"default_instrument_id\"," | |
| 319 " \"address\":" | |
| 320 " [" | |
| 321 " {" | |
| 322 " \"id\":\"id\"," | |
| 323 " \"phone_number\":\"phone_number\"," | |
| 324 " \"postal_address\":" | |
| 325 " {" | |
| 326 " \"recipient_name\":\"recipient_name\"," | |
| 327 " \"address_line_1\":\"address_line_1\"," | |
| 328 " \"address_line_2\":\"address_line_2\"," | |
| 329 " \"locality_name\":\"locality_name\"," | |
| 330 " \"administrative_area_name\":\"administrative_area_name\"," | |
| 331 " \"postal_code_number\":\"postal_code_number\"," | |
| 332 " \"country_name_code\":\"country_name_code\"" | |
| 333 " }" | |
| 334 " }" | |
| 335 " ]," | |
| 336 " \"default_address_id\":\"default_address_id\"," | |
| 337 " \"obfuscated_gaia_id\":\"obfuscated_gaia_id\"," | |
| 338 " \"required_legal_document\":" | |
| 339 " [" | |
| 340 " {" | |
| 341 " \"legal_document_id\":\"doc_id\"," | |
| 342 " \"display_name\":\"display_name\"" | |
| 343 " }" | |
| 344 " ]" | |
| 345 "}"; | |
| 346 | |
| 347 } // anonymous namespace | |
| 348 | |
| 349 namespace autofill { | |
| 350 namespace wallet { | |
| 351 | |
| 352 class WalletItemsTest : public testing::Test { | |
| 353 public: | |
| 354 WalletItemsTest() {} | |
| 355 protected: | |
| 356 void SetUpDictionary(const std::string& json) { | |
| 357 scoped_ptr<Value> value(base::JSONReader::Read(json)); | |
| 358 ASSERT_TRUE(value.get()); | |
| 359 ASSERT_TRUE(value->IsType(Value::TYPE_DICTIONARY)); | |
| 360 dict.reset(static_cast<DictionaryValue*>(value.release())); | |
| 361 } | |
| 362 scoped_ptr<DictionaryValue> dict; | |
| 363 }; | |
| 364 | |
| 365 TEST_F(WalletItemsTest, CreateMaskedInstrumentMissingStatus) { | |
| 366 SetUpDictionary(kMaskedInstrumentMissingStatus); | |
| 367 EXPECT_EQ(NULL, | |
| 368 WalletItems::MaskedInstrument::CreateMaskedInstrument(*dict).get()); | |
| 369 } | |
| 370 | |
| 371 TEST_F(WalletItemsTest, CreateMaskedInstrumentMissingType) { | |
| 372 SetUpDictionary(kMaskedInstrumentMissingType); | |
| 373 EXPECT_EQ(NULL, | |
| 374 WalletItems::MaskedInstrument::CreateMaskedInstrument(*dict).get()); | |
| 375 } | |
| 376 | |
| 377 TEST_F(WalletItemsTest, CreateMaskedInstrumentMissingLastFourDigits) { | |
| 378 SetUpDictionary(kMaskedInstrumentMissingLastFourDigits); | |
| 379 EXPECT_EQ(NULL, | |
| 380 WalletItems::MaskedInstrument::CreateMaskedInstrument(*dict).get()); | |
| 381 } | |
| 382 | |
| 383 TEST_F(WalletItemsTest, CreateMaskedInstrumentMissingAddress) { | |
| 384 SetUpDictionary(kMaskedInstrumentMissingAddress); | |
| 385 EXPECT_EQ(NULL, | |
| 386 WalletItems::MaskedInstrument::CreateMaskedInstrument(*dict).get()); | |
| 387 } | |
| 388 | |
| 389 TEST_F(WalletItemsTest, CreateMaskedInstrumentMalformedAddress) { | |
| 390 SetUpDictionary(kMaskedInstrumentMalformedAddress); | |
| 391 EXPECT_EQ(NULL, | |
| 392 WalletItems::MaskedInstrument::CreateMaskedInstrument(*dict).get()); | |
| 393 } | |
| 394 | |
| 395 TEST_F(WalletItemsTest, CreateMaskedInstrumentMissingObjectId) { | |
| 396 SetUpDictionary(kMaskedInstrumentMissingObjectId); | |
| 397 EXPECT_EQ(NULL, | |
| 398 WalletItems::MaskedInstrument::CreateMaskedInstrument(*dict).get()); | |
| 399 } | |
| 400 | |
| 401 TEST_F(WalletItemsTest, CreateMaskedInstrument) { | |
| 402 SetUpDictionary(kMaskedInstrument); | |
| 403 scoped_ptr<Address> address(new Address("country_code", | |
| 404 ASCIIToUTF16("name"), | |
| 405 ASCIIToUTF16("address1"), | |
| 406 ASCIIToUTF16("address2"), | |
| 407 ASCIIToUTF16("city"), | |
| 408 ASCIIToUTF16("state"), | |
| 409 ASCIIToUTF16("postal_code"), | |
| 410 ASCIIToUTF16("phone_number"), | |
| 411 "")); | |
| 412 std::vector<string16> supported_currencies; | |
| 413 supported_currencies.push_back(ASCIIToUTF16("currency")); | |
| 414 WalletItems::MaskedInstrument masked_instrument( | |
| 415 ASCIIToUTF16("descriptive_name"), | |
| 416 WalletItems::MaskedInstrument::VISA, | |
| 417 supported_currencies, | |
| 418 ASCIIToUTF16("last_four_digits"), | |
| 419 12, | |
| 420 2012, | |
| 421 address.Pass(), | |
| 422 WalletItems::MaskedInstrument::VALID, | |
| 423 "object_id"); | |
| 424 EXPECT_EQ(masked_instrument, | |
| 425 *WalletItems::MaskedInstrument::CreateMaskedInstrument(*dict)); | |
| 426 } | |
| 427 | |
| 428 TEST_F(WalletItemsTest, CreateLegalDocumentMissingDocId) { | |
| 429 SetUpDictionary(kLegalDocumentMissingDocumentId); | |
| 430 EXPECT_EQ(NULL, WalletItems::LegalDocument::CreateLegalDocument(*dict).get()); | |
| 431 } | |
| 432 | |
| 433 TEST_F(WalletItemsTest, CreateLegalDocumentMissingDisplayName) { | |
| 434 SetUpDictionary(kLegalDocumentMissingDisplayName); | |
| 435 EXPECT_EQ(NULL, WalletItems::LegalDocument::CreateLegalDocument(*dict).get()); | |
| 436 } | |
| 437 | |
| 438 TEST_F(WalletItemsTest, CreateLegalDocument) { | |
| 439 SetUpDictionary(kLegalDocument); | |
| 440 WalletItems::LegalDocument expected("doc_id", "display_name"); | |
| 441 EXPECT_EQ(expected, | |
| 442 *WalletItems::LegalDocument::CreateLegalDocument(*dict)); | |
| 443 } | |
| 444 | |
| 445 TEST_F(WalletItemsTest, LegalDocumentGetUrl) { | |
| 446 WalletItems::LegalDocument legal_doc("doc_id", "display_name"); | |
| 447 EXPECT_EQ("https://wallet.google.com/customer/gadget/legaldocument.html?" | |
| 448 "docId=doc_id", | |
| 449 legal_doc.GetUrl().spec()); | |
| 450 } | |
| 451 | |
| 452 TEST_F(WalletItemsTest, CreateWalletItemsWithRequiredActions) { | |
| 453 SetUpDictionary(kWalletItemsWithRequiredActions); | |
| 454 | |
| 455 std::vector<RequiredAction> required_actions; | |
| 456 required_actions.push_back(SETUP_WALLET); | |
| 457 required_actions.push_back(ACCEPT_TOS); | |
| 458 required_actions.push_back(GAIA_AUTH); | |
| 459 required_actions.push_back(UPDATE_EXPIRATION_DATE); | |
| 460 required_actions.push_back(UPGRADE_MIN_ADDRESS); | |
| 461 required_actions.push_back(PASSIVE_GAIA_AUTH); | |
| 462 required_actions.push_back(REQUIRE_PHONE_NUMBER); | |
| 463 | |
| 464 WalletItems expected(required_actions, | |
| 465 std::string(), | |
| 466 std::string(), | |
| 467 std::string(), | |
| 468 std::string()); | |
| 469 EXPECT_EQ(expected, *WalletItems::CreateWalletItems(*dict)); | |
| 470 | |
| 471 ASSERT_FALSE(required_actions.empty()); | |
| 472 required_actions.pop_back(); | |
| 473 WalletItems different_required_actions(required_actions, | |
| 474 std::string(), | |
| 475 std::string(), | |
| 476 std::string(), | |
| 477 std::string()); | |
| 478 EXPECT_NE(expected, different_required_actions); | |
| 479 } | |
| 480 | |
| 481 TEST_F(WalletItemsTest, CreateWalletItemsWithInvalidRequiredActions) { | |
| 482 SetUpDictionary(kWalletItemsWithInvalidRequiredActions); | |
| 483 EXPECT_EQ(NULL, WalletItems::CreateWalletItems(*dict).get()); | |
| 484 } | |
| 485 | |
| 486 TEST_F(WalletItemsTest, CreateWalletItemsMissingGoogleTransactionId) { | |
| 487 SetUpDictionary(kWalletItemsMissingGoogleTransactionId); | |
| 488 EXPECT_EQ(NULL, WalletItems::CreateWalletItems(*dict).get()); | |
| 489 } | |
| 490 | |
| 491 TEST_F(WalletItemsTest, CreateWalletItems) { | |
| 492 SetUpDictionary(kWalletItems); | |
| 493 std::vector<RequiredAction> required_actions; | |
| 494 WalletItems expected(required_actions, | |
| 495 "google_transaction_id", | |
| 496 "default_instrument_id", | |
| 497 "default_address_id", | |
| 498 "obfuscated_gaia_id"); | |
| 499 | |
| 500 scoped_ptr<Address> billing_address(new Address("country_code", | |
| 501 ASCIIToUTF16("name"), | |
| 502 ASCIIToUTF16("address1"), | |
| 503 ASCIIToUTF16("address2"), | |
| 504 ASCIIToUTF16("city"), | |
| 505 ASCIIToUTF16("state"), | |
| 506 ASCIIToUTF16("postal_code"), | |
| 507 ASCIIToUTF16("phone_number"), | |
| 508 "")); | |
| 509 std::vector<string16> supported_currencies; | |
| 510 supported_currencies.push_back(ASCIIToUTF16("currency")); | |
| 511 scoped_ptr<WalletItems::MaskedInstrument> masked_instrument( | |
| 512 new WalletItems::MaskedInstrument(ASCIIToUTF16("descriptive_name"), | |
| 513 WalletItems::MaskedInstrument::VISA, | |
| 514 supported_currencies, | |
| 515 ASCIIToUTF16("last_four_digits"), | |
| 516 12, | |
| 517 2012, | |
| 518 billing_address.Pass(), | |
| 519 WalletItems::MaskedInstrument::VALID, | |
| 520 "object_id")); | |
| 521 expected.AddInstrument(masked_instrument.Pass()); | |
| 522 | |
| 523 scoped_ptr<Address> shipping_address(new Address("country_code", | |
| 524 ASCIIToUTF16("name"), | |
| 525 ASCIIToUTF16("address1"), | |
| 526 ASCIIToUTF16("address2"), | |
| 527 ASCIIToUTF16("city"), | |
| 528 ASCIIToUTF16("state"), | |
| 529 ASCIIToUTF16("postal_code"), | |
| 530 ASCIIToUTF16("phone_number"), | |
| 531 "id")); | |
| 532 expected.AddAddress(shipping_address.Pass()); | |
| 533 | |
| 534 scoped_ptr<WalletItems::LegalDocument> legal_document( | |
| 535 new WalletItems::LegalDocument("doc_id", | |
| 536 "display_name")); | |
| 537 expected.AddLegalDocument(legal_document.Pass()); | |
| 538 | |
| 539 EXPECT_EQ(expected, *WalletItems::CreateWalletItems(*dict)); | |
| 540 } | |
| 541 | |
| 542 } // namespace wallet | |
| 543 } // namespace autofill | |
| OLD | NEW |