Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: third_party/WebKit/Source/modules/payments/PaymentDetailsTestHelper.cpp

Issue 2030193002: Add 'total' field to 'PaymentDetails'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase, address comments, and add more tests Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698