| 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/V8BindingForTesting.h" | 7 #include "bindings/core/v8/V8BindingForTesting.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
| 10 #include "modules/payments/PaymentTestHelper.h" | 10 #include "modules/payments/PaymentTestHelper.h" |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 EXPECT_FALSE(scope.getExceptionState().hadException()); | 398 EXPECT_FALSE(scope.getExceptionState().hadException()); |
| 399 | 399 |
| 400 String errorMessage; | 400 String errorMessage; |
| 401 request->show(scope.getScriptState()) | 401 request->show(scope.getScriptState()) |
| 402 .then(funcs.expectNoCall(), funcs.expectCall(&errorMessage)); | 402 .then(funcs.expectNoCall(), funcs.expectCall(&errorMessage)); |
| 403 | 403 |
| 404 static_cast<payments::mojom::blink::PaymentRequestClient*>(request)->OnError( | 404 static_cast<payments::mojom::blink::PaymentRequestClient*>(request)->OnError( |
| 405 payments::mojom::blink::PaymentErrorReason::USER_CANCEL); | 405 payments::mojom::blink::PaymentErrorReason::USER_CANCEL); |
| 406 | 406 |
| 407 v8::MicrotasksScope::PerformCheckpoint(scope.getScriptState()->isolate()); | 407 v8::MicrotasksScope::PerformCheckpoint(scope.getScriptState()->isolate()); |
| 408 EXPECT_EQ("Request cancelled", errorMessage); | 408 EXPECT_EQ("AbortError: Request cancelled", errorMessage); |
| 409 } | 409 } |
| 410 | 410 |
| 411 TEST(PaymentRequestTest, RejectShowPromiseOnUpdateDetailsFailure) { | 411 TEST(PaymentRequestTest, RejectShowPromiseOnUpdateDetailsFailure) { |
| 412 V8TestingScope scope; | 412 V8TestingScope scope; |
| 413 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); | 413 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); |
| 414 makePaymentRequestOriginSecure(scope.document()); | 414 makePaymentRequestOriginSecure(scope.document()); |
| 415 PaymentRequest* request = PaymentRequest::create( | 415 PaymentRequest* request = PaymentRequest::create( |
| 416 scope.getExecutionContext(), buildPaymentMethodDataForTest(), | 416 scope.getExecutionContext(), buildPaymentMethodDataForTest(), |
| 417 buildPaymentDetailsForTest(), scope.getExceptionState()); | 417 buildPaymentDetailsForTest(), scope.getExceptionState()); |
| 418 EXPECT_FALSE(scope.getExceptionState().hadException()); | 418 EXPECT_FALSE(scope.getExceptionState().hadException()); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 scope.getScriptState(), | 639 scope.getScriptState(), |
| 640 fromJSONString(scope.getScriptState()->isolate(), | 640 fromJSONString(scope.getScriptState()->isolate(), |
| 641 detailWithShippingOptions, scope.getExceptionState()))); | 641 detailWithShippingOptions, scope.getExceptionState()))); |
| 642 | 642 |
| 643 EXPECT_FALSE(scope.getExceptionState().hadException()); | 643 EXPECT_FALSE(scope.getExceptionState().hadException()); |
| 644 EXPECT_TRUE(request->shippingOption().isNull()); | 644 EXPECT_TRUE(request->shippingOption().isNull()); |
| 645 } | 645 } |
| 646 | 646 |
| 647 } // namespace | 647 } // namespace |
| 648 } // namespace blink | 648 } // namespace blink |
| OLD | NEW |