[Web Payment] Very long networkData byte array test.
This patch adds a test for JSON serialization of a very long networkData
byte array passed into PaymentRequest API.
Bug: 1110324, 1115091
Change-Id: I22418541b80205a58d1afc27595a95c7f84715db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2348540
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Reviewed-by: Nick Burris <nburris@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803831}
diff --git a/payment-request/secure-payment-confirmation.https.html b/payment-request/secure-payment-confirmation.https.html
index 539870b..64f5144 100644
--- a/payment-request/secure-payment-confirmation.https.html
+++ b/payment-request/secure-payment-confirmation.https.html
@@ -272,13 +272,30 @@
supportedMethods: 'secure-payment-confirmation',
data: {
action: 'authenticate',
- // Large instrumentId value.
- instrumentId: 'x'.repeat(1024 * 1024),
+ // Large credentialIds value.
+ credentialIds: [Uint8Array.from(
+ 'x'.repeat(1024 * 1024), c => c.charCodeAt(0))],
networkData: Uint8Array.from('x', c => c.charCodeAt(0)),
timeout: 60000,
fallbackUrl: 'https://fallback.example/url'
},
}], details);
});
-}, 'Large instrumentId value throws exception.');
+}, 'Large credentialIds value throws exception.');
+
+test(() => {
+ assert_throws_js(TypeError, () => {
+ new PaymentRequest([{
+ supportedMethods: 'secure-payment-confirmation',
+ data: {
+ action: 'authenticate',
+ credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))],
+ // Large networkData value.
+ networkData: Uint8Array.from('x'.repeat(1024 * 1024), c => c.charCodeAt(0)),
+ timeout: 60000,
+ fallbackUrl: 'https://fallback.example/url'
+ },
+ }], details);
+ });
+}, 'Large networkData value throws exception.');
</script>