OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "modules/payments/PaymentRequest.h" | 5 #include "modules/payments/PaymentRequest.h" |
6 | 6 |
7 #include "bindings/core/v8/JSONValuesForV8.h" | 7 #include "bindings/core/v8/JSONValuesForV8.h" |
8 #include "bindings/core/v8/ScriptFunction.h" | 8 #include "bindings/core/v8/ScriptFunction.h" |
9 #include "bindings/core/v8/V8BindingForTesting.h" | 9 #include "bindings/core/v8/V8BindingForTesting.h" |
10 #include "bindings/modules/v8/V8PaymentResponse.h" | 10 #include "bindings/modules/v8/V8PaymentResponse.h" |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 TEST(PaymentRequestTest, ResolveShowPromiseWithRequestPayerEmailTrueAndValidPaye
rEmailInResponse) | 546 TEST(PaymentRequestTest, ResolveShowPromiseWithRequestPayerEmailTrueAndValidPaye
rEmailInResponse) |
547 { | 547 { |
548 V8TestingScope scope; | 548 V8TestingScope scope; |
549 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); | 549 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); |
550 makePaymentRequestOriginSecure(scope.document()); | 550 makePaymentRequestOriginSecure(scope.document()); |
551 PaymentOptions options; | 551 PaymentOptions options; |
552 options.setRequestPayerEmail(true); | 552 options.setRequestPayerEmail(true); |
553 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); | 553 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); |
554 EXPECT_FALSE(scope.getExceptionState().hadException()); | 554 EXPECT_FALSE(scope.getExceptionState().hadException()); |
555 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); | 555 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); |
556 response->total_amount = mojom::blink::CurrencyAmount::New(); | |
557 response->payer_email = "abc@gmail.com"; | 556 response->payer_email = "abc@gmail.com"; |
558 | 557 |
559 ScriptValue outValue; | 558 ScriptValue outValue; |
560 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s
cope.getScriptState(), &outValue), funcs.expectNoCall()); | 559 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s
cope.getScriptState(), &outValue), funcs.expectNoCall()); |
561 | 560 |
562 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); | 561 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); |
563 v8::MicrotasksScope::PerformCheckpoint(scope.isolate()); | 562 v8::MicrotasksScope::PerformCheckpoint(scope.isolate()); |
564 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate()
, outValue.v8Value()); | 563 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate()
, outValue.v8Value()); |
565 | 564 |
566 EXPECT_EQ("abc@gmail.com", pr->payerEmail()); | 565 EXPECT_EQ("abc@gmail.com", pr->payerEmail()); |
567 } | 566 } |
568 | 567 |
569 TEST(PaymentRequestTest, RejectShowPromiseWithRequestPayerEmailTrueAndEmptyPayer
EmailInResponse) | 568 TEST(PaymentRequestTest, RejectShowPromiseWithRequestPayerEmailTrueAndEmptyPayer
EmailInResponse) |
570 { | 569 { |
571 V8TestingScope scope; | 570 V8TestingScope scope; |
572 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); | 571 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); |
573 makePaymentRequestOriginSecure(scope.document()); | 572 makePaymentRequestOriginSecure(scope.document()); |
574 PaymentOptions options; | 573 PaymentOptions options; |
575 options.setRequestPayerEmail(true); | 574 options.setRequestPayerEmail(true); |
576 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); | 575 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); |
577 EXPECT_FALSE(scope.getExceptionState().hadException()); | 576 EXPECT_FALSE(scope.getExceptionState().hadException()); |
578 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); | 577 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); |
579 response->total_amount = mojom::blink::CurrencyAmount::New(); | |
580 response->payer_email = ""; | 578 response->payer_email = ""; |
581 | 579 |
582 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec
tCall()); | 580 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec
tCall()); |
583 | 581 |
584 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); | 582 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); |
585 } | 583 } |
586 | 584 |
587 TEST(PaymentRequestTest, RejectShowPromiseWithRequestPayerEmailTrueAndNullPayerE
mailInResponse) | 585 TEST(PaymentRequestTest, RejectShowPromiseWithRequestPayerEmailTrueAndNullPayerE
mailInResponse) |
588 { | 586 { |
589 V8TestingScope scope; | 587 V8TestingScope scope; |
590 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); | 588 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); |
591 makePaymentRequestOriginSecure(scope.document()); | 589 makePaymentRequestOriginSecure(scope.document()); |
592 PaymentOptions options; | 590 PaymentOptions options; |
593 options.setRequestPayerEmail(true); | 591 options.setRequestPayerEmail(true); |
594 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); | 592 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); |
595 EXPECT_FALSE(scope.getExceptionState().hadException()); | 593 EXPECT_FALSE(scope.getExceptionState().hadException()); |
596 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); | 594 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); |
597 response->total_amount = mojom::blink::CurrencyAmount::New(); | |
598 response->payer_email = String(); | 595 response->payer_email = String(); |
599 | 596 |
600 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec
tCall()); | 597 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec
tCall()); |
601 | 598 |
602 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); | 599 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); |
603 } | 600 } |
604 | 601 |
605 TEST(PaymentRequestTest, RejectShowPromiseWithRequestPayerEmailFalseAndNonNullPa
yerEmailInResponse) | 602 TEST(PaymentRequestTest, RejectShowPromiseWithRequestPayerEmailFalseAndNonNullPa
yerEmailInResponse) |
606 { | 603 { |
607 V8TestingScope scope; | 604 V8TestingScope scope; |
608 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); | 605 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); |
609 makePaymentRequestOriginSecure(scope.document()); | 606 makePaymentRequestOriginSecure(scope.document()); |
610 PaymentOptions options; | 607 PaymentOptions options; |
611 options.setRequestPayerEmail(false); | 608 options.setRequestPayerEmail(false); |
612 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); | 609 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); |
613 EXPECT_FALSE(scope.getExceptionState().hadException()); | 610 EXPECT_FALSE(scope.getExceptionState().hadException()); |
614 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); | 611 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); |
615 response->total_amount = mojom::blink::CurrencyAmount::New(); | |
616 response->payer_email = ""; | 612 response->payer_email = ""; |
617 | 613 |
618 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec
tCall()); | 614 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec
tCall()); |
619 | 615 |
620 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); | 616 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); |
621 } | 617 } |
622 | 618 |
623 TEST(PaymentRequestTest, ResolveShowPromiseWithRequestPayerEmailFalseAndNullPaye
rEmailInResponse) | 619 TEST(PaymentRequestTest, ResolveShowPromiseWithRequestPayerEmailFalseAndNullPaye
rEmailInResponse) |
624 { | 620 { |
625 V8TestingScope scope; | 621 V8TestingScope scope; |
626 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); | 622 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); |
627 makePaymentRequestOriginSecure(scope.document()); | 623 makePaymentRequestOriginSecure(scope.document()); |
628 PaymentOptions options; | 624 PaymentOptions options; |
629 options.setRequestPayerEmail(false); | 625 options.setRequestPayerEmail(false); |
630 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); | 626 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); |
631 EXPECT_FALSE(scope.getExceptionState().hadException()); | 627 EXPECT_FALSE(scope.getExceptionState().hadException()); |
632 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); | 628 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); |
633 response->total_amount = mojom::blink::CurrencyAmount::New(); | |
634 response->payer_email = String(); | 629 response->payer_email = String(); |
635 | 630 |
636 ScriptValue outValue; | 631 ScriptValue outValue; |
637 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s
cope.getScriptState(), &outValue), funcs.expectNoCall()); | 632 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s
cope.getScriptState(), &outValue), funcs.expectNoCall()); |
638 | 633 |
639 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); | 634 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); |
640 v8::MicrotasksScope::PerformCheckpoint(scope.isolate()); | 635 v8::MicrotasksScope::PerformCheckpoint(scope.isolate()); |
641 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate()
, outValue.v8Value()); | 636 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate()
, outValue.v8Value()); |
642 | 637 |
643 EXPECT_TRUE(pr->payerEmail().isNull()); | 638 EXPECT_TRUE(pr->payerEmail().isNull()); |
644 } | 639 } |
645 | 640 |
646 TEST(PaymentRequestTest, ResolveShowPromiseWithRequestPayerPhoneTrueAndValidPaye
rPhoneInResponse) | 641 TEST(PaymentRequestTest, ResolveShowPromiseWithRequestPayerPhoneTrueAndValidPaye
rPhoneInResponse) |
647 { | 642 { |
648 V8TestingScope scope; | 643 V8TestingScope scope; |
649 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); | 644 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); |
650 makePaymentRequestOriginSecure(scope.document()); | 645 makePaymentRequestOriginSecure(scope.document()); |
651 PaymentOptions options; | 646 PaymentOptions options; |
652 options.setRequestPayerPhone(true); | 647 options.setRequestPayerPhone(true); |
653 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); | 648 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); |
654 EXPECT_FALSE(scope.getExceptionState().hadException()); | 649 EXPECT_FALSE(scope.getExceptionState().hadException()); |
655 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); | 650 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); |
656 response->total_amount = mojom::blink::CurrencyAmount::New(); | |
657 response->payer_phone = "0123"; | 651 response->payer_phone = "0123"; |
658 | 652 |
659 ScriptValue outValue; | 653 ScriptValue outValue; |
660 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s
cope.getScriptState(), &outValue), funcs.expectNoCall()); | 654 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s
cope.getScriptState(), &outValue), funcs.expectNoCall()); |
661 | 655 |
662 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); | 656 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); |
663 v8::MicrotasksScope::PerformCheckpoint(scope.isolate()); | 657 v8::MicrotasksScope::PerformCheckpoint(scope.isolate()); |
664 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate()
, outValue.v8Value()); | 658 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate()
, outValue.v8Value()); |
665 | 659 |
666 EXPECT_EQ("0123", pr->payerPhone()); | 660 EXPECT_EQ("0123", pr->payerPhone()); |
667 } | 661 } |
668 | 662 |
669 TEST(PaymentRequestTest, RejectShowPromiseWithRequestPayerPhoneTrueAndEmptyPayer
PhoneInResponse) | 663 TEST(PaymentRequestTest, RejectShowPromiseWithRequestPayerPhoneTrueAndEmptyPayer
PhoneInResponse) |
670 { | 664 { |
671 V8TestingScope scope; | 665 V8TestingScope scope; |
672 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); | 666 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); |
673 makePaymentRequestOriginSecure(scope.document()); | 667 makePaymentRequestOriginSecure(scope.document()); |
674 PaymentOptions options; | 668 PaymentOptions options; |
675 options.setRequestPayerPhone(true); | 669 options.setRequestPayerPhone(true); |
676 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); | 670 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); |
677 EXPECT_FALSE(scope.getExceptionState().hadException()); | 671 EXPECT_FALSE(scope.getExceptionState().hadException()); |
678 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); | 672 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); |
679 response->total_amount = mojom::blink::CurrencyAmount::New(); | |
680 response->payer_phone = ""; | 673 response->payer_phone = ""; |
681 | 674 |
682 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec
tCall()); | 675 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec
tCall()); |
683 | 676 |
684 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); | 677 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); |
685 } | 678 } |
686 | 679 |
687 TEST(PaymentRequestTest, RejectShowPromiseWithRequestPayerPhoneTrueAndNullPayerP
honeInResponse) | 680 TEST(PaymentRequestTest, RejectShowPromiseWithRequestPayerPhoneTrueAndNullPayerP
honeInResponse) |
688 { | 681 { |
689 V8TestingScope scope; | 682 V8TestingScope scope; |
690 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); | 683 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); |
691 makePaymentRequestOriginSecure(scope.document()); | 684 makePaymentRequestOriginSecure(scope.document()); |
692 PaymentOptions options; | 685 PaymentOptions options; |
693 options.setRequestPayerPhone(true); | 686 options.setRequestPayerPhone(true); |
694 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); | 687 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); |
695 EXPECT_FALSE(scope.getExceptionState().hadException()); | 688 EXPECT_FALSE(scope.getExceptionState().hadException()); |
696 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); | 689 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); |
697 response->total_amount = mojom::blink::CurrencyAmount::New(); | |
698 response->payer_phone = String(); | 690 response->payer_phone = String(); |
699 | 691 |
700 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec
tCall()); | 692 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec
tCall()); |
701 | 693 |
702 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); | 694 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); |
703 } | 695 } |
704 | 696 |
705 TEST(PaymentRequestTest, RejectShowPromiseWithRequestPayerPhoneFalseAndNonNulPay
erPhoneInResponse) | 697 TEST(PaymentRequestTest, RejectShowPromiseWithRequestPayerPhoneFalseAndNonNulPay
erPhoneInResponse) |
706 { | 698 { |
707 V8TestingScope scope; | 699 V8TestingScope scope; |
708 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); | 700 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); |
709 makePaymentRequestOriginSecure(scope.document()); | 701 makePaymentRequestOriginSecure(scope.document()); |
710 PaymentOptions options; | 702 PaymentOptions options; |
711 options.setRequestPayerPhone(false); | 703 options.setRequestPayerPhone(false); |
712 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); | 704 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); |
713 EXPECT_FALSE(scope.getExceptionState().hadException()); | 705 EXPECT_FALSE(scope.getExceptionState().hadException()); |
714 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); | 706 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); |
715 response->total_amount = mojom::blink::CurrencyAmount::New(); | |
716 response->payer_phone = ""; | 707 response->payer_phone = ""; |
717 | 708 |
718 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec
tCall()); | 709 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec
tCall()); |
719 | 710 |
720 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); | 711 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); |
721 } | 712 } |
722 | 713 |
723 TEST(PaymentRequestTest, ResolveShowPromiseWithRequestPayerPhoneFalseAndNullPaye
rPhoneInResponse) | 714 TEST(PaymentRequestTest, ResolveShowPromiseWithRequestPayerPhoneFalseAndNullPaye
rPhoneInResponse) |
724 { | 715 { |
725 V8TestingScope scope; | 716 V8TestingScope scope; |
726 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); | 717 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); |
727 makePaymentRequestOriginSecure(scope.document()); | 718 makePaymentRequestOriginSecure(scope.document()); |
728 PaymentOptions options; | 719 PaymentOptions options; |
729 options.setRequestPayerPhone(false); | 720 options.setRequestPayerPhone(false); |
730 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); | 721 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui
ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx
ceptionState()); |
731 EXPECT_FALSE(scope.getExceptionState().hadException()); | 722 EXPECT_FALSE(scope.getExceptionState().hadException()); |
732 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); | 723 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); |
733 response->total_amount = mojom::blink::CurrencyAmount::New(); | |
734 response->payer_phone = String(); | 724 response->payer_phone = String(); |
735 | 725 |
736 ScriptValue outValue; | 726 ScriptValue outValue; |
737 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s
cope.getScriptState(), &outValue), funcs.expectNoCall()); | 727 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s
cope.getScriptState(), &outValue), funcs.expectNoCall()); |
738 | 728 |
739 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); | 729 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); |
740 v8::MicrotasksScope::PerformCheckpoint(scope.isolate()); | 730 v8::MicrotasksScope::PerformCheckpoint(scope.isolate()); |
741 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate()
, outValue.v8Value()); | 731 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate()
, outValue.v8Value()); |
742 | 732 |
743 EXPECT_TRUE(pr->payerPhone().isNull()); | 733 EXPECT_TRUE(pr->payerPhone().isNull()); |
744 } | 734 } |
745 | 735 |
746 } // namespace | 736 } // namespace |
747 } // namespace blink | 737 } // namespace blink |
OLD | NEW |