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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 | 624 |
625 request->OnUpdatePaymentDetails(ScriptValue::From( | 625 request->OnUpdatePaymentDetails(ScriptValue::From( |
626 scope.GetScriptState(), | 626 scope.GetScriptState(), |
627 FromJSONString(scope.GetScriptState()->GetIsolate(), | 627 FromJSONString(scope.GetScriptState()->GetIsolate(), |
628 detail_with_shipping_options, scope.GetExceptionState()))); | 628 detail_with_shipping_options, scope.GetExceptionState()))); |
629 | 629 |
630 EXPECT_FALSE(scope.GetExceptionState().HadException()); | 630 EXPECT_FALSE(scope.GetExceptionState().HadException()); |
631 EXPECT_TRUE(request->shippingOption().IsNull()); | 631 EXPECT_TRUE(request->shippingOption().IsNull()); |
632 } | 632 } |
633 | 633 |
| 634 TEST(PaymentRequestTest, DetailsIdIsSet) { |
| 635 V8TestingScope scope; |
| 636 MakePaymentRequestOriginSecure(scope.GetDocument()); |
| 637 PaymentDetailsInit details; |
| 638 details.setTotal(BuildPaymentItemForTest()); |
| 639 details.setId("my_payment_id"); |
| 640 |
| 641 PaymentRequest* request = PaymentRequest::Create( |
| 642 scope.GetExecutionContext(), BuildPaymentMethodDataForTest(), details, |
| 643 scope.GetExceptionState()); |
| 644 |
| 645 EXPECT_EQ("my_payment_id", request->id()); |
| 646 } |
| 647 |
634 } // namespace | 648 } // namespace |
635 } // namespace blink | 649 } // namespace blink |
OLD | NEW |