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/PaymentDetailsTestHelper.h" | 5 #include "modules/payments/PaymentDetailsTestHelper.h" |
6 | 6 |
7 #include "modules/payments/CurrencyAmount.h" | 7 #include "modules/payments/CurrencyAmount.h" |
8 #include "platform/heap/HeapAllocator.h" | 8 #include "platform/heap/HeapAllocator.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 shippingOption.setId(valueToUse); | 58 shippingOption.setId(valueToUse); |
59 } else { | 59 } else { |
60 shippingOption.setId("id"); | 60 shippingOption.setId("id"); |
61 } | 61 } |
62 setValues(shippingOption, data, modificationType, valueToUse); | 62 setValues(shippingOption, data, modificationType, valueToUse); |
63 return shippingOption; | 63 return shippingOption; |
64 } | 64 } |
65 | 65 |
66 PaymentDetails buildPaymentDetailsForTest(PaymentTestDetailToChange detail, Paym
entTestDataToChange data, PaymentTestModificationType modificationType, const St
ring& valueToUse) | 66 PaymentDetails buildPaymentDetailsForTest(PaymentTestDetailToChange detail, Paym
entTestDataToChange data, PaymentTestModificationType modificationType, const St
ring& valueToUse) |
67 { | 67 { |
| 68 PaymentItem total; |
| 69 if (detail == PaymentTestDetailTotal) |
| 70 total = buildPaymentItemForTest(data, modificationType, valueToUse); |
| 71 else |
| 72 total = buildPaymentItemForTest(); |
| 73 |
68 PaymentItem item; | 74 PaymentItem item; |
69 if (detail == PaymentTestDetailItem) | 75 if (detail == PaymentTestDetailItem) |
70 item = buildPaymentItemForTest(data, modificationType, valueToUse); | 76 item = buildPaymentItemForTest(data, modificationType, valueToUse); |
71 else | 77 else |
72 item = buildPaymentItemForTest(); | 78 item = buildPaymentItemForTest(); |
73 | 79 |
74 ShippingOption shippingOption; | 80 ShippingOption shippingOption; |
75 if (detail == PaymentTestDetailShippingOption) | 81 if (detail == PaymentTestDetailShippingOption) |
76 shippingOption = buildShippingOptionForTest(data, modificationType, valu
eToUse); | 82 shippingOption = buildShippingOptionForTest(data, modificationType, valu
eToUse); |
77 else | 83 else |
78 shippingOption = buildShippingOptionForTest(); | 84 shippingOption = buildShippingOptionForTest(); |
79 | 85 |
80 PaymentDetails result; | 86 PaymentDetails result; |
| 87 result.setTotal(total); |
81 result.setDisplayItems(HeapVector<PaymentItem>(1, item)); | 88 result.setDisplayItems(HeapVector<PaymentItem>(1, item)); |
82 result.setShippingOptions(HeapVector<ShippingOption>(2, shippingOption)); | 89 result.setShippingOptions(HeapVector<ShippingOption>(2, shippingOption)); |
83 | 90 |
84 return result; | 91 return result; |
85 } | 92 } |
86 | 93 |
87 } // namespace blink | 94 } // namespace blink |
OLD | NEW |