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

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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 ['Empty string for payment method specific data parameter should throw', nul l, function() { 352 ['Empty string for payment method specific data parameter should throw', nul l, function() {
353 new PaymentRequest([{'supportedMethods': ['foo'], 'data': ''}], buildDet ails()) 353 new PaymentRequest([{'supportedMethods': ['foo'], 'data': ''}], buildDet ails())
354 }] 354 }]
355 ]); 355 ]);
356 356
357 var detailNames = ['total', 'displayItems.0', 'shippingOptions.0', 'modifiers.0. total', 'modifiers.0.additionalDisplayItems.0']; 357 var detailNames = ['total', 'displayItems.0', 'shippingOptions.0', 'modifiers.0. total', 'modifiers.0.additionalDisplayItems.0'];
358 for (var i in detailNames) { 358 for (var i in detailNames) {
359 generate_tests(assert_throws, [ 359 generate_tests(assert_throws, [
360 // Invalid currency code formats. 360 // Invalid currency code formats.
361 ['Undefined currency code should throw', null, function() { 361 ['Undefined currency code should throw', null, function() {
362 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'currency': undefined})) 362 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'currency': undefined}), {requestShipping: true})
363 }], 363 }],
364 364
365 // Invalid amount formats. 365 // Invalid amount formats.
366 ['Invalid amount "-" should throw', null, function() { 366 ['Invalid amount "-" should throw', null, function() {
367 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '-'})) 367 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '-'}), {requestShipping: true})
368 }], 368 }],
369 ['Invalid amount "notdigits" should throw', null, function() { 369 ['Invalid amount "notdigits" should throw', null, function() {
370 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': 'notdigits'})) 370 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': 'notdigits'}), {requestShipping: true})
371 }], 371 }],
372 ['Invalid amount "ALSONOTDIGITS" should throw', null, function() { 372 ['Invalid amount "ALSONOTDIGITS" should throw', null, function() {
373 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': 'ALSONOTDIGITS'})) 373 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': 'ALSONOTDIGITS'}), {requestShipping: true})
374 }], 374 }],
375 ['Invalid amount "10." should throw', null, function() { 375 ['Invalid amount "10." should throw', null, function() {
376 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '10.'})) 376 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '10.'}), {requestShipping: true})
377 }], 377 }],
378 ['Invalid amount ".99" should throw', null, function() { 378 ['Invalid amount ".99" should throw', null, function() {
379 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '.99'})) 379 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '.99'}), {requestShipping: true})
380 }], 380 }],
381 ['Invalid amount "-10." should throw', null, function() { 381 ['Invalid amount "-10." should throw', null, function() {
382 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '-10.'})) 382 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '-10.'}), {requestShipping: true})
383 }], 383 }],
384 ['Invalid amount "-.99" should throw', null, function() { 384 ['Invalid amount "-.99" should throw', null, function() {
385 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '-.99'})) 385 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '-.99'}), {requestShipping: true})
386 }], 386 }],
387 ['Invalid amount "10-" should throw', null, function() { 387 ['Invalid amount "10-" should throw', null, function() {
388 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '10-'})) 388 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '10-'}), {requestShipping: true})
389 }], 389 }],
390 ['Invalid amount "1-0" should throw', null, function() { 390 ['Invalid amount "1-0" should throw', null, function() {
391 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '1-0'})) 391 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '1-0'}), {requestShipping: true})
392 }], 392 }],
393 ['Invalid amount "1.0.0" should throw', null, function() { 393 ['Invalid amount "1.0.0" should throw', null, function() {
394 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '1.0.0'})) 394 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '1.0.0'}), {requestShipping: true})
395 }], 395 }],
396 ['Invalid amount "1/3" should throw', null, function() { 396 ['Invalid amount "1/3" should throw', null, function() {
397 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '1/3'})) 397 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '1/3'}), {requestShipping: true})
398 }], 398 }],
399 ['Empty amount should throw', null, function() { 399 ['Empty amount should throw', null, function() {
400 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': ''})) 400 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': ''}), {requestShipping: true})
401 }], 401 }],
402 ['Null amount should throw', null, function() { 402 ['Null amount should throw', null, function() {
403 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': null})) 403 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': null}), {requestShipping: true})
404 }], 404 }],
405 ['Undefined amount should throw', null, function() { 405 ['Undefined amount should throw', null, function() {
406 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': undefined})) 406 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': undefined}), {requestShipping: true})
407 }], 407 }],
408 ]); 408 ]);
409 } 409 }
410 </script> 410 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698