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

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

Issue 2020883002: PaymentRequest: Introduce PaymentMethodData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/PaymentDetailsTestHelper.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentDetailsTestHelper.cpp b/third_party/WebKit/Source/modules/payments/PaymentDetailsTestHelper.cpp
deleted file mode 100644
index 515b9cf10988853389fac7d277e1682293c70bd7..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/modules/payments/PaymentDetailsTestHelper.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "modules/payments/PaymentDetailsTestHelper.h"
-
-#include "modules/payments/CurrencyAmount.h"
-#include "platform/heap/HeapAllocator.h"
-
-namespace blink {
-namespace {
-
-// 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)
-{
- CurrencyAmount itemAmount;
- if (data == PaymentTestDataCurrencyCode) {
- if (modificationType == PaymentTestOverwriteValue)
- itemAmount.setCurrency(valueToUse);
- } else {
- itemAmount.setCurrency("USD");
- }
- if (data == PaymentTestDataValue) {
- if (modificationType == PaymentTestOverwriteValue)
- itemAmount.setValue(valueToUse);
- } else {
- itemAmount.setValue("9.99");
- }
-
- if (data != PaymentTestDataAmount || modificationType != PaymentTestRemoveKey)
- original.setAmount(itemAmount);
-
- if (data == PaymentTestDataLabel) {
- if (modificationType == PaymentTestOverwriteValue)
- original.setLabel(valueToUse);
- } else {
- original.setLabel("Label");
- }
-}
-
-} // namespace
-
-PaymentItem buildPaymentItemForTest(PaymentTestDataToChange data, PaymentTestModificationType modificationType, const String& valueToUse)
-{
- DCHECK_NE(data, PaymentTestDataId);
- PaymentItem item;
- setValues(item, data, modificationType, valueToUse);
- return item;
-}
-
-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;
-}
-
-PaymentDetails buildPaymentDetailsForTest(PaymentTestDetailToChange detail, PaymentTestDataToChange data, PaymentTestModificationType modificationType, const String& valueToUse)
-{
- PaymentItem total;
- if (detail == PaymentTestDetailTotal)
- total = buildPaymentItemForTest(data, modificationType, valueToUse);
- else
- total = buildPaymentItemForTest();
-
- PaymentItem item;
- if (detail == PaymentTestDetailItem)
- item = buildPaymentItemForTest(data, modificationType, valueToUse);
- else
- item = buildPaymentItemForTest();
-
- ShippingOption shippingOption;
- if (detail == PaymentTestDetailShippingOption)
- shippingOption = buildShippingOptionForTest(data, modificationType, valueToUse);
- else
- shippingOption = buildShippingOptionForTest();
-
- PaymentDetails result;
- result.setTotal(total);
- result.setDisplayItems(HeapVector<PaymentItem>(1, item));
- result.setShippingOptions(HeapVector<ShippingOption>(2, shippingOption));
-
- return result;
-}
-
-} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698