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

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

Issue 1877943002: Add unit test for providing empty list of detail items (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 "platform/heap/HeapAllocator.h" 8 #include "platform/heap/HeapAllocator.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 else 86 else
87 item = buildPaymentItemForTest(); 87 item = buildPaymentItemForTest();
88 88
89 ShippingOption shippingOption; 89 ShippingOption shippingOption;
90 if (detail == PaymentTestDetailShippingOption) 90 if (detail == PaymentTestDetailShippingOption)
91 shippingOption = buildShippingOptionForTest(data, modificationType, valu eToUse); 91 shippingOption = buildShippingOptionForTest(data, modificationType, valu eToUse);
92 else 92 else
93 shippingOption = buildShippingOptionForTest(); 93 shippingOption = buildShippingOptionForTest();
94 94
95 PaymentDetails result; 95 PaymentDetails result;
96 result.setItems(HeapVector<PaymentItem>(1, item)); 96 if (detail == PaymentTestDetailNoItems)
97 result.setItems(HeapVector<PaymentItem>());
98 else
99 result.setItems(HeapVector<PaymentItem>(1, item));
97 result.setShippingOptions(HeapVector<ShippingOption>(2, shippingOption)); 100 result.setShippingOptions(HeapVector<ShippingOption>(2, shippingOption));
98 101
99 return result; 102 return result;
100 } 103 }
101 104
102 } // namespace blink 105 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698