mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-08 12:19:05 +02:00
Bug 1760210 [wpt PR 33158] - [SPC] Add iconMustBeShown option and a default instrument icon, a=testonly
Automatic update from web-platform-tests [SPC] Add iconMustBeShown option and a default instrument icon Implementation for the recent spec change[1] to add an iconMustBeShown option to the SPC API. This option, default true, can be set to false to allow the SPC flow to proceed with a default payment instrument icon when the input icon can't be downloaded or decoded. In this case, this implementation reuses an existing generic credit card vector icon used in other autofill UI. [1] https://github.com/w3c/secure-payment-confirmation/issues/125 Bug: 1298505 Change-Id: I336888d62951faa9a58652cf28fa2bcbac405e12 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3462491 Reviewed-by: Stephen McGruer <smcgruer@chromium.org> Reviewed-by: Ken Buchanan <kenrb@chromium.org> Commit-Queue: Nick Burris <nburris@chromium.org> Cr-Commit-Position: refs/heads/main@{#981649} -- wpt-commits: e2335f33e1bf19595f6b496a415aa0f275eab6ca wpt-pr: 33158
This commit is contained in:
parent
be5c052220
commit
112343814c
1 changed files with 41 additions and 0 deletions
|
|
@ -59,4 +59,45 @@ promise_test(async t => {
|
|||
}], PAYMENT_DETAILS);
|
||||
await promise_rejects_dom(t, "NotSupportedError", request.show());
|
||||
}, 'SPC authentication with an invalid icon');
|
||||
|
||||
promise_test(async t => {
|
||||
const authenticator = await window.test_driver.add_virtual_authenticator(
|
||||
AUTHENTICATOR_OPTS);
|
||||
t.add_cleanup(() => {
|
||||
return window.test_driver.remove_virtual_authenticator(authenticator);
|
||||
});
|
||||
|
||||
await window.test_driver.set_spc_transaction_mode("autoaccept");
|
||||
t.add_cleanup(() => {
|
||||
return window.test_driver.set_spc_transaction_mode("none");
|
||||
});
|
||||
|
||||
const credential = await createCredential();
|
||||
|
||||
const challenge = 'server challenge';
|
||||
const payeeOrigin = 'https://merchant.com';
|
||||
const displayName = 'Troycard ***1234';
|
||||
|
||||
let request = new PaymentRequest([{
|
||||
supportedMethods: 'secure-payment-confirmation',
|
||||
data: {
|
||||
credentialIds: [credential.rawId],
|
||||
challenge: Uint8Array.from(challenge, c => c.charCodeAt(0)),
|
||||
payeeOrigin,
|
||||
timeout: 60000,
|
||||
instrument: {
|
||||
displayName,
|
||||
icon: INVALID_ICON_URL,
|
||||
iconMustBeShown: false,
|
||||
},
|
||||
}
|
||||
}], PAYMENT_DETAILS);
|
||||
|
||||
const responsePromise = request.show();
|
||||
const response = await responsePromise;
|
||||
await response.complete('success');
|
||||
const cred = response.details;
|
||||
const clientDataJSON = JSON.parse(arrayBufferToString(cred.response.clientDataJSON));
|
||||
assert_equals(clientDataJSON.payment.instrument.icon, '');
|
||||
}, 'SPC authentication allowing an invalid icon with iconMustBeShown option.');
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue