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

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

Issue 1994913002: PaymentRequest: Remove id attribute from PaymentItem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/PaymentDetailsTestHelper.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentDetailsTestHelper.cpp b/third_party/WebKit/Source/modules/payments/PaymentDetailsTestHelper.cpp
index b2906e54d49b36ae72a9bde4966f9d6ac9be9b36..1268eecc0726654345da372edd6b0ccc83380750 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentDetailsTestHelper.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentDetailsTestHelper.cpp
@@ -10,7 +10,8 @@
namespace blink {
namespace {
-// PaymentItem and ShippingOption have identical structure.
+// PaymentItem and ShippingOption have identical structure
+// except for the "id" field, which is present only in ShippingOption.
template <typename PaymentItemOrShippingOption>
void setValues(PaymentItemOrShippingOption& original, PaymentTestDataToChange data, PaymentTestModificationType modificationType, const String& valueToUse)
{
@@ -31,12 +32,6 @@ void setValues(PaymentItemOrShippingOption& original, PaymentTestDataToChange da
if (data != PaymentTestDataAmount || modificationType != PaymentTestRemoveKey)
original.setAmount(itemAmount);
- if (data == PaymentTestDataId) {
- if (modificationType == PaymentTestOverwriteValue)
- original.setId(valueToUse);
- } else {
- original.setId("id");
- }
if (data == PaymentTestDataLabel) {
if (modificationType == PaymentTestOverwriteValue)
original.setLabel(valueToUse);
@@ -49,6 +44,7 @@ void setValues(PaymentItemOrShippingOption& original, PaymentTestDataToChange da
PaymentItem buildPaymentItemForTest(PaymentTestDataToChange data, PaymentTestModificationType modificationType, const String& valueToUse)
{
+ DCHECK_NE(data, PaymentTestDataId);
PaymentItem item;
setValues(item, data, modificationType, valueToUse);
return item;
@@ -57,6 +53,12 @@ PaymentItem buildPaymentItemForTest(PaymentTestDataToChange data, PaymentTestMod
ShippingOption buildShippingOptionForTest(PaymentTestDataToChange data, PaymentTestModificationType modificationType, const String& valueToUse)
{
ShippingOption shippingOption;
+ if (data == PaymentTestDataId) {
+ if (modificationType == PaymentTestOverwriteValue)
+ shippingOption.setId(valueToUse);
+ } else {
+ shippingOption.setId("id");
+ }
setValues(shippingOption, data, modificationType, valueToUse);
return shippingOption;
}

Powered by Google App Engine
This is Rietveld 408576698