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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 | 625 |
626 request->onUpdatePaymentDetails(ScriptValue::from( | 626 request->onUpdatePaymentDetails(ScriptValue::from( |
627 scope.getScriptState(), | 627 scope.getScriptState(), |
628 fromJSONString(scope.getScriptState()->isolate(), | 628 fromJSONString(scope.getScriptState()->isolate(), |
629 detailWithShippingOptions, scope.getExceptionState()))); | 629 detailWithShippingOptions, scope.getExceptionState()))); |
630 | 630 |
631 EXPECT_FALSE(scope.getExceptionState().hadException()); | 631 EXPECT_FALSE(scope.getExceptionState().hadException()); |
632 EXPECT_TRUE(request->shippingOption().isNull()); | 632 EXPECT_TRUE(request->shippingOption().isNull()); |
633 } | 633 } |
634 | 634 |
| 635 TEST(PaymentRequestTest, DetailsIdIsSet) { |
| 636 V8TestingScope scope; |
| 637 makePaymentRequestOriginSecure(scope.document()); |
| 638 PaymentDetailsInit details; |
| 639 details.setTotal(buildPaymentItemForTest()); |
| 640 details.setId("my_payment_id"); |
| 641 |
| 642 PaymentRequest* request = PaymentRequest::create( |
| 643 scope.getExecutionContext(), buildPaymentMethodDataForTest(), details, |
| 644 scope.getExceptionState()); |
| 645 |
| 646 EXPECT_EQ("my_payment_id", request->id()); |
| 647 } |
| 648 |
635 } // namespace | 649 } // namespace |
636 } // namespace blink | 650 } // namespace blink |
OLD | NEW |