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

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

Issue 2101463002: PaymentRequest: Implement PaymentDetailsModifier dictionary (in blink side). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments 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 side-by-side diff with in-line comments
Download patch
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 523280049d4b522b49250dfa7e319bf443ce997d..1d2293ef7873e3b0d35642af25933e4ff78a6c85 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp
@@ -66,6 +66,27 @@ PaymentShippingOption buildShippingOptionForTest(PaymentTestDataToChange data, P
return shippingOption;
}
+PaymentDetailsModifier buildPaymentDetailsModifierForTest(PaymentTestDetailToChange detail, PaymentTestDataToChange data, PaymentTestModificationType modificationType, const String& valueToUse)
+{
+ PaymentItem total;
+ if (detail == PaymentTestDetailModifierTotal)
+ total = buildPaymentItemForTest(data, modificationType, valueToUse);
+ else
+ total = buildPaymentItemForTest();
+
+ PaymentItem item;
+ if (detail == PaymentTestDetailModifierItem)
+ item = buildPaymentItemForTest(data, modificationType, valueToUse);
+ else
+ item = buildPaymentItemForTest();
+
+ PaymentDetailsModifier modifier;
+ modifier.setSupportedMethods(Vector<String>(1, "foo"));
+ modifier.setTotal(total);
+ modifier.setAdditionalDisplayItems(HeapVector<PaymentItem>(1, item));
+ return modifier;
+}
+
PaymentDetails buildPaymentDetailsForTest(PaymentTestDetailToChange detail, PaymentTestDataToChange data, PaymentTestModificationType modificationType, const String& valueToUse)
{
PaymentItem total;
@@ -86,10 +107,17 @@ PaymentDetails buildPaymentDetailsForTest(PaymentTestDetailToChange detail, Paym
else
shippingOption = buildShippingOptionForTest();
+ PaymentDetailsModifier modifier;
+ if (detail == PaymentTestDetailModifierTotal || detail == PaymentTestDetailModifierItem)
+ modifier = buildPaymentDetailsModifierForTest(detail, data, modificationType, valueToUse);
+ else
+ modifier = buildPaymentDetailsModifierForTest();
+
PaymentDetails result;
result.setTotal(total);
result.setDisplayItems(HeapVector<PaymentItem>(1, item));
result.setShippingOptions(HeapVector<PaymentShippingOption>(2, shippingOption));
+ result.setModifiers(HeapVector<PaymentDetailsModifier>(1, modifier));
return result;
}

Powered by Google App Engine
This is Rietveld 408576698