Commit ea9fc2f5 authored by Rouslan Solomakhin's avatar Rouslan Solomakhin Committed by moz-wptsync-bot
Browse files

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 <rouslan@chromium.org>
Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Reviewed-by: default avatarLiquan (Max) Gu <maxlg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#901845}

--

wpt-commits: 8e99531ef6ee1e3db50120b126bc07de682f1e0a
wpt-pr: 29669
parent c1f123ec
Loading
Loading
Loading
Loading
+147 −4
Original line number Diff line number Diff line
@@ -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.');
</script>