| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> | 2 <meta charset="utf-8"> |
| 3 <title>Tests for PaymentRequest interface</title> | 3 <title>Tests for PaymentRequest interface</title> |
| 4 <script src="../resources/testharness.js"></script> | 4 <script src="../resources/testharness.js"></script> |
| 5 <script src="../resources/testharnessreport.js"></script> | 5 <script src="../resources/testharnessreport.js"></script> |
| 6 <script> | 6 <script> |
| 7 function substitute(originalObject, substituteKeyValuePairs) { | 7 function substitute(originalObject, substituteKeyValuePairs) { |
| 8 for (var key in originalObject) { | 8 for (var key in originalObject) { |
| 9 if (originalObject.hasOwnProperty(key) && substituteKeyValuePairs.hasOwn
Property(key)) { | 9 if (originalObject.hasOwnProperty(key) && substituteKeyValuePairs.hasOwn
Property(key)) { |
| 10 originalObject[key] = substituteKeyValuePairs[key]; | 10 originalObject[key] = substituteKeyValuePairs[key]; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 263 |
| 264 test(function() { | 264 test(function() { |
| 265 new PaymentRequest([{'supportedMethods': ['https://android.com/pay'], 'data'
: {'environment': 'TEST', 'merchantName': 'Merchant Inc', 'merchantId': '123', '
allowedCardNetworks': ['AMEX', 'DISCOVER', 'MASTERCARD', 'VISA'], 'paymentMethod
TokenizationParameters': {'tokenizationType': 'GATEWAY_TOKEN', 'parameters': {'k
ey': 'value'}}}}], buildDetails()); | 265 new PaymentRequest([{'supportedMethods': ['https://android.com/pay'], 'data'
: {'environment': 'TEST', 'merchantName': 'Merchant Inc', 'merchantId': '123', '
allowedCardNetworks': ['AMEX', 'DISCOVER', 'MASTERCARD', 'VISA'], 'paymentMethod
TokenizationParameters': {'tokenizationType': 'GATEWAY_TOKEN', 'parameters': {'k
ey': 'value'}}}}], buildDetails()); |
| 266 }, 'Android Pay parameters for test environment with gateway token should not th
row.'); | 266 }, 'Android Pay parameters for test environment with gateway token should not th
row.'); |
| 267 | 267 |
| 268 test(function() { | 268 test(function() { |
| 269 new PaymentRequest([{'supportedMethods': ['https://android.com/pay'], 'data'
: {'environment': 'PRODUCTION', 'merchantName': 'Merchant Inc', 'merchantId': '1
23', 'allowedCardNetworks': ['AMEX', 'DISCOVER', 'MASTERCARD', 'VISA'], 'payment
MethodTokenizationParameters': {'tokenizationType': 'NETWORK_TOKEN', 'parameters
': {'key': 'value'}}}}], buildDetails()); | 269 new PaymentRequest([{'supportedMethods': ['https://android.com/pay'], 'data'
: {'environment': 'PRODUCTION', 'merchantName': 'Merchant Inc', 'merchantId': '1
23', 'allowedCardNetworks': ['AMEX', 'DISCOVER', 'MASTERCARD', 'VISA'], 'payment
MethodTokenizationParameters': {'tokenizationType': 'NETWORK_TOKEN', 'parameters
': {'key': 'value'}}}}], buildDetails()); |
| 270 }, 'Android Pay parameters for produciton environment with network token should
not throw.'); | 270 }, 'Android Pay parameters for produciton environment with network token should
not throw.'); |
| 271 | 271 |
| 272 test(function() { | 272 test(function() { |
| 273 new PaymentRequest([{'supportedMethods': ['basic-card'], 'data': {'supportedTy
pes': ['debit'], 'supportedNetworks': ['visa']}}], buildDetails()); |
| 274 }, 'Basic card parameters should not throw.'); |
| 275 |
| 276 test(function() { |
| 277 new PaymentRequest([{'supportedMethods': ['basic-card'], 'data': {'supportedTy
pes': [], 'supportedNetworks': []}}], buildDetails()); |
| 278 }, 'Empty basic card parameters should not throw.'); |
| 279 |
| 280 test(function() { |
| 281 new PaymentRequest([{'supportedMethods': ['basic-card'], 'data': {'supportedTy
pes': 0, 'supportedNetworks': 'foo'}}], buildDetails()); |
| 282 }, 'Invalid basic card parameters should not throw.'); |
| 283 |
| 284 test(function() { |
| 273 new PaymentRequest([{'supportedMethods': ['https://android.com/pay'], 'data'
: {'merchantName': 'Merchant Inc', 'merchantId': '123', 'allowedCardNetworks': [
'AMEX', 'DISCOVER', 'MASTERCARD', 'VISA'], 'paymentMethodTokenizationParameters'
: {'tokenizationType': 'NETWORK_TOKEN', 'parameters': {'key': 'value'}}}}], buil
dDetails()); | 285 new PaymentRequest([{'supportedMethods': ['https://android.com/pay'], 'data'
: {'merchantName': 'Merchant Inc', 'merchantId': '123', 'allowedCardNetworks': [
'AMEX', 'DISCOVER', 'MASTERCARD', 'VISA'], 'paymentMethodTokenizationParameters'
: {'tokenizationType': 'NETWORK_TOKEN', 'parameters': {'key': 'value'}}}}], buil
dDetails()); |
| 274 }, 'Android Pay parameters for network token without environment key should not
throw.'); | 286 }, 'Android Pay parameters for network token without environment key should not
throw.'); |
| 275 | 287 |
| 276 test(function() { | 288 test(function() { |
| 277 new PaymentRequest([{'supportedMethods': ['https://android.com/pay'], 'data'
: {'merchantName': []}}], buildDetails()); | 289 new PaymentRequest([{'supportedMethods': ['https://android.com/pay'], 'data'
: {'merchantName': []}}], buildDetails()); |
| 278 }, 'Invalid Android Pay parameters should not throw.'); | 290 }, 'Invalid Android Pay parameters should not throw.'); |
| 279 | 291 |
| 280 promise_test(function(t) { | 292 promise_test(function(t) { |
| 281 return promise_rejects(t, null, new PaymentRequest([{'supportedMethods': ['f
oo']}], buildDetails()).abort()); | 293 return promise_rejects(t, null, new PaymentRequest([{'supportedMethods': ['f
oo']}], buildDetails()).abort()); |
| 282 }, 'abort() without show() should reject with error'); | 294 }, 'abort() without show() should reject with error'); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 }], | 413 }], |
| 402 ['Null amount should throw', null, function() { | 414 ['Null amount should throw', null, function() { |
| 403 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': null})) | 415 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': null})) |
| 404 }], | 416 }], |
| 405 ['Undefined amount should throw', null, function() { | 417 ['Undefined amount should throw', null, function() { |
| 406 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': undefined})) | 418 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': undefined})) |
| 407 }], | 419 }], |
| 408 ]); | 420 ]); |
| 409 } | 421 } |
| 410 </script> | 422 </script> |
| OLD | NEW |