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

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

Issue 2500183002: Do not parse JSON in the browser. (Closed)
Patch Set: Use a Dictionary type in IDL Created 4 years, 1 month 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 }, 'Duplicate supported payment method identifiers should not throw.'); 254 }, 'Duplicate supported payment method identifiers should not throw.');
255 255
256 test(function() { 256 test(function() {
257 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), ' modifiers': [{'supportedMethods': ['foo', 'foo']}]}); 257 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), ' modifiers': [{'supportedMethods': ['foo', 'foo']}]});
258 }, 'Duplicate supported payment method identifiers in modifiers should not throw .'); 258 }, 'Duplicate supported payment method identifiers in modifiers should not throw .');
259 259
260 test(function() { 260 test(function() {
261 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), ' modifiers': [{'supportedMethods': ['foo']}, {'supportedMethods': ['foo']}]}); 261 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), ' modifiers': [{'supportedMethods': ['foo']}, {'supportedMethods': ['foo']}]});
262 }, 'Duplicate supported payment method identifiers in modifiers should not throw .'); 262 }, 'Duplicate supported payment method identifiers in modifiers should not throw .');
263 263
264 test(function() {
265 new PaymentRequest([{'supportedMethods': ['https://android.com/pay'], 'data' : {'environment': 'TEST', 'merchantName': 'Merchant Inc', 'merchantId': '123', ' allowedCardNetworks': ['AMEX', 'DISCOVER', 'MASTERCARD', 'VISA'], 'paymentMethod TokenizationParameters': {'tokenizationType': 'GATEWAY_TOKEN', 'parameters': {'k ey': 'value'}}}}], buildDetails());
266 }, 'Android Pay parameters for test environment with gateway token should not th row.');
267
268 test(function() {
269 new PaymentRequest([{'supportedMethods': ['https://android.com/pay'], 'data' : {'environment': 'PRODUCTION', 'merchantName': 'Merchant Inc', 'merchantId': '1 23', 'allowedCardNetworks': ['AMEX', 'DISCOVER', 'MASTERCARD', 'VISA'], 'payment MethodTokenizationParameters': {'tokenizationType': 'NETWORK_TOKEN', 'parameters ': {'key': 'value'}}}}], buildDetails());
270 }, 'Android Pay parameters for produciton environment with network token should not throw.');
271
272 test(function() {
273 new PaymentRequest([{'supportedMethods': ['https://android.com/pay'], 'data' : {'merchantName': 'Merchant Inc', 'merchantId': '123', 'allowedCardNetworks': [ 'AMEX', 'DISCOVER', 'MASTERCARD', 'VISA'], 'paymentMethodTokenizationParameters' : {'tokenizationType': 'NETWORK_TOKEN', 'parameters': {'key': 'value'}}}}], buil dDetails());
274 }, 'Android Pay parameters for network token without environment key should not throw.');
275
276 test(function() {
277 new PaymentRequest([{'supportedMethods': ['https://android.com/pay'], 'data' : {'merchantName': []}}], buildDetails());
278 }, 'Invalid Android Pay parameters should not throw.');
279
264 promise_test(function(t) { 280 promise_test(function(t) {
265 return promise_rejects(t, null, new PaymentRequest([{'supportedMethods': ['f oo']}], buildDetails()).abort()); 281 return promise_rejects(t, null, new PaymentRequest([{'supportedMethods': ['f oo']}], buildDetails()).abort());
266 }, 'abort() without show() should reject with error'); 282 }, 'abort() without show() should reject with error');
267 283
268 generate_tests(assert_throws, [ 284 generate_tests(assert_throws, [
269 ['PaymentRequest constructor should throw for incorrect parameter types.', n ull, function() { 285 ['PaymentRequest constructor should throw for incorrect parameter types.', n ull, function() {
270 new PaymentRequest('', '', '') 286 new PaymentRequest('', '', '')
271 }], 287 }],
272 ['PaymentRequest constructor should throw for undefined required parameters. ', null, function() { 288 ['PaymentRequest constructor should throw for undefined required parameters. ', null, function() {
273 new PaymentRequest(undefined, undefined) 289 new PaymentRequest(undefined, undefined)
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 }], 401 }],
386 ['Null amount should throw', null, function() { 402 ['Null amount should throw', null, function() {
387 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': null})) 403 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': null}))
388 }], 404 }],
389 ['Undefined amount should throw', null, function() { 405 ['Undefined amount should throw', null, function() {
390 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': undefined})) 406 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': undefined}))
391 }], 407 }],
392 ]); 408 ]);
393 } 409 }
394 </script> 410 </script>
OLDNEW
« no previous file with comments | « components/payments/payment_request.mojom ('k') | third_party/WebKit/Source/modules/modules_idl_files.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698