Chromium Code Reviews| 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" |
| 11 #include "platform/heap/HeapAllocator.h" | 11 #include "platform/heap/HeapAllocator.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 static int gUniqueId = 0; | 16 static int gUniqueId = 0; |
| 17 // PaymentItem and PaymentShippingOption have identical structure | 17 // PaymentItem and PaymentShippingOption have identical structure |
| 18 // except for the "id" field, which is present only in PaymentShippingOption. | 18 // except for the "id" field, which is present only in PaymentShippingOption. |
| 19 template <typename PaymentItemOrPaymentShippingOption> | 19 template <typename PaymentItemOrPaymentShippingOption> |
| 20 void setValues(PaymentItemOrPaymentShippingOption& original, | 20 void setValues(PaymentItemOrPaymentShippingOption& original, |
| 21 PaymentTestDataToChange data, | 21 PaymentTestDataToChange data, |
| 22 PaymentTestModificationType modificationType, | 22 PaymentTestModificationType modificationType, |
| 23 const String& valueToUse) { | 23 const String& valueToUse) { |
| 24 PaymentCurrencyAmount itemAmount; | 24 PaymentCurrencyAmount itemAmount; |
| 25 if (data == PaymentTestDataCurrencyCode) { | 25 if (data == PaymentTestDataCurrencyCode) { |
| 26 if (modificationType == PaymentTestOverwriteValue) | 26 if (modificationType == PaymentTestOverwriteValue) { |
| 27 itemAmount.setCurrency(valueToUse); | 27 itemAmount.setCurrency(valueToUse); |
| 28 itemAmount.setCurrencySystem("http://www.example.com"); | |
|
please use gerrit instead
2016/10/12 23:35:49
Please add PaymentTestDataCurrencySystem and call
pals
2016/10/13 09:30:38
Done.
| |
| 29 } | |
| 28 } else { | 30 } else { |
| 29 itemAmount.setCurrency("USD"); | 31 itemAmount.setCurrency("USD"); |
| 30 } | 32 } |
| 31 if (data == PaymentTestDataValue) { | 33 if (data == PaymentTestDataValue) { |
| 32 if (modificationType == PaymentTestOverwriteValue) | 34 if (modificationType == PaymentTestOverwriteValue) |
| 33 itemAmount.setValue(valueToUse); | 35 itemAmount.setValue(valueToUse); |
| 34 } else { | 36 } else { |
| 35 itemAmount.setValue("9.99"); | 37 itemAmount.setValue("9.99"); |
| 36 } | 38 } |
| 37 | 39 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 ON_CALL(*this, call(testing::_)) | 217 ON_CALL(*this, call(testing::_)) |
| 216 .WillByDefault( | 218 .WillByDefault( |
| 217 testing::DoAll(SaveValueIn(m_value), testing::ReturnArg<0>())); | 219 testing::DoAll(SaveValueIn(m_value), testing::ReturnArg<0>())); |
| 218 } | 220 } |
| 219 | 221 |
| 220 v8::Local<v8::Function> PaymentRequestMockFunctionScope::MockFunction::bind() { | 222 v8::Local<v8::Function> PaymentRequestMockFunctionScope::MockFunction::bind() { |
| 221 return bindToV8Function(); | 223 return bindToV8Function(); |
| 222 } | 224 } |
| 223 | 225 |
| 224 } // namespace blink | 226 } // namespace blink |
| OLD | NEW |