Commit 570e6380 authored by Rouslan Solomakhin's avatar Rouslan Solomakhin Committed by Commit Bot

[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: default avatarNick Burris <nburris@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803831}
parent 1849bb71
...@@ -272,13 +272,30 @@ test(() => { ...@@ -272,13 +272,30 @@ test(() => {
supportedMethods: 'secure-payment-confirmation', supportedMethods: 'secure-payment-confirmation',
data: { data: {
action: 'authenticate', action: 'authenticate',
// Large instrumentId value. // Large credentialIds value.
instrumentId: 'x'.repeat(1024 * 1024), credentialIds: [Uint8Array.from(
'x'.repeat(1024 * 1024), c => c.charCodeAt(0))],
networkData: Uint8Array.from('x', c => c.charCodeAt(0)), networkData: Uint8Array.from('x', c => c.charCodeAt(0)),
timeout: 60000, timeout: 60000,
fallbackUrl: 'https://fallback.example/url' fallbackUrl: 'https://fallback.example/url'
}, },
}], details); }], 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> </script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment