[Payment Request] Crash in PaymentRequest::canMakePayment() when Apple Pay payment...
[WebKit-https.git] / LayoutTests / http / tests / paymentrequest / payment-request-canmakepayment-method.https.html
index 74791c4..6f4e887 100644 (file)
@@ -10,7 +10,7 @@
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script>
-    const applePay = Object.freeze({
+const applePay = Object.freeze({
     supportedMethods: "https://apple.com/apple-pay",
     data: {
         version: 2,
         countryCode: "US",
     }
 });
+const invalidApplePay = Object.freeze({
+    supportedMethods: "https://apple.com/apple-pay",
+    data: {
+    }
+});
 const defaultMethods = Object.freeze([applePay]);
 const defaultDetails = Object.freeze({
   total: {
@@ -98,6 +103,11 @@ promise_test(async t => {
 }, `If payment method identifier and serialized parts are supported, resolve promise with true.`);
 
 promise_test(async t => {
+  const request = new PaymentRequest([invalidApplePay], defaultDetails);
+  assert_false(await request.canMakePayment(), "Apple Pay with invalid data should not be supported");
+}, `If a payment method identifier is supported but its serialized parts are not, resolve promise with false.`);
+
+promise_test(async t => {
   const unsupportedMethods = [
     "this-is-not-supported",
     "https://not.supported",