| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 ['Empty string for payment method specific data parameter should throw', nul
l, function() { | 336 ['Empty string for payment method specific data parameter should throw', nul
l, function() { |
| 337 new PaymentRequest([{'supportedMethods': ['foo'], 'data': ''}], buildDet
ails()) | 337 new PaymentRequest([{'supportedMethods': ['foo'], 'data': ''}], buildDet
ails()) |
| 338 }] | 338 }] |
| 339 ]); | 339 ]); |
| 340 | 340 |
| 341 var detailNames = ['total', 'displayItems.0', 'shippingOptions.0', 'modifiers.0.
total', 'modifiers.0.additionalDisplayItems.0']; | 341 var detailNames = ['total', 'displayItems.0', 'shippingOptions.0', 'modifiers.0.
total', 'modifiers.0.additionalDisplayItems.0']; |
| 342 for (var i in detailNames) { | 342 for (var i in detailNames) { |
| 343 generate_tests(assert_throws, [ | 343 generate_tests(assert_throws, [ |
| 344 // Invalid currency code formats. | 344 // Invalid currency code formats. |
| 345 ['Undefined currency code should throw', null, function() { | 345 ['Undefined currency code should throw', null, function() { |
| 346 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'currency': undefined})) | 346 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'currency': undefined}), {'requestShipping': true}) |
| 347 }], | 347 }], |
| 348 | 348 |
| 349 // Invalid amount formats. | 349 // Invalid amount formats. |
| 350 ['Invalid amount "-" should throw', null, function() { | 350 ['Invalid amount "-" should throw', null, function() { |
| 351 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '-'})) | 351 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '-'}), {'requestShipping': true}) |
| 352 }], | 352 }], |
| 353 ['Invalid amount "notdigits" should throw', null, function() { | 353 ['Invalid amount "notdigits" should throw', null, function() { |
| 354 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': 'notdigits'})) | 354 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': 'notdigits'}), {'requestShipping': true}) |
| 355 }], | 355 }], |
| 356 ['Invalid amount "ALSONOTDIGITS" should throw', null, function() { | 356 ['Invalid amount "ALSONOTDIGITS" should throw', null, function() { |
| 357 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': 'ALSONOTDIGITS'})) | 357 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': 'ALSONOTDIGITS'}), {'requestShipping': true}) |
| 358 }], | 358 }], |
| 359 ['Invalid amount "10." should throw', null, function() { | 359 ['Invalid amount "10." should throw', null, function() { |
| 360 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '10.'})) | 360 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '10.'}), {'requestShipping': true}) |
| 361 }], | 361 }], |
| 362 ['Invalid amount ".99" should throw', null, function() { | 362 ['Invalid amount ".99" should throw', null, function() { |
| 363 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '.99'})) | 363 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '.99'}), {'requestShipping': true}) |
| 364 }], | 364 }], |
| 365 ['Invalid amount "-10." should throw', null, function() { | 365 ['Invalid amount "-10." should throw', null, function() { |
| 366 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '-10.'})) | 366 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '-10.'}), {'requestShipping': true}) |
| 367 }], | 367 }], |
| 368 ['Invalid amount "-.99" should throw', null, function() { | 368 ['Invalid amount "-.99" should throw', null, function() { |
| 369 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '-.99'})) | 369 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '-.99'}), {'requestShipping': true}) |
| 370 }], | 370 }], |
| 371 ['Invalid amount "10-" should throw', null, function() { | 371 ['Invalid amount "10-" should throw', null, function() { |
| 372 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '10-'})) | 372 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '10-'}), {'requestShipping': true}) |
| 373 }], | 373 }], |
| 374 ['Invalid amount "1-0" should throw', null, function() { | 374 ['Invalid amount "1-0" should throw', null, function() { |
| 375 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '1-0'})) | 375 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '1-0'}), {'requestShipping': true}) |
| 376 }], | 376 }], |
| 377 ['Invalid amount "1.0.0" should throw', null, function() { | 377 ['Invalid amount "1.0.0" should throw', null, function() { |
| 378 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '1.0.0'})) | 378 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '1.0.0'}), {'requestShipping': true}) |
| 379 }], | 379 }], |
| 380 ['Invalid amount "1/3" should throw', null, function() { | 380 ['Invalid amount "1/3" should throw', null, function() { |
| 381 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '1/3'})) | 381 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': '1/3'}), {'requestShipping': true}) |
| 382 }], | 382 }], |
| 383 ['Empty amount should throw', null, function() { | 383 ['Empty amount should throw', null, function() { |
| 384 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': ''})) | 384 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': ''}), {'requestShipping': true}) |
| 385 }], | 385 }], |
| 386 ['Null amount should throw', null, function() { | 386 ['Null amount should throw', null, function() { |
| 387 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': null})) | 387 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': null}), {'requestShipping': true}) |
| 388 }], | 388 }], |
| 389 ['Undefined amount should throw', null, function() { | 389 ['Undefined amount should throw', null, function() { |
| 390 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': undefined})) | 390 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': undefined}), {'requestShipping': true}) |
| 391 }], | 391 }], |
| 392 ]); | 392 ]); |
| 393 } | 393 } |
| 394 </script> | 394 </script> |
| OLD | NEW |