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/PaymentAppRequestDataConversion.h" | 5 #include "modules/payments/PaymentAppRequestDataConversion.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
9 #include "bindings/core/v8/V8Binding.h" | 9 #include "bindings/core/v8/V8Binding.h" |
10 #include "bindings/core/v8/V8BindingForTesting.h" | 10 #include "bindings/core/v8/V8BindingForTesting.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 WebString method = WebString::fromUTF8("foo"); | 28 WebString method = WebString::fromUTF8("foo"); |
29 webMethodData.supportedMethods = WebVector<WebString>(&method, 1); | 29 webMethodData.supportedMethods = WebVector<WebString>(&method, 1); |
30 webMethodData.stringifiedData = "{\"merchantId\":\"12345\"}"; | 30 webMethodData.stringifiedData = "{\"merchantId\":\"12345\"}"; |
31 return webMethodData; | 31 return webMethodData; |
32 } | 32 } |
33 | 33 |
34 static WebPaymentAppRequestData createWebPaymentAppRequestDataForTest() { | 34 static WebPaymentAppRequestData createWebPaymentAppRequestDataForTest() { |
35 WebPaymentAppRequestData webData; | 35 WebPaymentAppRequestData webData; |
36 webData.origin = WebString::fromUTF8("https://example.com"); | 36 webData.origin = WebString::fromUTF8("https://example.com"); |
37 Vector<WebPaymentMethodData> methodData; | 37 Vector<WebPaymentMethodData> methodData; |
38 methodData.append(createWebPaymentMethodDataForTest()); | 38 methodData.push_back(createWebPaymentMethodDataForTest()); |
39 webData.methodData = WebVector<WebPaymentMethodData>(methodData); | 39 webData.methodData = WebVector<WebPaymentMethodData>(methodData); |
40 webData.total = createWebPaymentItemForTest(); | 40 webData.total = createWebPaymentItemForTest(); |
41 webData.optionId = WebString::fromUTF8("payment-app-id"); | 41 webData.optionId = WebString::fromUTF8("payment-app-id"); |
42 return webData; | 42 return webData; |
43 } | 43 } |
44 | 44 |
45 TEST(PaymentAppRequestDataConversionTest, ToPaymentAppRequestData) { | 45 TEST(PaymentAppRequestDataConversionTest, ToPaymentAppRequestData) { |
46 V8TestingScope scope; | 46 V8TestingScope scope; |
47 WebPaymentAppRequestData webData = createWebPaymentAppRequestDataForTest(); | 47 WebPaymentAppRequestData webData = createWebPaymentAppRequestDataForTest(); |
48 PaymentAppRequestData data = | 48 PaymentAppRequestData data = |
(...skipping 26 matching lines...) Expand all Loading... |
75 | 75 |
76 ASSERT_TRUE(data.hasOptionId()); | 76 ASSERT_TRUE(data.hasOptionId()); |
77 EXPECT_EQ("payment-app-id", data.optionId()); | 77 EXPECT_EQ("payment-app-id", data.optionId()); |
78 | 78 |
79 ASSERT_TRUE(data.hasOrigin()); | 79 ASSERT_TRUE(data.hasOrigin()); |
80 EXPECT_EQ("https://example.com", data.origin()); | 80 EXPECT_EQ("https://example.com", data.origin()); |
81 } | 81 } |
82 | 82 |
83 } // namespace | 83 } // namespace |
84 } // namespace blink | 84 } // namespace blink |
OLD | NEW |