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

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

Issue 2851383002: Verify behavior of PaymentRequest constructor. (Closed)
Patch Set: Comments Created 3 years, 7 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 }], 306 }],
307 ['Undefined supportedMethods in modifiers should throw TypeError.', null, fu nction() { 307 ['Undefined supportedMethods in modifiers should throw TypeError.', null, fu nction() {
308 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'modifiers': [{'supportedMethods': undefined}]}) 308 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'modifiers': [{'supportedMethods': undefined}]})
309 }], 309 }],
310 ['Empty supportedMethods in modifiers should throw TypeError.', null, functi on() { 310 ['Empty supportedMethods in modifiers should throw TypeError.', null, functi on() {
311 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'modifiers': [{'supportedMethods': []}]}) 311 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'modifiers': [{'supportedMethods': []}]})
312 }], 312 }],
313 ['Absence of supportedMethods in modifiers should throw TypeError.', null, f unction() { 313 ['Absence of supportedMethods in modifiers should throw TypeError.', null, f unction() {
314 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'modifiers': [{'total': buildItem()}]}) 314 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'modifiers': [{'total': buildItem()}]})
315 }], 315 }],
316 ['Empty modifiers should throw TypeError.', null, function() {
317 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'modifiers': []})
318 }],
319 ['Empty details should throw', null, function() { 316 ['Empty details should throw', null, function() {
320 new PaymentRequest([{'supportedMethods': ['foo']}], {}) 317 new PaymentRequest([{'supportedMethods': ['foo']}], {})
321 }], 318 }],
322 ['Null items should throw', new TypeError(), function() { 319 ['Null items should throw', new TypeError(), function() {
323 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'displayItems': null}); 320 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'displayItems': null});
324 }], 321 }],
325 ['Null shipping options should throw', new TypeError(), function() { 322 ['Null shipping options should throw', new TypeError(), function() {
326 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'displayItems': [buildItem()], 'shippingOptions': null}); 323 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'displayItems': [buildItem()], 'shippingOptions': null});
327 }], 324 }],
328 ['Undefined PaymentShippingType value for shppingType should throw a TypeErr or', new TypeError(), function() { 325 ['Undefined PaymentShippingType value for shppingType should throw a TypeErr or', new TypeError(), function() {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 }], 408 }],
412 ['Null amount in ' + detailNames[i] + ' should throw', null, function() { 409 ['Null amount in ' + detailNames[i] + ' should throw', null, function() {
413 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': null}), {requestShipping: true}) 410 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': null}), {requestShipping: true})
414 }], 411 }],
415 ['Undefined amount in ' + detailNames[i] + ' should throw', null, functi on() { 412 ['Undefined amount in ' + detailNames[i] + ' should throw', null, functi on() {
416 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': undefined}), {requestShipping: true}) 413 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': undefined}), {requestShipping: true})
417 }], 414 }],
418 ]); 415 ]);
419 } 416 }
420 </script> 417 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698