Skip to content

Commit

Permalink
[Payments] Clean up payment-request-interface.html slightly
Browse files Browse the repository at this point in the history
This file has a number of outdated tests:

Firstly, it tests some basic-card related functionality which is now
removed, so this CL deletes those tests.

Secondly, it attempts to check that show() and abort() don't need to
take parameters, but does so quite naively by just calling them with an
invalid PaymentRequest object and without a user activation. Since
external/wpt/payment-request/idlharness.https.window.html should test
the interface objects already (and in a safer fashion!), remove these
tests.

Bug: 1377056
Change-Id: I886e02d1ff036729f248819da24c543a6bcca22d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4039964
Reviewed-by: Rouslan Solomakhin <rouslan@chromium.org>
Auto-Submit: Stephen McGruer <smcgruer@chromium.org>
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1074078}
  • Loading branch information
stephenmcgruer authored and Chromium LUCI CQ committed Nov 21, 2022
1 parent ba20402 commit 7df534b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 181 deletions.

This file was deleted.

Expand Up @@ -100,18 +100,6 @@
assert_not_equals(request.show, undefined, 'PaymentRequest should have show() method.');
}, 'PaymentRequest should have methods abort() and show().');

test(function() {
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([{'supportedMethods': 'foo', 'data': {'foo': {'gateway': 'bar'}}}], buildDetails(), {'requestShipping': true});
request.show();
request.abort();
}, 'Valid data causes no errors.');

test(function() {
var request = new PaymentRequest([{'supportedMethods': 'foo'}], buildDetails('shippingOptions.0', {'id': 'standard'}));
assert_equals(null, request.shippingOption);
Expand Down Expand Up @@ -237,18 +225,6 @@
new PaymentRequest([{'supportedMethods': 'https://android.com/pay', 'data': {'environment': 'PRODUCTION', 'merchantName': 'Merchant Inc', 'merchantId': '123', 'allowedCardNetworks': ['AMEX', 'DISCOVER', 'MASTERCARD', 'VISA'], 'paymentMethodTokenizationParameters': {'tokenizationType': 'NETWORK_TOKEN', 'parameters': {'key': 'value'}}}}], buildDetails());
}, 'Android Pay parameters for produciton environment with network token should not throw.');

test(function() {
new PaymentRequest([{'supportedMethods': 'basic-card', 'data': {'supportedTypes': ['debit'], 'supportedNetworks': ['visa']}}], buildDetails());
}, 'Basic card parameters should not throw.');

test(function() {
new PaymentRequest([{'supportedMethods': 'basic-card', 'data': {'supportedTypes': [], 'supportedNetworks': []}}], buildDetails());
}, 'Empty basic card parameters should not throw.');

test(function() {
new PaymentRequest([{'supportedMethods': 'not-basic-card', 'data': {'supportedTypes': 0, 'supportedNetworks': 'foo'}}], buildDetails());
}, 'Invalid basic card parameters should not throw when method name is not "basic-card".');

test(function() {
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'}}}}], buildDetails());
}, 'Android Pay parameters for network token without environment key should not throw.');
Expand Down Expand Up @@ -345,9 +321,6 @@
}],
['Empty string for payment method specific data parameter should throw', TypeError, function() {
new PaymentRequest([{'supportedMethods': 'foo', 'data': ''}], buildDetails())
}],
['PaymentRequest constructor should throw for invalid "basic-card" parameters.', TypeError, function() {
new PaymentRequest([{'supportedMethods': 'basic-card', 'data': {'supportedTypes': 0, 'supportedNetworks': 'foo'}}], buildDetails())
}]
]);

Expand Down

0 comments on commit 7df534b

Please sign in to comment.