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

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

Issue 2780773004: Reland "PaymentRequest: Introduce PaymentDetailsInit and PaymentDetailsUpdate." (Closed)
Patch Set: Reland "PaymentRequest: Introduce PaymentDetailsInit and PaymentDetailsUpdate." Created 3 years, 8 months 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 ['Infinite JSON value for one of the payment method specific data pieces sho uld throw', null, function() { 354 ['Infinite JSON value for one of the payment method specific data pieces sho uld throw', null, function() {
355 var infiniteData = {'foo': {}}; 355 var infiniteData = {'foo': {}};
356 infiniteData.foo = infiniteData; 356 infiniteData.foo = infiniteData;
357 new PaymentRequest([{'supportedMethods': ['foo'], 'data': infiniteData}] , buildDetails()) 357 new PaymentRequest([{'supportedMethods': ['foo'], 'data': infiniteData}] , buildDetails())
358 }], 358 }],
359 ['Null for payment method specific data parameter should throw', null, funct ion() { 359 ['Null for payment method specific data parameter should throw', null, funct ion() {
360 new PaymentRequest([{'supportedMethods': ['foo'], 'data': null}], buildD etails()) 360 new PaymentRequest([{'supportedMethods': ['foo'], 'data': null}], buildD etails())
361 }], 361 }],
362 ['Empty string for payment method specific data parameter should throw', nul l, function() { 362 ['Empty string for payment method specific data parameter should throw', nul l, function() {
363 new PaymentRequest([{'supportedMethods': ['foo'], 'data': ''}], buildDet ails()) 363 new PaymentRequest([{'supportedMethods': ['foo'], 'data': ''}], buildDet ails())
364 }],
365 ['If details contains a null value for error, then throw a TypeError', new T ypeError(), function() {
366 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'error': null})
367 }],
368 ['If details contains an empty string value for error, then throw a TypeErro r', new TypeError(), function() {
369 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'error': ''})
370 }],
371 ['If details contains a non-empty string value for error, then throw a TypeE rror', new TypeError(), function() {
372 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'error': 'Message'})
373 }] 364 }]
374 ]); 365 ]);
375 366
376 var detailNames = ['total', 'displayItems.0', 'shippingOptions.0', 'modifiers.0. total', 'modifiers.0.additionalDisplayItems.0']; 367 var detailNames = ['total', 'displayItems.0', 'shippingOptions.0', 'modifiers.0. total', 'modifiers.0.additionalDisplayItems.0'];
377 for (var i in detailNames) { 368 for (var i in detailNames) {
378 generate_tests(assert_throws, [ 369 generate_tests(assert_throws, [
379 // Invalid currency code formats. 370 // Invalid currency code formats.
380 ['Undefined currency code should throw', null, function() { 371 ['Undefined currency code should throw', null, function() {
381 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'currency': undefined}), {requestShipping: true}) 372 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'currency': undefined}), {requestShipping: true})
382 }], 373 }],
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 }], 411 }],
421 ['Null amount should throw', null, function() { 412 ['Null amount should throw', null, function() {
422 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': null}), {requestShipping: true}) 413 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': null}), {requestShipping: true})
423 }], 414 }],
424 ['Undefined amount should throw', null, function() { 415 ['Undefined amount should throw', null, function() {
425 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': undefined}), {requestShipping: true}) 416 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': undefined}), {requestShipping: true})
426 }], 417 }],
427 ]); 418 ]);
428 } 419 }
429 </script> 420 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698