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 10 matching lines...) Expand all Loading... |
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 } else { | 28 } else { |
29 itemAmount.setCurrency("USD"); | 29 itemAmount.setCurrency("USD"); |
30 } | 30 } |
| 31 |
| 32 // Currency system is "urn:iso:std:iso:4217" by default. |
| 33 if (data == PaymentTestDataCurrencySystem) { |
| 34 if (modificationType == PaymentTestOverwriteValue) |
| 35 itemAmount.setCurrencySystem(valueToUse); |
| 36 else |
| 37 itemAmount.setCurrencySystem(String()); // null string. |
| 38 } |
| 39 |
31 if (data == PaymentTestDataValue) { | 40 if (data == PaymentTestDataValue) { |
32 if (modificationType == PaymentTestOverwriteValue) | 41 if (modificationType == PaymentTestOverwriteValue) |
33 itemAmount.setValue(valueToUse); | 42 itemAmount.setValue(valueToUse); |
34 } else { | 43 } else { |
35 itemAmount.setValue("9.99"); | 44 itemAmount.setValue("9.99"); |
36 } | 45 } |
37 | 46 |
38 if (data != PaymentTestDataAmount || modificationType != PaymentTestRemoveKey) | 47 if (data != PaymentTestDataAmount || modificationType != PaymentTestRemoveKey) |
39 original.setAmount(itemAmount); | 48 original.setAmount(itemAmount); |
40 | 49 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 ON_CALL(*this, call(testing::_)) | 224 ON_CALL(*this, call(testing::_)) |
216 .WillByDefault( | 225 .WillByDefault( |
217 testing::DoAll(SaveValueIn(m_value), testing::ReturnArg<0>())); | 226 testing::DoAll(SaveValueIn(m_value), testing::ReturnArg<0>())); |
218 } | 227 } |
219 | 228 |
220 v8::Local<v8::Function> PaymentRequestMockFunctionScope::MockFunction::bind() { | 229 v8::Local<v8::Function> PaymentRequestMockFunctionScope::MockFunction::bind() { |
221 return bindToV8Function(); | 230 return bindToV8Function(); |
222 } | 231 } |
223 | 232 |
224 } // namespace blink | 233 } // namespace blink |
OLD | NEW |