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

Unified Diff: third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp

Issue 2137953002: Duplicate shipping option identifiers should throw TypeError. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch3 Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/payments/PaymentRequest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp b/third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp
index 1d2293ef7873e3b0d35642af25933e4ff78a6c85..5714c8ce55091dbd62d1e38e170fb83aeebe0a9f 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp
@@ -13,6 +13,7 @@
namespace blink {
namespace {
+static int gUniqueId = 0;
// PaymentItem and PaymentShippingOption have identical structure
// except for the "id" field, which is present only in PaymentShippingOption.
template <typename PaymentItemOrPaymentShippingOption>
@@ -60,7 +61,7 @@ PaymentShippingOption buildShippingOptionForTest(PaymentTestDataToChange data, P
if (modificationType == PaymentTestOverwriteValue)
shippingOption.setId(valueToUse);
} else {
- shippingOption.setId("id");
+ shippingOption.setId("id" + String::number(gUniqueId++));
}
setValues(shippingOption, data, modificationType, valueToUse);
return shippingOption;
@@ -116,7 +117,7 @@ PaymentDetails buildPaymentDetailsForTest(PaymentTestDetailToChange detail, Paym
PaymentDetails result;
result.setTotal(total);
result.setDisplayItems(HeapVector<PaymentItem>(1, item));
- result.setShippingOptions(HeapVector<PaymentShippingOption>(2, shippingOption));
+ result.setShippingOptions(HeapVector<PaymentShippingOption>(1, shippingOption));
result.setModifiers(HeapVector<PaymentDetailsModifier>(1, modifier));
return result;
« no previous file with comments | « third_party/WebKit/Source/modules/payments/PaymentRequest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698