Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: third_party/WebKit/LayoutTests/payments/payment-request-interface.html

Issue 2470463002: Add data parameter to payment details modifier. (Closed)
Patch Set: Rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 ['If details contains a non-empty string value for error, then throw a TypeE rror', new TypeError(), function() { 361 ['If details contains a non-empty string value for error, then throw a TypeE rror', new TypeError(), function() {
362 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'error': 'Message'}) 362 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'error': 'Message'})
363 }] 363 }]
364 ]); 364 ]);
365 365
366 var detailNames = ['total', 'displayItems.0', 'shippingOptions.0', 'modifiers.0. total', 'modifiers.0.additionalDisplayItems.0']; 366 var detailNames = ['total', 'displayItems.0', 'shippingOptions.0', 'modifiers.0. total', 'modifiers.0.additionalDisplayItems.0'];
367 for (var i in detailNames) { 367 for (var i in detailNames) {
368 generate_tests(assert_throws, [ 368 generate_tests(assert_throws, [
369 // Invalid currency code formats. 369 // Invalid currency code formats.
370 ['Undefined currency code should throw', null, function() { 370 ['Undefined currency code should throw', null, function() {
371 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'currency': undefined})) 371 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'currency': undefined}), {requestShipping: true})
372 }], 372 }],
373 373
374 // Invalid amount formats. 374 // Invalid amount formats.
375 ['Invalid amount "-" should throw', null, function() { 375 ['Invalid amount "-" should throw', null, function() {
376 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '-'})) 376 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '-'}), {requestShipping: true})
377 }], 377 }],
378 ['Invalid amount "notdigits" should throw', null, function() { 378 ['Invalid amount "notdigits" should throw', null, function() {
379 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': 'notdigits'})) 379 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': 'notdigits'}), {requestShipping: true})
380 }], 380 }],
381 ['Invalid amount "ALSONOTDIGITS" should throw', null, function() { 381 ['Invalid amount "ALSONOTDIGITS" should throw', null, function() {
382 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': 'ALSONOTDIGITS'})) 382 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': 'ALSONOTDIGITS'}), {requestShipping: true})
383 }], 383 }],
384 ['Invalid amount "10." should throw', null, function() { 384 ['Invalid amount "10." should throw', null, function() {
385 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '10.'})) 385 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '10.'}), {requestShipping: true})
386 }], 386 }],
387 ['Invalid amount ".99" should throw', null, function() { 387 ['Invalid amount ".99" should throw', null, function() {
388 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '.99'})) 388 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '.99'}), {requestShipping: true})
389 }], 389 }],
390 ['Invalid amount "-10." should throw', null, function() { 390 ['Invalid amount "-10." should throw', null, function() {
391 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '-10.'})) 391 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '-10.'}), {requestShipping: true})
392 }], 392 }],
393 ['Invalid amount "-.99" should throw', null, function() { 393 ['Invalid amount "-.99" should throw', null, function() {
394 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '-.99'})) 394 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '-.99'}), {requestShipping: true})
395 }], 395 }],
396 ['Invalid amount "10-" should throw', null, function() { 396 ['Invalid amount "10-" should throw', null, function() {
397 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '10-'})) 397 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '10-'}), {requestShipping: true})
398 }], 398 }],
399 ['Invalid amount "1-0" should throw', null, function() { 399 ['Invalid amount "1-0" should throw', null, function() {
400 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '1-0'})) 400 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '1-0'}), {requestShipping: true})
401 }], 401 }],
402 ['Invalid amount "1.0.0" should throw', null, function() { 402 ['Invalid amount "1.0.0" should throw', null, function() {
403 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '1.0.0'})) 403 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '1.0.0'}), {requestShipping: true})
404 }], 404 }],
405 ['Invalid amount "1/3" should throw', null, function() { 405 ['Invalid amount "1/3" should throw', null, function() {
406 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '1/3'})) 406 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '1/3'}), {requestShipping: true})
407 }], 407 }],
408 ['Empty amount should throw', null, function() { 408 ['Empty amount should throw', null, function() {
409 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': ''})) 409 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': ''}), {requestShipping: true})
410 }], 410 }],
411 ['Null amount should throw', null, function() { 411 ['Null amount should throw', null, function() {
412 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': null})) 412 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': null}), {requestShipping: true})
413 }], 413 }],
414 ['Undefined amount should throw', null, function() { 414 ['Undefined amount should throw', null, function() {
415 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': undefined})) 415 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': undefined}), {requestShipping: true})
416 }], 416 }],
417 ]); 417 ]);
418 } 418 }
419 </script> 419 </script>
OLDNEW
« no previous file with comments | « components/payments/payment_request.mojom ('k') | third_party/WebKit/Source/modules/payments/PaymentDetailsModifier.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698