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

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

Issue 1861543003: DO NOT SUBMIT This fixes CFI bot, but it's ugly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 "modules/payments/PaymentItem.h" 8 #include "modules/payments/PaymentItem.h"
9 #include "modules/payments/ShippingOption.h" 9 #include "modules/payments/ShippingOption.h"
10 #include "platform/heap/HeapAllocator.h" 10 #include "platform/heap/HeapAllocator.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 PaymentDetails buildPaymentDetailsForTest(PaymentTestDetailToChange detail, Paym entTestDataToChange data, PaymentTestModificationType modificationType, const St ring& valueToUse) 14 PaymentDetails buildPaymentDetailsForTest(bool setShippingOptions, PaymentTestDe tailToChange detail, PaymentTestDataToChange data, PaymentTestModificationType m odificationType, const String& valueToUse)
15 { 15 {
16 CurrencyAmount itemAmount; 16 CurrencyAmount itemAmount;
17 if (detail == PaymentTestDetailItem && data == PaymentTestDataCurrencyCode) { 17 if (detail == PaymentTestDetailItem && data == PaymentTestDataCurrencyCode) {
18 if (modificationType == PaymentTestOverwriteValue) 18 if (modificationType == PaymentTestOverwriteValue)
19 itemAmount.setCurrencyCode(valueToUse); 19 itemAmount.setCurrencyCode(valueToUse);
20 } else { 20 } else {
21 itemAmount.setCurrencyCode("USD"); 21 itemAmount.setCurrencyCode("USD");
22 } 22 }
23 if (detail == PaymentTestDetailItem && data == PaymentTestDataAmount) { 23 if (detail == PaymentTestDetailItem && data == PaymentTestDataAmount) {
24 if (modificationType == PaymentTestOverwriteValue) 24 if (modificationType == PaymentTestOverwriteValue)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 if (detail == PaymentTestDetailShippingOption && data == PaymentTestDataLabe l) { 67 if (detail == PaymentTestDetailShippingOption && data == PaymentTestDataLabe l) {
68 if (modificationType == PaymentTestOverwriteValue) 68 if (modificationType == PaymentTestOverwriteValue)
69 shippingOption.setLabel(valueToUse); 69 shippingOption.setLabel(valueToUse);
70 } else { 70 } else {
71 shippingOption.setLabel("Standard shipping"); 71 shippingOption.setLabel("Standard shipping");
72 } 72 }
73 73
74 PaymentDetails result; 74 PaymentDetails result;
75 result.setItems(HeapVector<PaymentItem>(1, item)); 75 result.setItems(HeapVector<PaymentItem>(1, item));
76 result.setShippingOptions(HeapVector<ShippingOption>(2, shippingOption)); 76
77 if (setShippingOptions) {
78 result.setShippingOptions(HeapVector<ShippingOption>(2, shippingOption));
79 }
77 80
78 return result; 81 return result;
79 } 82 }
80 83
81 } // namespace blink 84 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698