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/json/json_writer.h" | 6 #include "base/json/json_writer.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 " \"debug_data\":" | 286 " \"debug_data\":" |
287 " {" | 287 " {" |
288 " \"debug_message\":\"debug_message\"," | 288 " \"debug_message\":\"debug_message\"," |
289 " \"stack_trace\":\"stack_trace\"" | 289 " \"stack_trace\":\"stack_trace\"" |
290 " }," | 290 " }," |
291 " \"application_error_data\":\"application_error_data\"" | 291 " \"application_error_data\":\"application_error_data\"" |
292 "}"; | 292 "}"; |
293 | 293 |
294 // The JSON below is used to test against the request payload being sent to | 294 // The JSON below is used to test against the request payload being sent to |
295 // Online Wallet. It's indented differently since JSONWriter creates compact | 295 // Online Wallet. It's indented differently since JSONWriter creates compact |
296 // JSON from DictionaryValues. | 296 // JSON from DictionaryValues. NB: The values must be alphabetical to pass |
| 297 // the tests. |
297 | 298 |
298 const char kAcceptLegalDocumentsValidRequest[] = | 299 const char kAcceptLegalDocumentsValidRequest[] = |
299 "{" | 300 "{" |
300 "\"accepted_legal_document\":" | 301 "\"accepted_legal_document\":" |
301 "[" | 302 "[" |
302 "\"doc_id_1\"," | 303 "\"doc_id_1\"," |
303 "\"doc_id_2\"" | 304 "\"doc_id_2\"" |
304 "]," | 305 "]," |
305 "\"google_transaction_id\":\"google-transaction-id\"," | 306 "\"google_transaction_id\":\"google-transaction-id\"," |
306 "\"merchant_domain\":\"https://example.com/\"" | 307 "\"merchant_domain\":\"https://example.com/\"" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 "\"phone_number\":\"save_phone_number\"," | 388 "\"phone_number\":\"save_phone_number\"," |
388 "\"postal_address\":" | 389 "\"postal_address\":" |
389 "{" | 390 "{" |
390 "\"address_line\":" | 391 "\"address_line\":" |
391 "[" | 392 "[" |
392 "\"save_address_line_1\"," | 393 "\"save_address_line_1\"," |
393 "\"save_address_line_2\"" | 394 "\"save_address_line_2\"" |
394 "]," | 395 "]," |
395 "\"administrative_area_name\":\"save_admin_area_name\"," | 396 "\"administrative_area_name\":\"save_admin_area_name\"," |
396 "\"country_name_code\":\"US\"," | 397 "\"country_name_code\":\"US\"," |
| 398 "\"dependent_locality_name\":\"save_dependent_locality_name\"," |
397 "\"locality_name\":\"save_locality_name\"," | 399 "\"locality_name\":\"save_locality_name\"," |
398 "\"postal_code_number\":\"save_postal_code_number\"," | 400 "\"postal_code_number\":\"save_postal_code_number\"," |
399 "\"recipient_name\":\"save_recipient_name\"" | 401 "\"recipient_name\":\"save_recipient_name\"," |
| 402 "\"sorting_code\":\"save_sorting_code\"" |
400 "}" | 403 "}" |
401 "}," | 404 "}," |
402 "\"use_minimal_addresses\":false" | 405 "\"use_minimal_addresses\":false" |
403 "}"; | 406 "}"; |
404 | 407 |
405 const char kSaveInstrumentValidRequest[] = | 408 const char kSaveInstrumentValidRequest[] = |
406 "{" | 409 "{" |
407 "\"instrument\":" | 410 "\"instrument\":" |
408 "{" | 411 "{" |
409 "\"credit_card\":" | 412 "\"credit_card\":" |
410 "{" | 413 "{" |
411 "\"address\":" | 414 "\"address\":" |
412 "{" | 415 "{" |
413 "\"address_line\":" | 416 "\"address_line\":" |
414 "[" | 417 "[" |
415 "\"address_line_1\"," | 418 "\"address_line_1\"," |
416 "\"address_line_2\"" | 419 "\"address_line_2\"" |
417 "]," | 420 "]," |
418 "\"administrative_area_name\":\"admin_area_name\"," | 421 "\"administrative_area_name\":\"admin_area_name\"," |
419 "\"country_name_code\":\"US\"," | 422 "\"country_name_code\":\"US\"," |
| 423 "\"dependent_locality_name\":\"dependent_locality_name\"," |
420 "\"locality_name\":\"locality_name\"," | 424 "\"locality_name\":\"locality_name\"," |
421 "\"postal_code_number\":\"postal_code_number\"," | 425 "\"postal_code_number\":\"postal_code_number\"," |
422 "\"recipient_name\":\"recipient_name\"" | 426 "\"recipient_name\":\"recipient_name\"," |
| 427 "\"sorting_code\":\"sorting_code\"" |
423 "}," | 428 "}," |
424 "\"exp_month\":12," | 429 "\"exp_month\":12," |
425 "\"exp_year\":3000," | 430 "\"exp_year\":3000," |
426 "\"fop_type\":\"VISA\"," | 431 "\"fop_type\":\"VISA\"," |
427 "\"last_4_digits\":\"4448\"" | 432 "\"last_4_digits\":\"4448\"" |
428 "}," | 433 "}," |
429 "\"type\":\"CREDIT_CARD\"" | 434 "\"type\":\"CREDIT_CARD\"" |
430 "}," | 435 "}," |
431 "\"instrument_phone_number\":\"phone_number\"," | 436 "\"instrument_phone_number\":\"phone_number\"," |
432 "\"merchant_domain\":\"https://example.com/\"," | 437 "\"merchant_domain\":\"https://example.com/\"," |
(...skipping 10 matching lines...) Expand all Loading... |
443 "{" | 448 "{" |
444 "\"address\":" | 449 "\"address\":" |
445 "{" | 450 "{" |
446 "\"address_line\":" | 451 "\"address_line\":" |
447 "[" | 452 "[" |
448 "\"address_line_1\"," | 453 "\"address_line_1\"," |
449 "\"address_line_2\"" | 454 "\"address_line_2\"" |
450 "]," | 455 "]," |
451 "\"administrative_area_name\":\"admin_area_name\"," | 456 "\"administrative_area_name\":\"admin_area_name\"," |
452 "\"country_name_code\":\"US\"," | 457 "\"country_name_code\":\"US\"," |
| 458 "\"dependent_locality_name\":\"dependent_locality_name\"," |
453 "\"locality_name\":\"locality_name\"," | 459 "\"locality_name\":\"locality_name\"," |
454 "\"postal_code_number\":\"postal_code_number\"," | 460 "\"postal_code_number\":\"postal_code_number\"," |
455 "\"recipient_name\":\"recipient_name\"" | 461 "\"recipient_name\":\"recipient_name\"," |
| 462 "\"sorting_code\":\"sorting_code\"" |
456 "}," | 463 "}," |
457 "\"exp_month\":12," | 464 "\"exp_month\":12," |
458 "\"exp_year\":3000," | 465 "\"exp_year\":3000," |
459 "\"fop_type\":\"VISA\"," | 466 "\"fop_type\":\"VISA\"," |
460 "\"last_4_digits\":\"4448\"" | 467 "\"last_4_digits\":\"4448\"" |
461 "}," | 468 "}," |
462 "\"type\":\"CREDIT_CARD\"" | 469 "\"type\":\"CREDIT_CARD\"" |
463 "}," | 470 "}," |
464 "\"instrument_phone_number\":\"phone_number\"," | 471 "\"instrument_phone_number\":\"phone_number\"," |
465 "\"merchant_domain\":\"https://example.com/\"," | 472 "\"merchant_domain\":\"https://example.com/\"," |
466 "\"phone_number_required\":true," | 473 "\"phone_number_required\":true," |
467 "\"risk_params\":\"risky business\"," | 474 "\"risk_params\":\"risky business\"," |
468 "\"shipping_address\":" | 475 "\"shipping_address\":" |
469 "{" | 476 "{" |
470 "\"phone_number\":\"save_phone_number\"," | 477 "\"phone_number\":\"save_phone_number\"," |
471 "\"postal_address\":" | 478 "\"postal_address\":" |
472 "{" | 479 "{" |
473 "\"address_line\":" | 480 "\"address_line\":" |
474 "[" | 481 "[" |
475 "\"save_address_line_1\"," | 482 "\"save_address_line_1\"," |
476 "\"save_address_line_2\"" | 483 "\"save_address_line_2\"" |
477 "]," | 484 "]," |
478 "\"administrative_area_name\":\"save_admin_area_name\"," | 485 "\"administrative_area_name\":\"save_admin_area_name\"," |
479 "\"country_name_code\":\"US\"," | 486 "\"country_name_code\":\"US\"," |
| 487 "\"dependent_locality_name\":\"save_dependent_locality_name\"," |
480 "\"locality_name\":\"save_locality_name\"," | 488 "\"locality_name\":\"save_locality_name\"," |
481 "\"postal_code_number\":\"save_postal_code_number\"," | 489 "\"postal_code_number\":\"save_postal_code_number\"," |
482 "\"recipient_name\":\"save_recipient_name\"" | 490 "\"recipient_name\":\"save_recipient_name\"," |
| 491 "\"sorting_code\":\"save_sorting_code\"" |
483 "}" | 492 "}" |
484 "}," | 493 "}," |
485 "\"use_minimal_addresses\":false" | 494 "\"use_minimal_addresses\":false" |
486 "}"; | 495 "}"; |
487 | 496 |
488 const char kUpdateAddressValidRequest[] = | 497 const char kUpdateAddressValidRequest[] = |
489 "{" | 498 "{" |
490 "\"merchant_domain\":\"https://example.com/\"," | 499 "\"merchant_domain\":\"https://example.com/\"," |
491 "\"phone_number_required\":true," | 500 "\"phone_number_required\":true," |
492 "\"risk_params\":\"risky business\"," | 501 "\"risk_params\":\"risky business\"," |
493 "\"shipping_address\":" | 502 "\"shipping_address\":" |
494 "{" | 503 "{" |
495 "\"id\":\"address_id\"," | 504 "\"id\":\"address_id\"," |
496 "\"phone_number\":\"ship_phone_number\"," | 505 "\"phone_number\":\"ship_phone_number\"," |
497 "\"postal_address\":" | 506 "\"postal_address\":" |
498 "{" | 507 "{" |
499 "\"address_line\":" | 508 "\"address_line\":" |
500 "[" | 509 "[" |
501 "\"ship_address_line_1\"," | 510 "\"ship_address_line_1\"," |
502 "\"ship_address_line_2\"" | 511 "\"ship_address_line_2\"" |
503 "]," | 512 "]," |
504 "\"administrative_area_name\":\"ship_admin_area_name\"," | 513 "\"administrative_area_name\":\"ship_admin_area_name\"," |
505 "\"country_name_code\":\"US\"," | 514 "\"country_name_code\":\"US\"," |
| 515 "\"dependent_locality_name\":\"ship_dependent_locality_name\"," |
506 "\"locality_name\":\"ship_locality_name\"," | 516 "\"locality_name\":\"ship_locality_name\"," |
507 "\"postal_code_number\":\"ship_postal_code_number\"," | 517 "\"postal_code_number\":\"ship_postal_code_number\"," |
508 "\"recipient_name\":\"ship_recipient_name\"" | 518 "\"recipient_name\":\"ship_recipient_name\"," |
| 519 "\"sorting_code\":\"ship_sorting_code\"" |
509 "}" | 520 "}" |
510 "}," | 521 "}," |
511 "\"use_minimal_addresses\":false" | 522 "\"use_minimal_addresses\":false" |
512 "}"; | 523 "}"; |
513 | 524 |
514 const char kUpdateInstrumentAddressValidRequest[] = | 525 const char kUpdateInstrumentAddressValidRequest[] = |
515 "{" | 526 "{" |
516 "\"instrument_phone_number\":\"phone_number\"," | 527 "\"instrument_phone_number\":\"phone_number\"," |
517 "\"merchant_domain\":\"https://example.com/\"," | 528 "\"merchant_domain\":\"https://example.com/\"," |
518 "\"phone_number_required\":true," | 529 "\"phone_number_required\":true," |
519 "\"risk_params\":\"risky business\"," | 530 "\"risk_params\":\"risky business\"," |
520 "\"upgraded_billing_address\":" | 531 "\"upgraded_billing_address\":" |
521 "{" | 532 "{" |
522 "\"address_line\":" | 533 "\"address_line\":" |
523 "[" | 534 "[" |
524 "\"address_line_1\"," | 535 "\"address_line_1\"," |
525 "\"address_line_2\"" | 536 "\"address_line_2\"" |
526 "]," | 537 "]," |
527 "\"administrative_area_name\":\"admin_area_name\"," | 538 "\"administrative_area_name\":\"admin_area_name\"," |
528 "\"country_name_code\":\"US\"," | 539 "\"country_name_code\":\"US\"," |
| 540 "\"dependent_locality_name\":\"dependent_locality_name\"," |
529 "\"locality_name\":\"locality_name\"," | 541 "\"locality_name\":\"locality_name\"," |
530 "\"postal_code_number\":\"postal_code_number\"," | 542 "\"postal_code_number\":\"postal_code_number\"," |
531 "\"recipient_name\":\"recipient_name\"" | 543 "\"recipient_name\":\"recipient_name\"," |
| 544 "\"sorting_code\":\"sorting_code\"" |
532 "}," | 545 "}," |
533 "\"upgraded_instrument_id\":\"default_instrument_id\"," | 546 "\"upgraded_instrument_id\":\"default_instrument_id\"," |
534 "\"use_minimal_addresses\":false" | 547 "\"use_minimal_addresses\":false" |
535 "}"; | 548 "}"; |
536 | 549 |
537 const char kUpdateInstrumentAddressWithNameChangeValidRequest[] = | 550 const char kUpdateInstrumentAddressWithNameChangeValidRequest[] = |
538 "{" | 551 "{" |
539 "\"instrument_phone_number\":\"phone_number\"," | 552 "\"instrument_phone_number\":\"phone_number\"," |
540 "\"merchant_domain\":\"https://example.com/\"," | 553 "\"merchant_domain\":\"https://example.com/\"," |
541 "\"phone_number_required\":true," | 554 "\"phone_number_required\":true," |
542 "\"risk_params\":\"risky business\"," | 555 "\"risk_params\":\"risky business\"," |
543 "\"upgraded_billing_address\":" | 556 "\"upgraded_billing_address\":" |
544 "{" | 557 "{" |
545 "\"address_line\":" | 558 "\"address_line\":" |
546 "[" | 559 "[" |
547 "\"address_line_1\"," | 560 "\"address_line_1\"," |
548 "\"address_line_2\"" | 561 "\"address_line_2\"" |
549 "]," | 562 "]," |
550 "\"administrative_area_name\":\"admin_area_name\"," | 563 "\"administrative_area_name\":\"admin_area_name\"," |
551 "\"country_name_code\":\"US\"," | 564 "\"country_name_code\":\"US\"," |
| 565 "\"dependent_locality_name\":\"dependent_locality_name\"," |
552 "\"locality_name\":\"locality_name\"," | 566 "\"locality_name\":\"locality_name\"," |
553 "\"postal_code_number\":\"postal_code_number\"," | 567 "\"postal_code_number\":\"postal_code_number\"," |
554 "\"recipient_name\":\"recipient_name\"" | 568 "\"recipient_name\":\"recipient_name\"," |
| 569 "\"sorting_code\":\"sorting_code\"" |
555 "}," | 570 "}," |
556 "\"upgraded_instrument_id\":\"default_instrument_id\"," | 571 "\"upgraded_instrument_id\":\"default_instrument_id\"," |
557 "\"use_minimal_addresses\":false" | 572 "\"use_minimal_addresses\":false" |
558 "}"; | 573 "}"; |
559 | 574 |
560 const char kUpdateInstrumentExpirationDateValidRequest[] = | 575 const char kUpdateInstrumentExpirationDateValidRequest[] = |
561 "{" | 576 "{" |
562 "\"instrument\":" | 577 "\"instrument\":" |
563 "{" | 578 "{" |
564 "\"credit_card\":" | 579 "\"credit_card\":" |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1728 delegate_.ExpectBaselineMetrics(); | 1743 delegate_.ExpectBaselineMetrics(); |
1729 | 1744 |
1730 wallet_client_->GetWalletItems(); | 1745 wallet_client_->GetWalletItems(); |
1731 EXPECT_TRUE(wallet_client_->HasRequestInProgress()); | 1746 EXPECT_TRUE(wallet_client_->HasRequestInProgress()); |
1732 wallet_client_->CancelRequest(); | 1747 wallet_client_->CancelRequest(); |
1733 EXPECT_FALSE(wallet_client_->HasRequestInProgress()); | 1748 EXPECT_FALSE(wallet_client_->HasRequestInProgress()); |
1734 } | 1749 } |
1735 | 1750 |
1736 } // namespace wallet | 1751 } // namespace wallet |
1737 } // namespace autofill | 1752 } // namespace autofill |
OLD | NEW |