| Index: third_party/WebKit/LayoutTests/payments/payment-request-interface.html
|
| diff --git a/third_party/WebKit/LayoutTests/payments/payment-request-interface.html b/third_party/WebKit/LayoutTests/payments/payment-request-interface.html
|
| index d543737711771a3c64596fe152f9c7dd91fe341f..e9282c0a64e6c67798022638064fb3575b723a43 100644
|
| --- a/third_party/WebKit/LayoutTests/payments/payment-request-interface.html
|
| +++ b/third_party/WebKit/LayoutTests/payments/payment-request-interface.html
|
| @@ -41,84 +41,84 @@ function buildDetails(optionalDetailName, optionalSubstituteKeyValuePair) {
|
| }
|
|
|
| test(function() {
|
| - new PaymentRequest(['foo'], buildDetails(), {}, {});
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), {});
|
| }, 'Creating a PaymentRequest with empty parameters should not throw or crash.');
|
|
|
| test(function() {
|
| - new PaymentRequest(['foo'], buildDetails(), {}, {}, '');
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), {}, '');
|
| }, 'Creating a PaymentRequest with extra parameters should not throw or crash.');
|
|
|
| test(function() {
|
| - new PaymentRequest(['foo'], buildDetails());
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails());
|
| }, 'Creating a PaymentRequest with omitted optional parameters should not throw or crash.');
|
|
|
| test(function() {
|
| - new PaymentRequest(['foo'], buildDetails(), undefined, undefined);
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), undefined);
|
| }, 'Creating a PaymentRequest with undefined optional parameters should not throw or crash.');
|
|
|
| test(function() {
|
| - new PaymentRequest(['foo'], buildDetails(), null, null);
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), null);
|
| }, 'Creating a PaymentRequest with null optional parameters should not throw or crash.');
|
|
|
| test(function() {
|
| - var request = new PaymentRequest(['foo'], buildDetails());
|
| + var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails());
|
| assert_readonly(request, 'shippingAddress', 'PaymentRequest should have a readonly shippingAddress property.');
|
| assert_readonly(request, 'shippingOption', 'PaymentRequest should have a readonly shippingOption property.');
|
| }, 'PaymentRequest should have readonly shippingAddress and shippingOption properties.');
|
|
|
| test(function() {
|
| - var request = new PaymentRequest(['foo'], buildDetails());
|
| + var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails());
|
| assert_not_equals(request.onshippingaddresschange, undefined, 'PaymentRequest should have onShippingAddressChange event.');
|
| assert_not_equals(request.onshippingoptionchange, undefined, 'PaymentRequest should have onShippingOptionChange event.');
|
| }, 'PaymentRequest should have onShippingAddressChange and onShippingOptionChange events.');
|
|
|
| test(function() {
|
| - var request = new PaymentRequest(['foo'], buildDetails());
|
| + var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails());
|
| assert_not_equals(request.abort, undefined, 'PaymentRequest should have abort() method.');
|
| assert_not_equals(request.show, undefined, 'PaymentRequest should have show() method.');
|
| }, 'PaymentRequest should have methods abort() and show().');
|
|
|
| test(function() {
|
| - var request = new PaymentRequest(['foo'], buildDetails());
|
| + var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails());
|
| request.show();
|
| request.abort();
|
| }, 'PaymentRequest.abort() and PaymentRequest.show() should take no parameters.');
|
|
|
| test(function() {
|
| - var request = new PaymentRequest(['foo'], buildDetails(), {'requestShipping': true}, {'foo': {'gateway': 'bar'}});
|
| + var request = new PaymentRequest([{'supportedMethods': ['foo'], 'data': {'foo': {'gateway': 'bar'}}}], buildDetails(), {'requestShipping': true});
|
| request.show();
|
| request.abort();
|
| }, 'Valid data causes no errors.');
|
|
|
| test(function() {
|
| - var request = new PaymentRequest(['foo'], buildDetails('shippingOptions', {'id': 'standard'}));
|
| + var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails('shippingOptions', {'id': 'standard'}));
|
| assert_equals(null, request.shippingOption);
|
| }, 'Shipping option identifier should be null if shipping request is omitted.');
|
|
|
| test(function() {
|
| - var request = new PaymentRequest(['foo'], buildDetails('shippingOptions', {'id': 'standard'}), {'requestShipping': false});
|
| + var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails('shippingOptions', {'id': 'standard'}), {'requestShipping': false});
|
| assert_equals(null, request.shippingOption);
|
| }, 'Shipping option identifier should be null if shipping is explicitly not requested.');
|
|
|
| test(function() {
|
| - var request = new PaymentRequest(['foo'], buildDetails('shippingOptions', {'id': 'standard'}), {'requestShipping': true});
|
| + var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails('shippingOptions', {'id': 'standard'}), {'requestShipping': true});
|
| assert_equals('standard', request.shippingOption);
|
| }, 'Shipping option identifier should default to the single provided option.');
|
|
|
| test(function() {
|
| - var request = new PaymentRequest(['foo'], {'displayItems': [buildItem()]}, {'requestShipping': true});
|
| + var request = new PaymentRequest([{'supportedMethods': ['foo']}], {"displayItems": [buildItem()]}, {'requestShipping': true});
|
| assert_equals(null, request.shippingOption);
|
| }, 'Shipping option identifier should be null when no shipping options are provided.');
|
|
|
| test(function() {
|
| - var request = new PaymentRequest(['foo'], {'displayItems': [buildItem()], 'shippingOptions': [buildItem({'id': 'standard'}), buildItem({'id': 'express'})]}, {'requestShipping': true});
|
| + var request = new PaymentRequest([{'supportedMethods': ['foo']}], {'displayItems': [buildItem()], 'shippingOptions': [buildItem({'id': 'standard'}), buildItem({'id': 'express'})]}, {'requestShipping': true});
|
| assert_equals(null, request.shippingOption);
|
| }, 'Shipping option identifier should be null at first when multiple shipping options are provided.');
|
|
|
|
|
| generate_tests(assert_throws, [
|
| ['PaymentRequest constructor should throw for incorrect parameter types.', null, function() {
|
| - new PaymentRequest('', '', '', '')
|
| + new PaymentRequest('', '', '')
|
| }],
|
| ['PaymentRequest constructor should throw for undefined required parameters.', null, function() {
|
| new PaymentRequest(undefined, undefined)
|
| @@ -129,45 +129,37 @@ generate_tests(assert_throws, [
|
| ['Empty list of supported payment method identifiers should throw TypeError.', new TypeError(), function() {
|
| new PaymentRequest([], buildDetails())
|
| }],
|
| - ['Keys in payment method specific data object should match accepted method identifiers.', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(), {}, {'bar': {'gateway': 'baz'}})
|
| - }],
|
| ['Empty details should throw', null, function() {
|
| - new PaymentRequest(['foo'], {})
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], {})
|
| }],
|
| ['Empty items should throw', null, function() {
|
| - new PaymentRequest(['foo'], {'displayItems': []})
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], {'displayItems': []})
|
| }],
|
| ['Aborting before showing should throw.', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails()).abort()
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails()).abort()
|
| }],
|
|
|
| // Payment method specific data should be a JSON-serializable object.
|
| ['Array value for payment method specific data parameter should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(), {}, [])
|
| + new PaymentRequest([{'supportedMethods': ['foo'], 'data': []}], buildDetails())
|
| }],
|
| ['String value for payment method specific data parameter should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(), {}, 'foo')
|
| + new PaymentRequest([{'supportedMethods': ['foo'], 'data': 'foo'}], buildDetails())
|
| }],
|
| ['Numeric value for payment method specific data parameter should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(), {}, 42)
|
| + new PaymentRequest([{'supportedMethods': ['foo'], 'data': 42}], buildDetails())
|
| }],
|
| ['Infinite JSON value for one of the payment method specific data pieces should throw', null, function() {
|
| var infiniteData = {'foo': {}};
|
| infiniteData.foo = infiniteData;
|
| - new PaymentRequest(['foo'], buildDetails(), {}, infiniteData)
|
| - }],
|
| -
|
| - // Values in payment method specific data object should be JSON-serializable objects.
|
| - ['Array value for one of the payment method specific data pieces should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(), {}, {'foo': []})
|
| - }],
|
| - ['String value for one of the payment method specific data pieces should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(), {}, {'foo': 'bar'})
|
| + new PaymentRequest([{'supportedMethods': ['foo'], 'data': infiniteData}], buildDetails())
|
| }],
|
| - ['Numeric value for one of the payment method specific data pieces should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(), {}, {'foo': 42})
|
| + ['Null for payment method specific data parameter should throw', null, function() {
|
| + new PaymentRequest([{'supportedMethods': ['foo'], 'data': null}], buildDetails())
|
| }],
|
| + ['Empty string for payment method specific data parameter should throw', null, function() {
|
| + new PaymentRequest([{'supportedMethods': ['foo'], 'data': ''}], buildDetails())
|
| + }]
|
| ]);
|
|
|
| var detailNames = ['displayItems', 'shippingOptions'];
|
| @@ -175,69 +167,69 @@ for (var i in detailNames) {
|
| generate_tests(assert_throws, [
|
| // Invalid currency code formats.
|
| ['Invalid currency code US1 should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'currency': 'US1'}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'currency': 'US1'}))
|
| }],
|
| ['Invalid currency code US should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'currency': 'US'}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'currency': 'US'}))
|
| }],
|
| ['Invalid currency code USDO should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'currency': 'USDO'}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'currency': 'USDO'}))
|
| }],
|
| ['Invalid currency code usd should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'currency': 'usd'}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'currency': 'usd'}))
|
| }],
|
| ['Empty currency code should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'currency': ''}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'currency': ''}))
|
| }],
|
| ['Null currency code should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'currency': null}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'currency': null}))
|
| }],
|
| ['Undefined currency code should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'currency': undefined}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'currency': undefined}))
|
| }],
|
|
|
| // Invalid amount formats.
|
| ['Invalid amount "-" should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': '-'}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'value': '-'}))
|
| }],
|
| ['Invalid amount "notdigits" should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': 'notdigits'}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'value': 'notdigits'}))
|
| }],
|
| ['Invalid amount "ALSONOTDIGITS" should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': 'ALSONOTDIGITS'}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'value': 'ALSONOTDIGITS'}))
|
| }],
|
| ['Invalid amount "10." should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': '10.'}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'value': '10.'}))
|
| }],
|
| ['Invalid amount ".99" should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': '.99'}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'value': '.99'}))
|
| }],
|
| ['Invalid amount "-10." should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': '-10.'}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'value': '-10.'}))
|
| }],
|
| ['Invalid amount "-.99" should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': '-.99'}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'value': '-.99'}))
|
| }],
|
| ['Invalid amount "10-" should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': '10-'}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'value': '10-'}))
|
| }],
|
| ['Invalid amount "1-0" should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': '1-0'}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'value': '1-0'}))
|
| }],
|
| ['Invalid amount "1.0.0" should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': '1.0.0'}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'value': '1.0.0'}))
|
| }],
|
| ['Invalid amount "1/3" should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': '1/3'}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'value': '1/3'}))
|
| }],
|
| ['Empty amount should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': ''}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'value': ''}))
|
| }],
|
| ['Null amount should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': null}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'value': null}))
|
| }],
|
| ['Undefined amount should throw', null, function() {
|
| - new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': undefined}))
|
| + new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(detailNames[i], {'value': undefined}))
|
| }],
|
| ]);
|
| }
|
|
|