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

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

Issue 2532953006: Throw if PaymentRequest() built with 'error' message (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/payments/PaymentRequest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 ['Infinite JSON value for one of the payment method specific data pieces sho uld throw', null, function() { 344 ['Infinite JSON value for one of the payment method specific data pieces sho uld throw', null, function() {
345 var infiniteData = {'foo': {}}; 345 var infiniteData = {'foo': {}};
346 infiniteData.foo = infiniteData; 346 infiniteData.foo = infiniteData;
347 new PaymentRequest([{'supportedMethods': ['foo'], 'data': infiniteData}] , buildDetails()) 347 new PaymentRequest([{'supportedMethods': ['foo'], 'data': infiniteData}] , buildDetails())
348 }], 348 }],
349 ['Null for payment method specific data parameter should throw', null, funct ion() { 349 ['Null for payment method specific data parameter should throw', null, funct ion() {
350 new PaymentRequest([{'supportedMethods': ['foo'], 'data': null}], buildD etails()) 350 new PaymentRequest([{'supportedMethods': ['foo'], 'data': null}], buildD etails())
351 }], 351 }],
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 }],
355 ['If details contains a null value for error, then throw a TypeError', new T ypeError(), function() {
foolip 2016/11/29 21:48:28 This will stringify to 'null', but it doesn't hurt
please use gerrit instead 2016/11/29 21:49:47 Acknowledged.
356 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'error': null})
357 }],
358 ['If details contains an empty string value for error, then throw a TypeErro r', new TypeError(), function() {
359 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'error': ''})
360 }],
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'})
354 }] 363 }]
355 ]); 364 ]);
356 365
357 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'];
358 for (var i in detailNames) { 367 for (var i in detailNames) {
359 generate_tests(assert_throws, [ 368 generate_tests(assert_throws, [
360 // Invalid currency code formats. 369 // Invalid currency code formats.
361 ['Undefined currency code should throw', null, function() { 370 ['Undefined currency code should throw', null, function() {
362 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'currency': undefined})) 371 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'currency': undefined}))
363 }], 372 }],
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 }], 410 }],
402 ['Null amount should throw', null, function() { 411 ['Null amount should throw', null, function() {
403 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': null})) 412 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': null}))
404 }], 413 }],
405 ['Undefined amount should throw', null, function() { 414 ['Undefined amount should throw', null, function() {
406 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': undefined})) 415 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': undefined}))
407 }], 416 }],
408 ]); 417 ]);
409 } 418 }
410 </script> 419 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/payments/PaymentRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698