| OLD | NEW |
| 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/PaymentTestHelper.h" | 5 #include "modules/payments/PaymentTestHelper.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "modules/payments/PaymentCurrencyAmount.h" | 9 #include "modules/payments/PaymentCurrencyAmount.h" |
| 10 #include "modules/payments/PaymentMethodData.h" | 10 #include "modules/payments/PaymentMethodData.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 shippingOption = buildShippingOptionForTest(); | 131 shippingOption = buildShippingOptionForTest(); |
| 132 | 132 |
| 133 PaymentDetailsModifier modifier; | 133 PaymentDetailsModifier modifier; |
| 134 if (detail == PaymentTestDetailModifierTotal || | 134 if (detail == PaymentTestDetailModifierTotal || |
| 135 detail == PaymentTestDetailModifierItem) | 135 detail == PaymentTestDetailModifierItem) |
| 136 modifier = buildPaymentDetailsModifierForTest(detail, data, | 136 modifier = buildPaymentDetailsModifierForTest(detail, data, |
| 137 modificationType, valueToUse); | 137 modificationType, valueToUse); |
| 138 else | 138 else |
| 139 modifier = buildPaymentDetailsModifierForTest(); | 139 modifier = buildPaymentDetailsModifierForTest(); |
| 140 | 140 |
| 141 String errorMessage = ""; | |
| 142 if (detail == PaymentTestDetailError) | |
| 143 errorMessage = valueToUse; | |
| 144 | |
| 145 PaymentDetails result; | 141 PaymentDetails result; |
| 146 result.setTotal(total); | 142 result.setTotal(total); |
| 147 result.setDisplayItems(HeapVector<PaymentItem>(1, item)); | 143 result.setDisplayItems(HeapVector<PaymentItem>(1, item)); |
| 148 result.setShippingOptions( | 144 result.setShippingOptions( |
| 149 HeapVector<PaymentShippingOption>(1, shippingOption)); | 145 HeapVector<PaymentShippingOption>(1, shippingOption)); |
| 150 result.setModifiers(HeapVector<PaymentDetailsModifier>(1, modifier)); | 146 result.setModifiers(HeapVector<PaymentDetailsModifier>(1, modifier)); |
| 151 result.setError(errorMessage); | 147 |
| 148 if (detail == PaymentTestDetailError) |
| 149 result.setError(valueToUse); |
| 152 | 150 |
| 153 return result; | 151 return result; |
| 154 } | 152 } |
| 155 | 153 |
| 156 PaymentDetails buildPaymentDetailsErrorMsgForTest(const String& valueToUse) { | 154 PaymentDetails buildPaymentDetailsErrorMsgForTest(const String& valueToUse) { |
| 157 return buildPaymentDetailsForTest(PaymentTestDetailError, PaymentTestDataNone, | 155 return buildPaymentDetailsForTest(PaymentTestDetailError, PaymentTestDataNone, |
| 158 PaymentTestOverwriteValue, valueToUse); | 156 PaymentTestOverwriteValue, valueToUse); |
| 159 } | 157 } |
| 160 | 158 |
| 161 HeapVector<PaymentMethodData> buildPaymentMethodDataForTest() { | 159 HeapVector<PaymentMethodData> buildPaymentMethodDataForTest() { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 ON_CALL(*this, call(testing::_)) | 222 ON_CALL(*this, call(testing::_)) |
| 225 .WillByDefault( | 223 .WillByDefault( |
| 226 testing::DoAll(SaveValueIn(m_value), testing::ReturnArg<0>())); | 224 testing::DoAll(SaveValueIn(m_value), testing::ReturnArg<0>())); |
| 227 } | 225 } |
| 228 | 226 |
| 229 v8::Local<v8::Function> PaymentRequestMockFunctionScope::MockFunction::bind() { | 227 v8::Local<v8::Function> PaymentRequestMockFunctionScope::MockFunction::bind() { |
| 230 return bindToV8Function(); | 228 return bindToV8Function(); |
| 231 } | 229 } |
| 232 | 230 |
| 233 } // namespace blink | 231 } // namespace blink |
| OLD | NEW |