From ea9fc2f5028e0d3f214ffefc63b5141d6caecb33 Mon Sep 17 00:00:00 2001 From: Rouslan Solomakhin Date: Sat, 17 Jul 2021 09:53:22 +0000 Subject: [PATCH] Bug 1720588 [wpt PR 29669] - [SPC] Enable SPC API V2 features., a=testonly Automatic update from web-platform-tests [SPC] Enable SPC API V2 features. This patch enables SecurePaymentConfirmationAPIV2 flag by default in M93. This flag controls a subset of features that are enabled by SecurePaymentConfirmation flag, which is in origin trial between M91 and M94. The changes in SecurePaymentConfirmationAPIV2 resulted from the initial feedback from origin trial partners. Blink-dev announcement: https://groups.google.com/a/chromium.org/g/blink-dev/c/6Dd00NJ-td8/m/iXX4YilWEwAJ Bug: 1210488 Change-Id: I80920c138b063b89682de2a5909bf88347bfd448 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3027027 Commit-Queue: Rouslan Solomakhin Reviewed-by: Matt Falkenhagen Reviewed-by: Liquan (Max) Gu Cr-Commit-Position: refs/heads/master@{#901845} -- wpt-commits: 8e99531ef6ee1e3db50120b126bc07de682f1e0a wpt-pr: 29669 --- ...cure-payment-confirmation.tentative.https.html} | 151 ++++++++++++++++++++- 1 file changed, 147 insertions(+), 4 deletions(-) rename testing/web-platform/tests/secure-payment-confirmation/{secure-payment-confirmation.tenative.https.html => secure-payment-confirmation.tentative.https.html} (62%) diff --git a/testing/web-platform/tests/secure-payment-confirmation/secure-payment-confirmation.tenative.https.html b/testing/web-platform/tests/secure-payment-confirmation/secure-payment-confirmation.tentative.https.html similarity index 62% rename from testing/web-platform/tests/secure-payment-confirmation/secure-payment-confirmation.tenative.https.html rename to testing/web-platform/tests/secure-payment-confirmation/secure-payment-confirmation.tentative.https.html index 93a3d17c993f..671f3287a6f9 100644 --- a/testing/web-platform/tests/secure-payment-confirmation/secure-payment-confirmation.tenative.https.html +++ b/testing/web-platform/tests/secure-payment-confirmation/secure-payment-confirmation.tentative.https.html @@ -19,7 +19,12 @@ test(() => { action: 'authenticate', credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), timeout: 60000, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details); }, 'Valid payment method data does not throw exceptions.'); @@ -31,7 +36,12 @@ test(() => { // Omitted action field. credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), timeout: 60000, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details); }, 'The action field is optional.'); @@ -43,7 +53,12 @@ test(() => { action: 'authenticate', credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), // Omitted timeout field. + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details); }, 'The timeout field is optional.'); @@ -56,7 +71,12 @@ test(() => { action: 'authenticate', credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), timeout: 60000, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }, {supportedMethods: 'basic-card'}], details); }); @@ -70,7 +90,12 @@ test(() => { action: 'authenticate', credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), timeout: 60000, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details); }); @@ -84,7 +109,12 @@ test(() => { action: 'authenticate', credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), timeout: 60000, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details, {requestShipping: true}); }); @@ -98,7 +128,12 @@ test(() => { action: 'authenticate', credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), timeout: 60000, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details, {requestPayerName: true}); }); @@ -112,7 +147,12 @@ test(() => { action: 'authenticate', credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), timeout: 60000, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details, {requestPayerEmail: true}); }); @@ -126,7 +166,12 @@ test(() => { action: 'authenticate', credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), timeout: 60000, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details, {requestPayerPhone: true}); }); @@ -141,7 +186,12 @@ test(() => { action: 'authorize', credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), timeout: 60000, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details); }); @@ -155,7 +205,12 @@ test(() => { action: 'authenticate', // Omitted credentialIds field. networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), timeout: 60000, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details); }); @@ -168,8 +223,12 @@ test(() => { data: { action: 'authenticate', credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], - // Omitted networkData field. + // Omitted networkData and challenge fields. timeout: 60000, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details); }); @@ -185,7 +244,12 @@ test(() => { // Empty credentialIds field. credentialIds: [], networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), timeout: 60000, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details); }); @@ -198,9 +262,14 @@ test(() => { data: { action: 'authenticate', credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], - // Null networkData field. + // Null networkData and challenge fields. networkData: null, + challenge: null, timeout: 60000, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details); }); @@ -213,9 +282,14 @@ test(() => { data: { action: 'authenticate', credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], - // Empty networkData field. + // Empty networkData and challenge fields. networkData: [], + challenge: [], timeout: 60000, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details); }); @@ -229,8 +303,13 @@ test(() => { action: 'authenticate', credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), // Timeout longer than 1 hour. timeout: 1000 * 60 * 60 + 1, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details); }); @@ -246,7 +325,12 @@ test(() => { credentialIds: [Uint8Array.from( 'x'.repeat(1024 * 1024), c => c.charCodeAt(0))], networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), timeout: 60000, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details); }); @@ -259,11 +343,70 @@ test(() => { data: { action: 'authenticate', credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], - // Large networkData value. + // Large networkData and challenge values. networkData: Uint8Array.from('x'.repeat(1024 * 1024), c => c.charCodeAt(0)), + challenge: Uint8Array.from('x'.repeat(1024 * 1024), c => c.charCodeAt(0)), timeout: 60000, + instrument: { + displayName: 'X', + icon: 'https://example.test/icon.png', + }, }, }], details); }); }, 'Large networkData 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))], + networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), + timeout: 60000, + // Omitted instrument field. + }, + }], details); + }); +}, 'Instrument field is required.'); + +test(() => { + assert_throws_js(TypeError, () => { + new PaymentRequest([{ + supportedMethods: 'secure-payment-confirmation', + data: { + action: 'authenticate', + credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], + networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), + timeout: 60000, + instrument: { + // Ommitted instrument display name. + icon: 'https://example.test/icon.png', + }, + }, + }], details); + }); +}, 'Instrument display name is required.'); + +test(() => { + assert_throws_js(TypeError, () => { + new PaymentRequest([{ + supportedMethods: 'secure-payment-confirmation', + data: { + action: 'authenticate', + credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))], + networkData: Uint8Array.from('x', c => c.charCodeAt(0)), + challenge: Uint8Array.from('x', c => c.charCodeAt(0)), + timeout: 60000, + instrument: { + displayName: 'X', + // Ommitted instrument icon. + }, + }, + }], details); + }); +}, 'Instrument icon is required.'); -- 2.11.4.GIT