WebKit Bugzilla
Attachment 348157 Details for
Bug 188985
: [Payment Request] Update payment-request web platform tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188985-20180827102742.patch (text/plain), 157.64 KB, created by
Andy Estes
on 2018-08-27 10:27:43 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Andy Estes
Created:
2018-08-27 10:27:43 PDT
Size:
157.64 KB
patch
obsolete
>Subversion Revision: 235367 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index cd12c8d77fabcb9d392c865c33ce6e3cac11d54c..add8a60b8f4fc03f826a58d06a02146343cbcca8 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,12 @@ >+2018-08-27 Andy Estes <aestes@apple.com> >+ >+ [Payment Request] Update payment-request web platform tests >+ https://bugs.webkit.org/show_bug.cgi?id=188985 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * platform/mac-wk2/TestExpectations: >+ > 2018-08-27 Per Arne Vollan <pvollan@apple.com> > > Layout Test fast/events/dblclick-event-getModifierState.html is failing >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index ed33a5fd8ceda1ff94d34ace8ec4a5e4b233eee0..93e44f1f4d5c67c4e263775e0b08c57ed25719b8 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,77 @@ >+2018-08-27 Andy Estes <aestes@apple.com> >+ >+ [Payment Request] Update payment-request web platform tests >+ https://bugs.webkit.org/show_bug.cgi?id=188985 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * web-platform-tests/payment-request/META.yml: Added. >+ * web-platform-tests/payment-request/OWNERS: Removed. >+ * web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html: >+ * web-platform-tests/payment-request/PaymentAddress/w3c-import.log: >+ * web-platform-tests/payment-request/PaymentItem/type_member.https-expected.txt: Added. >+ * web-platform-tests/payment-request/PaymentItem/type_member.https.html: Added. >+ * web-platform-tests/payment-request/PaymentItem/w3c-import.log: Copied from LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/w3c-import.log. >+ * web-platform-tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https-expected.txt: Added. >+ * web-platform-tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https.html: Added. >+ * web-platform-tests/payment-request/PaymentMethodChangeEvent/methodName-attribute.https-expected.txt: Added. >+ * web-platform-tests/payment-request/PaymentMethodChangeEvent/methodName-attribute.https.html: Added. >+ * web-platform-tests/payment-request/PaymentMethodChangeEvent/w3c-import.log: Copied from LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/w3c-import.log. >+ * web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html: Added. >+ * web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html: Added. >+ * web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-shippingAddress-member-manual.https.html: Added. >+ * web-platform-tests/payment-request/PaymentValidationErrors/w3c-import.log: Copied from LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/w3c-import.log. >+ * web-platform-tests/payment-request/algorithms-manual.https.html: >+ * web-platform-tests/payment-request/allowpaymentrequest/w3c-import.log: >+ * web-platform-tests/payment-request/change-shipping-option-manual.https.html: >+ * web-platform-tests/payment-request/change-shipping-option-select-last-manual.https.html: Added. >+ * web-platform-tests/payment-request/idlharness.https.window-expected.txt: Added. >+ * web-platform-tests/payment-request/idlharness.https.window.html: Added. >+ * web-platform-tests/payment-request/idlharness.https.window.js: Added. >+ (idlArray.catch): >+ * web-platform-tests/payment-request/interfaces.https-expected.txt: Removed. >+ * web-platform-tests/payment-request/interfaces.https.html: Removed. >+ * web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https-expected.txt: Added. >+ * web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https.html: Added. >+ * web-platform-tests/payment-request/payment-request-abort-method-manual.https-expected.txt: Removed. >+ * web-platform-tests/payment-request/payment-request-abort-method.https-expected.txt: Added. >+ * web-platform-tests/payment-request/payment-request-abort-method.https.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method-manual.https.html. >+ * web-platform-tests/payment-request/payment-request-canmakepayment-method.https-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-manual.https-expected.txt. >+ * web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-manual.https.html. >+ * web-platform-tests/payment-request/payment-request-insecure.http-expected.txt: Added. >+ * web-platform-tests/payment-request/payment-request-insecure.http.html: Added. >+ * web-platform-tests/payment-request/payment-request-not-exposed.https.worker-expected.txt: Added. >+ * web-platform-tests/payment-request/payment-request-not-exposed.https.worker.html: Added. >+ * web-platform-tests/payment-request/payment-request-not-exposed.https.worker.js: Added. >+ (test): >+ * web-platform-tests/payment-request/payment-request-show-method.https.html: >+ * web-platform-tests/payment-request/payment-response/complete-method-manual.https.html: >+ * web-platform-tests/payment-request/payment-response/helpers.js: >+ (async.getPaymentResponse): >+ * web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html: >+ * web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.https-expected.txt: Added. >+ * web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.https.html: Added. >+ * web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.manual.https.html: Added. >+ * web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html: >+ * web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html: >+ * web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html: >+ * web-platform-tests/payment-request/payment-response/rejects_if_not_active-manual.https.html: Added. >+ * web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html: >+ * web-platform-tests/payment-request/payment-response/retry-method-manual.https.html: Added. >+ * web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html: >+ * web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html: >+ * web-platform-tests/payment-request/payment-response/w3c-import.log: >+ * web-platform-tests/payment-request/resources/w3c-import.log: >+ * web-platform-tests/payment-request/shipping-address-changed-manual.https.html: >+ * web-platform-tests/payment-request/show-method-optional-promise-rejects-manual.https.html: Added. >+ * web-platform-tests/payment-request/show-method-optional-promise-resolves-manual.https.html: Added. >+ * web-platform-tests/payment-request/show-method-postmessage-iframe.html: Added. >+ * web-platform-tests/payment-request/show-method-postmessage-manual.https.html: Added. >+ * web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html: >+ * web-platform-tests/payment-request/user-abort-algorithm-manual.https.html: >+ * web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html: >+ * web-platform-tests/payment-request/w3c-import.log: >+ > 2018-08-27 Rob Buis <rbuis@igalia.com> > > XMLHTTPRequest.send for Document should have same Content-Type processing rules as String >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/META.yml b/LayoutTests/imported/w3c/web-platform-tests/payment-request/META.yml >new file mode 100644 >index 0000000000000000000000000000000000000000..f8460d403ffa42d9dfc1bae6e0c3e500f7742fc9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/META.yml >@@ -0,0 +1,8 @@ >+spec: https://w3c.github.io/payment-request/ >+suggested_reviewers: >+ - marcoscaceres >+ - rsolomakhin >+ - domenic >+ - MSFTkihans >+ - mnoorenberghe >+ - romandev >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/OWNERS b/LayoutTests/imported/w3c/web-platform-tests/payment-request/OWNERS >deleted file mode 100644 >index 7f3eca71150c9fe8ca71ba68e00f68cec4daef1d..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/OWNERS >+++ /dev/null >@@ -1,6 +0,0 @@ >-@marcoscaceres >-@rsolomakhin >-@domenic >-@MSFTkihans >-@mnoorenberghe >-@edenchuang >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html >index 3925cdd81e6aed5d19c520c68bac17466c437976..65d56e7490111f6fc9e91f4470379fc89ae42972 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html >@@ -68,7 +68,7 @@ function runManualTest(button, expected = {}) { > <button onclick=" > const expectedAddress = { > country: 'AU', >- regionCode: 'AU-QLD', >+ regionCode: 'QLD', > addressLine: '55 test st', > city: 'Chapel Hill', > dependentLocality: '', >@@ -90,8 +90,10 @@ function runManualTest(button, expected = {}) { > <dd>55 test st</dd> > <dt>Country</dt> > <dd>Australia</dd> >- <dt>Suburb</dt> >+ <dt>City</dt> > <dd>Chapel Hill</dd> >+ <dd>State/Region</dd> >+ <dd>Queensland</dd> > <dt>postal code </dt> > <dd>6095</dd> > <dt>organization</dt> >@@ -102,6 +104,6 @@ function runManualTest(button, expected = {}) { > </li> > </ol> > <small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. > </small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/w3c-import.log >index 8ccdd3931bd37f3e1b45d53c2bfe2ccc832107df..4d9043c2812a09702a8fe37f0cba3d9cd3503833 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentItem/type_member.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentItem/type_member.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e6b02017170325ef29703ae2427db5bcdc00925b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentItem/type_member.https-expected.txt >@@ -0,0 +1,10 @@ >+ >+PASS Smoke test >+FAIL An invalid enum value for PaymentDetailsInit.total's type throws TypeError assert_throws: function "() => { >+ new PaymentRequest(validMethods, invalidDetails); >+ }" did not throw >+FAIL Invalid enum value for PaymentItem.type member throws a TypeError assert_throws: function "() => { >+ new PaymentRequest(validMethods, invalidDetails); >+ }" did not throw >+PASS Valid enum values for PaymentItem.type member does not throw >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentItem/type_member.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentItem/type_member.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..dc62a83f597a0b53c686689fb8f549130982242a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentItem/type_member.https.html >@@ -0,0 +1,77 @@ >+<!doctype html> >+<meta charset="utf8"> >+<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentitem-type"> >+<title> >+ PaymentItem type member >+</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+const validMethods = [ >+ { supportedMethods: "basic-card" }, >+ { supportedMethods: "https://apple.com/apple-pay" }, >+]; >+const validTotal = { >+ label: "Total", >+ amount: { >+ currency: "USD", >+ value: "5.00", >+ }, >+}; >+const validDisplayItem = { >+ label: "Item", >+ amount: { >+ currency: "USD", >+ value: "1.00", >+ }, >+}; >+const validDetails = { >+ total: validTotal, >+ displayItems: [validDisplayItem], >+}; >+ >+test(() => { >+ new PaymentRequest(validMethods, validDetails); >+}, "Smoke test"); >+ >+test(() => { >+ // Let's make an invalid DisplayItem for the total >+ const invalidTotal = Object.assign({}, validTotal, { >+ type: "this is not valid", >+ }); >+ const invalidDetails = Object.assign({}, validDetails, { >+ total: invalidTotal, >+ }); >+ assert_throws(new TypeError(), () => { >+ new PaymentRequest(validMethods, invalidDetails); >+ }); >+}, "An invalid enum value for PaymentDetailsInit.total's type throws TypeError"); >+ >+test(() => { >+ // Let's make an invalid DisplayItem to add to displayItems >+ const invalidDisplayItem = Object.assign({}, validDisplayItem, { >+ type: "this is not valid", >+ }); >+ const invalidDetails = Object.assign({}, validDetails, { >+ displayItems: [invalidDisplayItem, validDisplayItem], >+ }); >+ assert_throws(new TypeError(), () => { >+ new PaymentRequest(validMethods, invalidDetails); >+ }); >+}, "Invalid enum value for PaymentItem.type member throws a TypeError"); >+ >+test(() => { >+ // Let's make an invalid DisplayItem to add to displayItems >+ const taxDisplayItem = Object.assign({}, validDisplayItem, { type: "tax" }); >+ const taxTotal = Object.assign({}, validTotal, { type: "tax" }); >+ const validDetailsWithType = Object.assign({}, validDetails, { >+ total: taxTotal, >+ displayItems: [taxDisplayItem], >+ }); >+ try { >+ new PaymentRequest(validMethods, validDetailsWithType); >+ } catch (err) { >+ assert_unexpected(err.message); >+ } >+}, "Valid enum values for PaymentItem.type member does not throw"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentItem/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentItem/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..fc269594a740f67fc8d756a26562290286397e9b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentItem/w3c-import.log >@@ -0,0 +1,17 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentItem/type_member.https.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..71d1b491e69e7f10bc5013f0f9a7a94f09571233 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https-expected.txt >@@ -0,0 +1,3 @@ >+ >+FAIL Must have a methodDetails IDL attribute, which is initialized with to the methodName dictionary value Can't find variable: PaymentMethodChangeEvent >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a478c559d497e8dea9d471ce1e36427bfb741aa7 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https.html >@@ -0,0 +1,22 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>Test for PaymentMethodChangeEvent.methodDetails attribute</title> >+<link rel="help" href="https://w3c.github.io/browser-payment-api/#dom-paymentmethodchangeevent-methoddetails"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+"use strict"; >+test(() => { >+ const methodDetails = { >+ test: "pass" >+ } >+ const event = new PaymentMethodChangeEvent("test", { >+ methodName: "wpt-test", >+ methodDetails >+ }); >+ assert_idl_attribute(event, "methodDetails"); >+ const { test } = event.methodDetails; >+ assert_equals(test, "pass"); >+ assert_equals(event.methodDetails, methodDetails); >+}, "Must have a methodDetails IDL attribute, which is initialized with to the methodName dictionary value"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodName-attribute.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodName-attribute.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2dd6080759cee8234eff0fce559292bbd03c15cf >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodName-attribute.https-expected.txt >@@ -0,0 +1,3 @@ >+ >+FAIL Must have a methodName IDL attribute, which is initialized with to the methodName dictionary value Can't find variable: PaymentMethodChangeEvent >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodName-attribute.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodName-attribute.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e6e0bf9a91971b3a20acf59cf27097281f0d2085 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodName-attribute.https.html >@@ -0,0 +1,17 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>Test for PaymentMethodChangeEvent.methodName attribute</title> >+<link rel="help" href="https://w3c.github.io/browser-payment-api/#dom-paymentmethodchangeevent-src"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+"use strict"; >+test(() => { >+ const event = new PaymentMethodChangeEvent("test", { >+ methodName: "wpt-test", >+ }); >+ assert_idl_attribute(event, "methodName"); >+ const { methodName } = event; >+ assert_equals(methodName, "wpt-test"); >+}, "Must have a methodName IDL attribute, which is initialized with to the methodName dictionary value"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..dd5f25180a6b116610295904ed115cae9f106a63 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/w3c-import.log >@@ -0,0 +1,18 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodName-attribute.https.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..b3a539ef8f4b8aa9dd9a3ed0cb6b527f184cb04f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html >@@ -0,0 +1,50 @@ >+<!doctype html> >+<meta charset="utf8"> >+<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentvalidationerrors-error"> >+<title> >+ PaymentValidationErrors' `error` member >+</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="../payment-response/helpers.js"></script> >+<script> >+function retryShowsErrorMember(button) { >+ button.disabled = true; >+ promise_test(async t => { >+ const { response } = await getPaymentRequestResponse(); >+ await response.retry({ error: "PASS" }); >+ await response.complete("success"); >+ }, button.textContent.trim()); >+} >+</script> >+<h2> >+ Manual Test for PaymentValidationErrors's `error` member - Please run in order! >+</h2> >+<p> >+ Click on each button in sequence from top to bottom without refreshing the page. >+ Each button will bring up the Payment Request UI window. >+</p> >+<p> >+ When presented with the payment sheet, use any card and select to "Pay". >+ You will be asked to retry the payment and an error should be shown somewhere >+ in the UI. The expected error string is described in each individual test. >+ If you see the error, hit "Pay" again. If you don't see the error, >+ abort the payment request by hitting "esc" - which means that particular test >+ has failed. >+</p> >+<ol> >+ <li> >+ <button onclick="retryShowsErrorMember(this);"> >+ The payment sheet shows the error "PASS" somewhere in the UI. >+ </button> >+ </li> >+ <li> >+ <button onclick="done();"> >+ Done! >+ </button> >+ </li> >+</ol> >+<small> >+ If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+</small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8dbc760fd07fe990b8bbded56ffca59091492fd8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html >@@ -0,0 +1,65 @@ >+<!doctype html> >+<meta charset="utf8"> >+<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentvalidationerrors-payer"> >+<title> >+ PaymentValidationErrors' `payer` member >+</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="../payment-response/helpers.js"></script> >+<script> >+function retryShowsPayerMember(button, error) { >+ button.disabled = true; >+ promise_test(async t => { >+ const options = { >+ requestPayerName: true, >+ requestPayerEmail: true, >+ requestPayerPhone: true, >+ } >+ const { response } = await getPaymentRequestResponse(options); >+ await response.retry({ payer: error }); >+ await response.complete("success"); >+ }, button.textContent.trim()); >+} >+</script> >+<h2> >+ Manual Test for PaymentValidationErrors' `payer` member - Please run in order! >+</h2> >+<p> >+ Click on each button in sequence from top to bottom without refreshing the page. >+ Each button will bring up the Payment Request UI window. >+</p> >+<p> >+ When presented with the payment sheet, use any card and select to "Pay". >+ You will be asked to retry the payment and an error should be shown somewhere >+ in the UI. The expected error string is described in each individual test. >+ If you see the error, hit "Pay" again. If you don't see the error, >+ abort the payment request by hitting "esc" - which means that particular test >+ has failed. >+</p> >+<ol> >+ <li> >+ <button onclick="retryShowsPayerMember(this, { email: 'EMAIL ERROR' });"> >+ The payment sheet shows "EMAIL ERROR" for the payer's email. >+ </button> >+ </li> >+ <li> >+ <button onclick="retryShowsPayerMember(this, { name: 'NAME ERROR' });"> >+ The payment sheet shows "NAME ERROR" for the payer's name. >+ </button> >+ </li> >+ <li> >+ <button onclick="retryShowsPayerMember(this, { phone: 'PHONE ERROR' });"> >+ The payment sheet shows "PHONE ERROR" for the payer's phone number. >+ </button> >+ </li> >+ <li> >+ <button onclick="done();"> >+ Done! >+ </button> >+ </li> >+</ol> >+<small> >+ If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+</small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-shippingAddress-member-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-shippingAddress-member-manual.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..cdc8d353a9b458b123dd2598ed34553a30dc4f23 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-shippingAddress-member-manual.https.html >@@ -0,0 +1,108 @@ >+<!doctype html> >+<meta charset="utf8"> >+<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentvalidationerrors-shippingaddress"> >+<title> >+ PaymentValidationErrors' `shippingAddress` member (AddressErrors) >+</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="../payment-response/helpers.js"></script> >+<script> >+function retryShowsShippingAddressMember(button, error) { >+ button.disabled = true; >+ promise_test(async t => { >+ const options = { >+ requestShipping: true, >+ } >+ const { response } = await getPaymentRequestResponse(options); >+ await response.retry({ shippingAddress: error }); >+ await response.complete("success"); >+ }, button.textContent.trim()); >+} >+</script> >+<h2> >+ Manual Test for PaymentValidationErrors' `shippingAddress` member - Please run in order! >+</h2> >+<p> >+ Click on each button in sequence from top to bottom without refreshing the page. >+ Each button will bring up the Payment Request UI window. >+</p> >+<p> >+ When presented with the payment sheet, use any card and select to "Pay". >+ You will be asked to retry the payment and an error should be shown somewhere >+ in the UI. The expected error string is described in each individual test. >+ If you see the error, hit "Pay" again. If you don't see the error, >+ abort the payment request by hitting "esc" - which means that particular test >+ has failed. >+</p> >+<ol> >+ <li> >+ <button onclick="retryShowsShippingAddressMember(this, { addressLine: 'ADDRESSLINE ERROR' });"> >+ The payment sheet shows "ADDRESSLINE ERROR" for the shipping address' addressLine. >+ </button> >+ </li> >+ <li> >+ <button onclick="retryShowsShippingAddressMember(this, { city: 'CITY ERROR' });"> >+ The payment sheet shows "CITY ERROR" for the shipping address' city. >+ </button> >+ </li> >+ <li> >+ <button onclick="retryShowsShippingAddressMember(this, { country: 'COUNTRY ERROR' });"> >+ The payment sheet shows "COUNTRY ERROR" for the shipping address' country. >+ </button> >+ </li> >+ <li> >+ <button onclick="retryShowsShippingAddressMember(this, { dependentLocality: 'DEPENDENTLOCALITY ERROR' });"> >+ The payment sheet shows "DEPENDENTLOCALITY ERROR" for the shipping address' dependentLocality. >+ </button> >+ </li> >+ <li> >+ <button onclick="retryShowsShippingAddressMember(this, { languageCode: 'LANGUAGECODE ERROR' });"> >+ The payment sheet shows "LANGUAGECODE ERROR" for the shipping address' languageCode. >+ </button> >+ </li> >+ <li> >+ <button onclick="retryShowsShippingAddressMember(this, { organization: 'ORGANIZATION ERROR' });"> >+ The payment sheet shows "ORGANIZATION ERROR" for the shipping address' organization. >+ </button> >+ </li> >+ <li> >+ <button onclick="retryShowsShippingAddressMember(this, { phone: 'PHONE ERROR' });"> >+ The payment sheet shows "PHONE ERROR" for the shipping address' phone. >+ </button> >+ </li> >+ <li> >+ <button onclick="retryShowsShippingAddressMember(this, { postalCode: 'POSTALCODE ERROR' });"> >+ The payment sheet shows "POSTALCODE ERROR" for the shipping address' postal code. >+ </button> >+ </li> >+ <li> >+ <button onclick="retryShowsShippingAddressMember(this, { recipient: 'RECIPIENT ERROR' });"> >+ The payment sheet shows "RECIPIENT ERROR" for the shipping address' recipient. >+ </button> >+ </li> >+ <li> >+ <button onclick="retryShowsShippingAddressMember(this, { region: 'REGION ERROR' });"> >+ The payment sheet shows "REGION ERROR" for the shipping address' region. >+ </button> >+ </li> >+ <li> >+ <button onclick="retryShowsShippingAddressMember(this, { regionCode: 'REGIONCODE ERROR' });"> >+ The payment sheet shows "REGIONCODE ERROR" for the shipping address' region code. >+ </button> >+ </li> >+ <li> >+ <button onclick="retryShowsShippingAddressMember(this, { sortingCode: 'SORTINGCODE ERROR' });"> >+ The payment sheet shows "SORTINGCODE ERROR" for the shipping address' sorting code. >+ </button> >+ </li> >+ <li> >+ <button onclick="done();"> >+ Done! >+ </button> >+ </li> >+</ol> >+<small> >+ If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+</small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..948c4f5fb7dfcb0abff1a23b24df4d44dc2adfc8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/w3c-import.log >@@ -0,0 +1,19 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-shippingAddress-member-manual.https.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html >index 2e4140ae0d628cdc7c06d8883add0c42c8679fd4..5494353c6bceb4ed0d388852bd7f426e5715186d 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html >@@ -161,6 +161,6 @@ async function runAbortTest(button) { > </section> > > <small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. > </small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/w3c-import.log >index 4f0acc0e4c3eefe82d4cedc62db8bc750f662253..632f466af7cbc9778ddc1aab3ca64dd4d57dd2cd 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html >index eefc45f29210ca2f6e81df19b5ab0adc61460199..a33365bac73ed51b6873215d0f54d79a73422163 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html >@@ -89,6 +89,6 @@ function testShippingOptionChanged() { > </li> > </ol> > <small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. > </small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-select-last-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-select-last-manual.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..f08491150ac7ee6d69520a936eb2868d60393c57 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-select-last-manual.https.html >@@ -0,0 +1,92 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>Test for PaymentDetailsBase's shippingOptions member</title> >+<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentdetailsbase-shippingoptions"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+setup({ explicit_done: true, explicit_timeout: true }); >+const validMethods = Object.freeze([ >+ { supportedMethods: "basic-card" }, >+ { supportedMethods: "https://apple.com/apple-pay" }, >+]); >+const validAmount = Object.freeze({ currency: "USD", value: "5.00" }); >+const validTotal = Object.freeze({ >+ label: "label", >+ amount: validAmount, >+}); >+const validDetails = Object.freeze({ total: validTotal }); >+ >+const validShippingOption1 = Object.freeze({ >+ id: "fail-if-selected-1", >+ label: "FAIL if selected 1", >+ amount: validAmount, >+ selected: true, >+}); >+ >+const validShippingOption2 = Object.freeze({ >+ id: "fail-if-selected-2", >+ label: "FAIL if selected 2", >+ amount: validAmount, >+ selected: false, >+}); >+ >+const validShippingOption3 = Object.freeze({ >+ id: "pass-if-selected", >+ label: "THIS MUST BE AUTOMATICALLY SELECTED", >+ amount: validAmount, >+ selected: true, >+}); >+ >+function testShippingOptionChanged(button) { >+ button.disabled = true; >+ promise_test(async t => { >+ const detailsWithShippingOptions = { >+ ...validDetails, >+ shippingOptions: [ >+ validShippingOption1, >+ validShippingOption2, >+ validShippingOption3, >+ ], >+ }; >+ const request = new PaymentRequest( >+ validMethods, >+ detailsWithShippingOptions, >+ { requestShipping: true } >+ ); >+ assert_equals( >+ request.shippingOption, >+ "pass-if-selected", >+ "Must be 'pass-if-selected', as the selected member is true" >+ ); >+ request.onshippingoptionchange = () => { >+ assert_unreached("onshippingoptionchange fired unexpectedly"); >+ }; >+ const response = await request.show(); >+ assert_equals(response.shippingOption, "pass-if-selected"); >+ response.complete(); >+ }, button.textContent.trim()); >+ done(); >+} >+</script> >+ >+<h2>PaymentRequest shippingOption attribute</h2> >+<p> >+ Click on each button in sequence from top to bottom without refreshing the page. >+ Each button will bring up the Payment Request UI window. >+</p> >+<p> >+ When the payment sheet is presented, hit pay. >+</p> >+<ol> >+ <li> >+ <button onclick="testShippingOptionChanged(this)"> >+ When default shipping option is pre-selected, must not fire onshippingoptionchange >+ and PaymentResponse must reflect the pre-selected option. >+ </button> >+ </li> >+</ol> >+<small> >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. >+</small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/idlharness.https.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/payment-request/idlharness.https.window-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..0b7fee05acb0bd1e2990450bf1b8ee2d72e3b1ee >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/idlharness.https.window-expected.txt >@@ -0,0 +1,4 @@ >+CONSOLE MESSAGE: line 8: ReferenceError: Can't find variable: idl_test >+ >+FAIL Untitled ReferenceError: Can't find variable: idl_test >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/idlharness.https.window.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/idlharness.https.window.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/idlharness.https.window.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/idlharness.https.window.js b/LayoutTests/imported/w3c/web-platform-tests/payment-request/idlharness.https.window.js >new file mode 100644 >index 0000000000000000000000000000000000000000..9a068c6d27f86a63d160b47b09a2116d5479ac72 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/idlharness.https.window.js >@@ -0,0 +1,30 @@ >+// META: script=/resources/WebIDLParser.js >+// META: script=/resources/idlharness.js >+ >+'use strict'; >+ >+// https://w3c.github.io/payment-request/ >+ >+idl_test( >+ ['payment-request'], >+ ['dom', 'html'], >+ idlArray => { >+ try { >+ const methods = [ >+ {supportedMethods: 'basic-card'}, >+ {supportedMethods: 'https://apple.com/apple-pay'}, >+ ]; >+ const amount = {currency: 'USD', value: '0'}; >+ const details = {total: {label: 'label', amount: amount} }; >+ window.paymentRequest = new PaymentRequest(methods, details); >+ } catch (e) { >+ // Surfaced below when paymentRequest is undefined. >+ } >+ >+ idlArray.add_objects({ >+ PaymentRequest: ['paymentRequest'], >+ PaymentMethodChangeEvent: ['new PaymentMethodChangeEvent("paymentmethodchange")'], >+ PaymentRequestUpdateEvent: ['new PaymentRequestUpdateEvent("paymentrequestupdate")'], >+ }); >+ } >+); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/interfaces.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/payment-request/interfaces.https-expected.txt >deleted file mode 100644 >index 6aaf39d0d967e4c98b3f8d51265ac67f30a3d372..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/interfaces.https-expected.txt >+++ /dev/null >@@ -1,106 +0,0 @@ >-CONSOLE MESSAGE: line 331: callback not yet supported >-CONSOLE MESSAGE: line 331: callback not yet supported >- >-PASS Setup for Payment Request API IDL tests. >-PASS PaymentRequest interface: existence and properties of interface object >-PASS PaymentRequest interface object length >-PASS PaymentRequest interface object name >-PASS PaymentRequest interface: existence and properties of interface prototype object >-PASS PaymentRequest interface: existence and properties of interface prototype object's "constructor" property >-PASS PaymentRequest interface: existence and properties of interface prototype object's @@unscopables property >-PASS PaymentRequest interface: operation show() >-PASS Unscopable handled correctly for show() on PaymentRequest >-PASS PaymentRequest interface: operation abort() >-PASS Unscopable handled correctly for abort() on PaymentRequest >-PASS PaymentRequest interface: operation canMakePayment() >-PASS Unscopable handled correctly for canMakePayment() on PaymentRequest >-PASS PaymentRequest interface: attribute id >-PASS Unscopable handled correctly for id property on PaymentRequest >-PASS PaymentRequest interface: attribute shippingAddress >-PASS Unscopable handled correctly for shippingAddress property on PaymentRequest >-PASS PaymentRequest interface: attribute shippingOption >-PASS Unscopable handled correctly for shippingOption property on PaymentRequest >-PASS PaymentRequest interface: attribute shippingType >-PASS Unscopable handled correctly for shippingType property on PaymentRequest >-PASS PaymentRequest interface: attribute onshippingaddresschange >-PASS Unscopable handled correctly for onshippingaddresschange property on PaymentRequest >-PASS PaymentRequest interface: attribute onshippingoptionchange >-PASS Unscopable handled correctly for onshippingoptionchange property on PaymentRequest >-PASS PaymentRequest must be primary interface of new PaymentRequest([{supportedMethods: 'foo'}], {total: {label: 'bar', amount: {currency: 'USD', value: '0'}} }) >-PASS Stringification of new PaymentRequest([{supportedMethods: 'foo'}], {total: {label: 'bar', amount: {currency: 'USD', value: '0'}} }) >-PASS PaymentRequest interface: new PaymentRequest([{supportedMethods: 'foo'}], {total: {label: 'bar', amount: {currency: 'USD', value: '0'}} }) must inherit property "show()" with the proper type >-PASS PaymentRequest interface: new PaymentRequest([{supportedMethods: 'foo'}], {total: {label: 'bar', amount: {currency: 'USD', value: '0'}} }) must inherit property "abort()" with the proper type >-PASS PaymentRequest interface: new PaymentRequest([{supportedMethods: 'foo'}], {total: {label: 'bar', amount: {currency: 'USD', value: '0'}} }) must inherit property "canMakePayment()" with the proper type >-PASS PaymentRequest interface: new PaymentRequest([{supportedMethods: 'foo'}], {total: {label: 'bar', amount: {currency: 'USD', value: '0'}} }) must inherit property "id" with the proper type >-PASS PaymentRequest interface: new PaymentRequest([{supportedMethods: 'foo'}], {total: {label: 'bar', amount: {currency: 'USD', value: '0'}} }) must inherit property "shippingAddress" with the proper type >-PASS PaymentRequest interface: new PaymentRequest([{supportedMethods: 'foo'}], {total: {label: 'bar', amount: {currency: 'USD', value: '0'}} }) must inherit property "shippingOption" with the proper type >-PASS PaymentRequest interface: new PaymentRequest([{supportedMethods: 'foo'}], {total: {label: 'bar', amount: {currency: 'USD', value: '0'}} }) must inherit property "shippingType" with the proper type >-PASS PaymentRequest interface: new PaymentRequest([{supportedMethods: 'foo'}], {total: {label: 'bar', amount: {currency: 'USD', value: '0'}} }) must inherit property "onshippingaddresschange" with the proper type >-PASS PaymentRequest interface: new PaymentRequest([{supportedMethods: 'foo'}], {total: {label: 'bar', amount: {currency: 'USD', value: '0'}} }) must inherit property "onshippingoptionchange" with the proper type >-PASS PaymentAddress interface: existence and properties of interface object >-PASS PaymentAddress interface object length >-PASS PaymentAddress interface object name >-PASS PaymentAddress interface: existence and properties of interface prototype object >-PASS PaymentAddress interface: existence and properties of interface prototype object's "constructor" property >-PASS PaymentAddress interface: existence and properties of interface prototype object's @@unscopables property >-PASS PaymentAddress interface: operation toJSON() >-PASS Unscopable handled correctly for toJSON() on PaymentAddress >-PASS PaymentAddress interface: attribute country >-PASS Unscopable handled correctly for country property on PaymentAddress >-PASS PaymentAddress interface: attribute addressLine >-PASS Unscopable handled correctly for addressLine property on PaymentAddress >-PASS PaymentAddress interface: attribute region >-PASS Unscopable handled correctly for region property on PaymentAddress >-FAIL PaymentAddress interface: attribute regionCode assert_true: The prototype object must have a property "regionCode" expected true got false >-PASS Unscopable handled correctly for regionCode property on PaymentAddress >-PASS PaymentAddress interface: attribute city >-PASS Unscopable handled correctly for city property on PaymentAddress >-PASS PaymentAddress interface: attribute dependentLocality >-PASS Unscopable handled correctly for dependentLocality property on PaymentAddress >-PASS PaymentAddress interface: attribute postalCode >-PASS Unscopable handled correctly for postalCode property on PaymentAddress >-PASS PaymentAddress interface: attribute sortingCode >-PASS Unscopable handled correctly for sortingCode property on PaymentAddress >-PASS PaymentAddress interface: attribute languageCode >-PASS Unscopable handled correctly for languageCode property on PaymentAddress >-PASS PaymentAddress interface: attribute organization >-PASS Unscopable handled correctly for organization property on PaymentAddress >-PASS PaymentAddress interface: attribute recipient >-PASS Unscopable handled correctly for recipient property on PaymentAddress >-PASS PaymentAddress interface: attribute phone >-PASS Unscopable handled correctly for phone property on PaymentAddress >-PASS PaymentResponse interface: existence and properties of interface object >-PASS PaymentResponse interface object length >-PASS PaymentResponse interface object name >-PASS PaymentResponse interface: existence and properties of interface prototype object >-PASS PaymentResponse interface: existence and properties of interface prototype object's "constructor" property >-PASS PaymentResponse interface: existence and properties of interface prototype object's @@unscopables property >-PASS PaymentResponse interface: operation toJSON() >-PASS Unscopable handled correctly for toJSON() on PaymentResponse >-PASS PaymentResponse interface: attribute requestId >-PASS Unscopable handled correctly for requestId property on PaymentResponse >-PASS PaymentResponse interface: attribute methodName >-PASS Unscopable handled correctly for methodName property on PaymentResponse >-PASS PaymentResponse interface: attribute details >-PASS Unscopable handled correctly for details property on PaymentResponse >-PASS PaymentResponse interface: attribute shippingAddress >-PASS Unscopable handled correctly for shippingAddress property on PaymentResponse >-PASS PaymentResponse interface: attribute shippingOption >-PASS Unscopable handled correctly for shippingOption property on PaymentResponse >-PASS PaymentResponse interface: attribute payerName >-PASS Unscopable handled correctly for payerName property on PaymentResponse >-PASS PaymentResponse interface: attribute payerEmail >-PASS Unscopable handled correctly for payerEmail property on PaymentResponse >-PASS PaymentResponse interface: attribute payerPhone >-PASS Unscopable handled correctly for payerPhone property on PaymentResponse >-PASS PaymentResponse interface: operation complete(PaymentComplete) >-PASS Unscopable handled correctly for complete(PaymentComplete) on PaymentResponse >-PASS PaymentRequestUpdateEvent interface: existence and properties of interface object >-PASS PaymentRequestUpdateEvent interface object length >-PASS PaymentRequestUpdateEvent interface object name >-PASS PaymentRequestUpdateEvent interface: existence and properties of interface prototype object >-PASS PaymentRequestUpdateEvent interface: existence and properties of interface prototype object's "constructor" property >-PASS PaymentRequestUpdateEvent interface: existence and properties of interface prototype object's @@unscopables property >-PASS PaymentRequestUpdateEvent interface: operation updateWith([object Object]) >-PASS Unscopable handled correctly for updateWith([object Object]) on PaymentRequestUpdateEvent >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/interfaces.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/interfaces.https.html >deleted file mode 100644 >index a7ec323f0cda6ec061cdf2219ae444db02b2873e..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/interfaces.https.html >+++ /dev/null >@@ -1,32 +0,0 @@ >-<!doctype html> >-<meta charset=utf-8> >-<title>Payment Request interface IDL tests</title> >-<script src=/resources/testharness.js></script> >-<script src=/resources/testharnessreport.js></script> >-<script src=/resources/WebIDLParser.js></script> >-<script src=/resources/idlharness.js></script> >-<script> >-promise_test(async () => { >- const urls = ["/interfaces/dom.idl", "/interfaces/payment-request.idl"]; >- const [dom, payment_request] = await Promise.all( >- urls.map(url => fetch(url).then(r => r.text()))); >- const idlArray = new IdlArray(); >- idlArray.add_untested_idls(dom); >- idlArray.add_idls(payment_request); >- >- // typedef EventHandler from HTML >- // https://html.spec.whatwg.org/#eventhandler >- idlArray.add_idls(` >- [TreatNonObjectAsNull] >- callback EventHandlerNonNull = any (Event event); >- typedef EventHandlerNonNull? EventHandler; >- `); >- const methods = "[{supportedMethods: 'foo'}]"; >- const amount = "{currency: 'USD', value: '0'}"; >- const details = `{total: {label: 'bar', amount: ${amount}} }`; >- idlArray.add_objects({ >- PaymentRequest: [`new PaymentRequest(${methods}, ${details})`], >- }); >- idlArray.test(); >-}, "Setup for Payment Request API IDL tests."); >-</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..f3100500337aae046fece213ccaee59a8ebdc320 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https-expected.txt >@@ -0,0 +1,6 @@ >+ >+FAIL Must have a onpaymentmethodchange IDL attribute assert_idl_attribute: property "onpaymentmethodchange" not found in prototype chain >+FAIL onpaymentmethodchange attribute is a generic handler for "paymentmethodchange" assert_true: event did not fire expected true got false >+FAIL onpaymentmethodchange attribute is a handler for PaymentMethodChangeEvent Can't find variable: PaymentMethodChangeEvent >+FAIL onpaymentmethodchange attribute and listeners both work Can't find variable: PaymentMethodChangeEvent >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..0484eb868f983e3cdb0efceab5fe2b3c6084b4ab >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https.html >@@ -0,0 +1,70 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>Test for onpaymentmethodchange attribute</title> >+<link rel="help" href="https://w3c.github.io/browser-payment-api/#onpaymentmethodchange-attribute"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+"use strict"; >+const testMethod = Object.freeze({ supportedMethods: "not-a-real-method" }); >+const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay" }); >+const defaultMethods = Object.freeze([testMethod, applePay]); >+const defaultDetails = Object.freeze({ >+ total: { >+ label: "Total", >+ amount: { >+ currency: "USD", >+ value: "1.00", >+ }, >+ }, >+}); >+ >+test(() => { >+ const request = new PaymentRequest(defaultMethods, defaultDetails); >+ assert_idl_attribute(request, "onpaymentmethodchange"); >+}, "Must have a onpaymentmethodchange IDL attribute"); >+ >+test(() => { >+ const request = new PaymentRequest(defaultMethods, defaultDetails); >+ const ev = new Event("paymentmethodchange"); >+ let didHandle = false; >+ request.onpaymentmethodchange = evt => { >+ assert_equals(ev, evt, "must be same event"); >+ didHandle = true; >+ }; >+ request.dispatchEvent(ev); >+ assert_true(didHandle, "event did not fire"); >+}, `onpaymentmethodchange attribute is a generic handler for "paymentmethodchange"`); >+ >+test(() => { >+ const request = new PaymentRequest(defaultMethods, defaultDetails); >+ const ev = new PaymentMethodChangeEvent("paymentmethodchange"); >+ let didHandle = false; >+ request.onpaymentmethodchange = evt => { >+ assert_equals(ev, evt, "must be same event"); >+ didHandle = true; >+ }; >+ request.dispatchEvent(ev); >+ assert_true(didHandle, "event did not fire"); >+}, `onpaymentmethodchange attribute is a handler for PaymentMethodChangeEvent`); >+ >+test(() => { >+ const request = new PaymentRequest(defaultMethods, defaultDetails); >+ const ev = new PaymentMethodChangeEvent("paymentmethodchange", { >+ methodName: "test" >+ }); >+ let didHandle = false; >+ let didListen = false; >+ request.onpaymentmethodchange = evt => { >+ assert_equals(ev, evt, "must be same event"); >+ didHandle = true; >+ }; >+ request.addEventListener("paymentmethodchange", evt => { >+ assert_equals(ev, evt, "must be same event"); >+ didListen = true; >+ }); >+ request.dispatchEvent(ev); >+ assert_true(didHandle, "onpaymentmethodchange did not receive the event"); >+ assert_true(didListen, "addEventListener did not receive the event"); >+}, `onpaymentmethodchange attribute and listeners both work`); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method-manual.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method-manual.https-expected.txt >deleted file mode 100644 >index b0f6b295d86378c3f93d41bcf322570314dada4a..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method-manual.https-expected.txt >+++ /dev/null >@@ -1,12 +0,0 @@ >-Test for PaymentRequest.abort() method >- >-Click on each button in sequence from top to bottom without refreshing the page. No payment sheet will be shown, but the tests will run in the background. >- >-Calling abort must not change the [[state]] until after "interactive". >-Calling .abort() causes acceptPromise to reject and closes the request. >-If you find a buggy test, please file a bug and tag one of the owners. >- >-Harness Error (TIMEOUT), message = null >- >-PASS Throws if the promise [[state]] is not "interactive" >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method-manual.https.html >deleted file mode 100644 >index 9552c3ce3fdefedfd90faa3d6d8edb2518b4e002..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method-manual.https.html >+++ /dev/null >@@ -1,95 +0,0 @@ >-<!DOCTYPE html> >-<meta charset="utf-8"> >-<title>Test for PaymentRequest.abort() method</title> >-<link rel="help" href="https://w3c.github.io/browser-payment-api/#abort-method"> >-<script src="/resources/testharness.js"></script> >-<script src="/resources/testharnessreport.js"></script> >-<script> >-"use strict"; >-setup({ >- // Ignore unhandled rejections resulting from .show()'s acceptPromise >- // not being explicitly handled. >- allow_uncaught_exception: true, >- explicit_done: true, >- explicit_timeout: true, >-}); >-const basicCard = Object.freeze({ supportedMethods: "basic-card" }); >-const defaultMethods = Object.freeze([basicCard]); >-const defaultDetails = Object.freeze({ >- total: { >- label: "Total", >- amount: { >- currency: "USD", >- value: "1.00", >- }, >- }, >-}); >- >-promise_test(async t => { >- // request is in "created" state >- const request = new PaymentRequest(defaultMethods, defaultDetails); >- await promise_rejects(t, "InvalidStateError", request.abort()); >-}, `Throws if the promise [[state]] is not "interactive"`); >- >-function manualTest1(elem){ >- elem.disabled = true; >- promise_test(async t => { >- // request is in "created" state. >- const request = new PaymentRequest(defaultMethods, defaultDetails); >- await promise_rejects(t, "InvalidStateError", request.abort()); >- // Call it again, for good measure. >- await promise_rejects(t, "InvalidStateError", request.abort()); >- // The request's state is "created", so let's show it >- // which changes the state to "interactive.". >- const acceptPromise = request.show(); >- // Let's set request the state to "closed" by calling .abort() >- try { >- await request.abort(); >- } catch (err) { >- assert_unreached("Unexpected promise rejection: " + err.message); >- } >- // The request is now "closed", so... >- await promise_rejects(t, "InvalidStateError", request.abort()); >- await promise_rejects(t, "AbortError", acceptPromise); >- }, elem.textContent.trim()); >-} >- >-function manualTest2(elem){ >- elem.disabled = true; >- promise_test(async t => { >- const request = new PaymentRequest(defaultMethods, defaultDetails); >- const acceptPromise = request.show(); >- try { >- await request.abort(); >- } catch (err) { >- assert_unreached("Unexpected promise rejection: " + err.message); >- } >- await promise_rejects(t, "AbortError", acceptPromise); >- // As request is now "closed", trying to show it will fail >- await promise_rejects(t, "InvalidStateError", request.show()); >- }, elem.textContent.trim()); >- done(); >-} >-</script> >- >-<h2>Test for PaymentRequest.abort() method</h2> >-<p> >- Click on each button in sequence from top to bottom without refreshing the page. >- No payment sheet will be shown, but the tests will run in the background. >-</p> >-<ol> >- <li> >- <button onclick="manualTest1(this)"> >- Calling abort must not change the [[state]] until after "interactive". >- </button> >- </li> >- <li> >- <button onclick="manualTest2(this)"> >- Calling .abort() causes acceptPromise to reject and closes the request. >- </button> >- </li> >-</ol> >-<small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >-</small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..3a5f0f90790bc507e1a21d4e17c1862b368b50a3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https-expected.txt >@@ -0,0 +1,9 @@ >+CONSOLE MESSAGE: Unhandled Promise Rejection: InvalidStateError: The object is in an invalid state. >+CONSOLE MESSAGE: Unhandled Promise Rejection: InvalidStateError: The object is in an invalid state. >+CONSOLE MESSAGE: Unhandled Promise Rejection: InvalidStateError: The object is in an invalid state. >+ >+PASS Throws if the promise [[state]] is not "interactive" >+FAIL Test for PaymentRequest.abort() method promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: test_driver" >+FAIL Test for PaymentRequest.abort() method 1 promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: test_driver" >+PASS Calling abort() multiple times is always a new object. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..522411b542a6d3a8a6a9e6488ab11a29454840d9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html >@@ -0,0 +1,81 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>Test for PaymentRequest.abort() method</title> >+<link rel="help" href="https://w3c.github.io/browser-payment-api/#abort-method"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src='/resources/testdriver-vendor.js'></script> >+<script src="/resources/testdriver.js"></script> >+<script> >+"use strict"; >+setup({ >+ // Ignore unhandled rejections resulting from .show()'s acceptPromise >+ // not being explicitly handled. >+ allow_uncaught_exception: true, >+ explicit_timeout: true, >+}); >+const basicCard = Object.freeze({ supportedMethods: "basic-card" }); >+const applePay = Object.freeze({ >+ supportedMethods: "https://apple.com/apple-pay", >+}); >+const defaultMethods = Object.freeze([basicCard, applePay]); >+const defaultDetails = Object.freeze({ >+ total: { >+ label: "Total", >+ amount: { >+ currency: "USD", >+ value: "1.00", >+ }, >+ }, >+}); >+ >+promise_test(async t => { >+ // request is in "created" state >+ const request = new PaymentRequest(defaultMethods, defaultDetails); >+ await promise_rejects(t, "InvalidStateError", request.abort()); >+}, `Throws if the promise [[state]] is not "interactive"`); >+ >+promise_test(async t => { >+ return test_driver.bless("show payment request", async () => { >+ const request = new PaymentRequest(defaultMethods, defaultDetails); >+ const acceptPromise = request.show(); >+ try { >+ await request.abort(); >+ } catch (err) { >+ assert_unreached("Unexpected promise rejection: " + err.message); >+ } >+ await promise_rejects(t, "AbortError", acceptPromise); >+ // As request is now "closed", trying to show it will fail >+ await promise_rejects(t, "InvalidStateError", request.show()); >+ }); >+}); >+ >+promise_test(async t => { >+ return test_driver.bless("show payment request", async () => { >+ // request is in "created" state. >+ const request = new PaymentRequest(defaultMethods, defaultDetails); >+ await promise_rejects(t, "InvalidStateError", request.abort()); >+ // Call it again, for good measure. >+ await promise_rejects(t, "InvalidStateError", request.abort()); >+ // The request's state is "created", so let's show it >+ // which changes the state to "interactive.". >+ const acceptPromise = request.show(); >+ // Let's set request the state to "closed" by calling .abort() >+ try { >+ await request.abort(); >+ } catch (err) { >+ assert_unreached("Unexpected promise rejection: " + err.message); >+ } >+ // The request is now "closed", so... >+ await promise_rejects(t, "InvalidStateError", request.abort()); >+ await promise_rejects(t, "AbortError", acceptPromise); >+ }); >+}); >+ >+promise_test(async t => { >+ const request = new PaymentRequest(defaultMethods, defaultDetails); >+ const promises = new Set([request.abort(), request.abort(), request.abort()]); >+ assert_equals(promises.size, 3, "Must have three unique objects"); >+}, "Calling abort() multiple times is always a new object."); >+</script> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-manual.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-manual.https-expected.txt >deleted file mode 100644 >index 537fb054d7b4a30b2b8b710e08cdc4bfdff359ae..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-manual.https-expected.txt >+++ /dev/null >@@ -1,15 +0,0 @@ >-Tests for PaymentRequest.canMakePayment() method >- >-Click on each button in sequence from top to bottom without refreshing the page. No payment sheet will be shown, but the tests will run in the background. >- >-If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException. >-If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException. >-If you find a buggy test, please file a bug and tag one of the owners. >- >-Harness Error (TIMEOUT), message = null >- >-FAIL If request.[[state]] is "created", then return a promise that resolves to true for known method. assert_equals: if it throws, then it must be a NotAllowedError. expected "NotAllowedError" but got "Error" >-FAIL If payment method identifier and serialized parts are supported, resolve promise with true. assert_true: basic-card should be supported expected true got false >-PASS If payment method identifier is unknown, resolve promise with false. >-PASS Optionally, at the user agent's discretion, return a promise rejected with a "NotAllowedError" DOMException. >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-manual.https.html >deleted file mode 100644 >index caf43d1cb0cc77091616203e0f8ad9079c3dcc15..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-manual.https.html >+++ /dev/null >@@ -1,196 +0,0 @@ >-<!DOCTYPE html> >-<meta charset="utf-8"> >-<title>Tests for PaymentRequest.canMakePayment() method</title> >-<link rel="help" href="https://w3c.github.io/browser-payment-api/#show-method"> >-<script src="/resources/testharness.js"></script> >-<script src="/resources/testharnessreport.js"></script> >-<script> >-setup({ >- explicit_done: true, >- explicit_timeout: true, >-}); >- >-const basicCard = Object.freeze({ supportedMethods: "basic-card" }); >-const defaultMethods = Object.freeze([basicCard]); >-const defaultDetails = Object.freeze({ >- total: { >- label: "Total", >- amount: { >- currency: "USD", >- value: "1.00", >- }, >- }, >-}); >- >-promise_test(async t => { >- const request = new PaymentRequest(defaultMethods, defaultDetails); >- try { >- assert_true( >- await request.canMakePayment(), >- `canMakePaymentPromise should be true` >- ); >- assert_true( >- await request.canMakePayment(), >- `canMakePaymentPromise should be true` >- ); >- } catch (err) { >- assert_equals( >- err.name, >- "NotAllowedError", >- "if it throws, then it must be a NotAllowedError." >- ); >- } >-}, `If request.[[state]] is "created", then return a promise that resolves to true for known method.`); >- >-promise_test(async t => { >- const request = new PaymentRequest(defaultMethods, defaultDetails); >- assert_true(await request.canMakePayment(), "basic-card should be supported"); >-}, `If payment method identifier and serialized parts are supported, resolve promise with true.`); >- >-promise_test(async t => { >- const unsupportedMethods = [ >- "this-is-not-supported", >- "https://not.supported", >- "e", >- "n6jzof05mk2g4lhxr-u-q-w1-c-i-pa-ty-bdvs9-ho-ae7-p-md8-s-wq3-h-qd-e-q-sa", >- "a-b-q-n-s-pw0", >- "m-u", >- "s-l5", >- "k9-f", >- "m-l", >- "u4-n-t", >- "i488jh6-g18-fck-yb-v7-i", >- "x-x-t-t-c34-o", >- "https://wpt", >- "https://wpt.fyi/", >- "https://wpt.fyi/payment", >- "https://wpt.fyi/payment-request", >- "https://wpt.fyi/payment-request?", >- "https://wpt.fyi/payment-request?this=is", >- "https://wpt.fyi/payment-request?this=is&totally", >- "https://wpt.fyi:443/payment-request?this=is&totally", >- "https://wpt.fyi:443/payment-request?this=is&totally#fine", >- "https://:@wpt.fyi:443/payment-request?this=is&totally#ð", >- " \thttps://wpt\n ", >- "https://xn--c1yn36f", >- "https://é»ç", >- ]; >- for (const method of unsupportedMethods) { >- try { >- const request = new PaymentRequest( >- [{ supportedMethods: method }], >- defaultDetails >- ); >- assert_false( >- await request.canMakePayment(), >- `method "${method}" must not be supported` >- ); >- } catch (err) { >- assert_equals( >- err.name, >- "NotAllowedError", >- "if it throws, then it must be a NotAllowedError." >- ); >- } >- } >-}, `If payment method identifier is unknown, resolve promise with false.`); >- >-promise_test(async t => { >- // This test might never actually hit its assertion, but that's allowed. >- const request = new PaymentRequest(defaultMethods, defaultDetails); >- for (let i = 0; i < 1000; i++) { >- try { >- await request.canMakePayment(); >- } catch (err) { >- assert_equals( >- err.name, >- "NotAllowedError", >- "if it throws, then it must be a NotAllowedError." >- ); >- break; >- } >- } >- for (let i = 0; i < 1000; i++) { >- try { >- await new PaymentRequest(defaultMethods, defaultDetails).canMakePayment(); >- } catch (err) { >- assert_equals( >- err.name, >- "NotAllowedError", >- "if it throws, then it must be a NotAllowedError." >- ); >- break; >- } >- } >-}, `Optionally, at the user agent's discretion, return a promise rejected with a "NotAllowedError" DOMException.`); >- >-function manualTest1(elem){ >- elem.disabled = true; >- promise_test(async t => { >- const request = new PaymentRequest(defaultMethods, defaultDetails); >- const acceptPromise = request.show(); // Sets state to "interactive" >- const canMakePaymentPromise = request.canMakePayment(); >- try { >- const result = await canMakePaymentPromise; >- assert_true( >- false, >- `canMakePaymentPromise should have thrown InvalidStateError` >- ); >- } catch (err) { >- await promise_rejects(t, "InvalidStateError", canMakePaymentPromise); >- } finally { >- await request.abort(); >- await promise_rejects(t, "AbortError", acceptPromise); >- } >- // The state should be "closed" >- await promise_rejects(t, "InvalidStateError", request.canMakePayment()); >- }, elem.textContent.trim()); >-} >- >-function manualTest2(elem){ >- elem.disabled = true; >- promise_test(async t => { >- const request = new PaymentRequest(defaultMethods, defaultDetails); >- const acceptPromise = request.show(); // The state is now "interactive" >- acceptPromise.catch(() => {}); // no-op, just to silence unhandled rejection in devtools. >- await request.abort(); // The state is now "closed" >- await promise_rejects(t, "InvalidStateError", request.canMakePayment()); >- try { >- const result = await request.canMakePayment(); >- assert_true( >- false, >- `should have thrown InvalidStateError, but instead returned "${result}"` >- ); >- } catch (err) { >- assert_equals( >- err.name, >- "InvalidStateError", >- "must be an InvalidStateError." >- ); >- } >- }, elem.textContent.trim()); >- done(); >-} >-</script> >- >-<h2>Tests for PaymentRequest.canMakePayment() method</h2> >-<p> >- Click on each button in sequence from top to bottom without refreshing the page. >- No payment sheet will be shown, but the tests will run in the background. >-</p> >-<ol> >- <li> >- <button onclick="manualTest1(this)"> >- If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException. >- </button> >- </li> >- <li> >- <button onclick="manualTest2(this)"> >- If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException. >- </button> >- </li> >-</ol> >-<small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >-</small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..724030ea29a4702b48a4dae226fe41db579ac582 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https-expected.txt >@@ -0,0 +1,10 @@ >+If you find a buggy test, please file a bug and tag one of the suggested reviewers. >+ >+FAIL If request.[[state]] is "created", then return a promise that resolves to true for known method. assert_equals: if it throws, then it must be a NotAllowedError. expected "NotAllowedError" but got "Error" >+FAIL If payment method identifier and serialized parts are supported, resolve promise with true. assert_true: basic-card should be supported expected true got false >+PASS If payment method identifier is unknown, resolve promise with false. >+PASS Optionally, at the user agent's discretion, return a promise rejected with a "NotAllowedError" DOMException. >+FAIL If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException. Can't find variable: test_driver >+FAIL If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException. Can't find variable: test_driver >+PASS Calling canMakePayment() multiple times is always a new object. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..617bd6e4834011937915e8e22bbf18b3af217c78 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html >@@ -0,0 +1,186 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>Tests for PaymentRequest.canMakePayment() method</title> >+<link rel="help" href="https://w3c.github.io/browser-payment-api/#show-method"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src='/resources/testdriver-vendor.js'></script> >+<script src="/resources/testdriver.js"></script> >+<script> >+const basicCard = Object.freeze({ supportedMethods: "basic-card" }); >+const defaultMethods = Object.freeze([basicCard]); >+const defaultDetails = Object.freeze({ >+ total: { >+ label: "Total", >+ amount: { >+ currency: "USD", >+ value: "1.00", >+ }, >+ }, >+}); >+ >+promise_test(async t => { >+ const request = new PaymentRequest(defaultMethods, defaultDetails); >+ try { >+ assert_true( >+ await request.canMakePayment(), >+ `canMakePaymentPromise should be true` >+ ); >+ assert_true( >+ await request.canMakePayment(), >+ `canMakePaymentPromise should be true` >+ ); >+ } catch (err) { >+ assert_equals( >+ err.name, >+ "NotAllowedError", >+ "if it throws, then it must be a NotAllowedError." >+ ); >+ } >+}, `If request.[[state]] is "created", then return a promise that resolves to true for known method.`); >+ >+promise_test(async t => { >+ const request = new PaymentRequest(defaultMethods, defaultDetails); >+ assert_true(await request.canMakePayment(), "basic-card should be supported"); >+}, `If payment method identifier and serialized parts are supported, resolve promise with true.`); >+ >+promise_test(async t => { >+ const unsupportedMethods = [ >+ "this-is-not-supported", >+ "https://not.supported", >+ "e", >+ "n6jzof05mk2g4lhxr-u-q-w1-c-i-pa-ty-bdvs9-ho-ae7-p-md8-s-wq3-h-qd-e-q-sa", >+ "a-b-q-n-s-pw0", >+ "m-u", >+ "s-l5", >+ "k9-f", >+ "m-l", >+ "u4-n-t", >+ "i488jh6-g18-fck-yb-v7-i", >+ "x-x-t-t-c34-o", >+ "https://wpt", >+ "https://wpt.fyi/", >+ "https://wpt.fyi/payment", >+ "https://wpt.fyi/payment-request", >+ "https://wpt.fyi/payment-request?", >+ "https://wpt.fyi/payment-request?this=is", >+ "https://wpt.fyi/payment-request?this=is&totally", >+ "https://wpt.fyi:443/payment-request?this=is&totally", >+ "https://wpt.fyi:443/payment-request?this=is&totally#fine", >+ "https://:@wpt.fyi:443/payment-request?this=is&totally#ð", >+ " \thttps://wpt\n ", >+ "https://xn--c1yn36f", >+ "https://é»ç", >+ ]; >+ for (const method of unsupportedMethods) { >+ try { >+ const request = new PaymentRequest( >+ [{ supportedMethods: method }], >+ defaultDetails >+ ); >+ assert_false( >+ await request.canMakePayment(), >+ `method "${method}" must not be supported` >+ ); >+ } catch (err) { >+ assert_equals( >+ err.name, >+ "NotAllowedError", >+ "if it throws, then it must be a NotAllowedError." >+ ); >+ } >+ } >+}, `If payment method identifier is unknown, resolve promise with false.`); >+ >+promise_test(async t => { >+ // This test might never actually hit its assertion, but that's allowed. >+ const request = new PaymentRequest(defaultMethods, defaultDetails); >+ for (let i = 0; i < 1000; i++) { >+ try { >+ await request.canMakePayment(); >+ } catch (err) { >+ assert_equals( >+ err.name, >+ "NotAllowedError", >+ "if it throws, then it must be a NotAllowedError." >+ ); >+ break; >+ } >+ } >+ for (let i = 0; i < 1000; i++) { >+ try { >+ await new PaymentRequest(defaultMethods, defaultDetails).canMakePayment(); >+ } catch (err) { >+ assert_equals( >+ err.name, >+ "NotAllowedError", >+ "if it throws, then it must be a NotAllowedError." >+ ); >+ break; >+ } >+ } >+}, `Optionally, at the user agent's discretion, return a promise rejected with a "NotAllowedError" DOMException.`); >+ >+promise_test(t => { >+ return test_driver.bless("show payment request", async () => { >+ const request = new PaymentRequest(defaultMethods, defaultDetails); >+ const acceptPromise = request.show(); // Sets state to "interactive" >+ const canMakePaymentPromise = request.canMakePayment(); >+ try { >+ const result = await canMakePaymentPromise; >+ assert_true( >+ false, >+ `canMakePaymentPromise should have thrown InvalidStateError` >+ ); >+ } catch (err) { >+ await promise_rejects(t, "InvalidStateError", canMakePaymentPromise); >+ } finally { >+ await request.abort(); >+ await promise_rejects(t, "AbortError", acceptPromise); >+ } >+ // The state should be "closed" >+ await promise_rejects(t, "InvalidStateError", request.canMakePayment()); >+ }); >+}, 'If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException.'); >+ >+promise_test(t => { >+ return test_driver.bless("show payment request", async () => { >+ const request = new PaymentRequest(defaultMethods, defaultDetails); >+ const acceptPromise = request.show(); // The state is now "interactive" >+ acceptPromise.catch(() => {}); // no-op, just to silence unhandled rejection in devtools. >+ await request.abort(); // The state is now "closed" >+ await promise_rejects(t, "InvalidStateError", request.canMakePayment()); >+ try { >+ const result = await request.canMakePayment(); >+ assert_true( >+ false, >+ `should have thrown InvalidStateError, but instead returned "${result}"` >+ ); >+ } catch (err) { >+ assert_equals( >+ err.name, >+ "InvalidStateError", >+ "must be an InvalidStateError." >+ ); >+ } >+ }); >+}, 'If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException.'); >+ >+test(() => { >+ const request = new PaymentRequest( >+ [{ supportedMethods: "basic-card" }], >+ defaultDetails >+ ); >+ const promises = new Set([ >+ request.canMakePayment(), >+ request.canMakePayment(), >+ request.canMakePayment(), >+ ]); >+ assert_equals(promises.size, 3, "Must have three unique objects"); >+}, "Calling canMakePayment() multiple times is always a new object."); >+</script> >+ >+<small> >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. >+</small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-insecure.http-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-insecure.http-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..9c35c876bffecea75e25ff30634878334af39124 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-insecure.http-expected.txt >@@ -0,0 +1,3 @@ >+ >+FAIL PaymentRequest constructor must not be exposed in insecure context assert_false: expected false got true >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-insecure.http.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-insecure.http.html >new file mode 100644 >index 0000000000000000000000000000000000000000..02122203d51eaff6c6639c9762b1495173bbf66e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-insecure.http.html >@@ -0,0 +1,13 @@ >+<!DOCTYPE html> >+<!-- Copyright © 2017 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). --> >+<meta charset="utf-8"> >+<title>Test for PaymentRequest Constructor (insecure)</title> >+<link rel="help" href="https://w3c.github.io/payment-request/#paymentrequest-interface"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+test(() => { >+ assert_false(isSecureContext); >+ assert_false("PaymentRequest" in window); >+}, "PaymentRequest constructor must not be exposed in insecure context"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-not-exposed.https.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-not-exposed.https.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..ef2fdc3821fa12c005a0699db0c7a44a17a22ab8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-not-exposed.https.worker-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS PaymentRequest constructor must not be exposed in worker global scope >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-not-exposed.https.worker.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-not-exposed.https.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-not-exposed.https.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-not-exposed.https.worker.js b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-not-exposed.https.worker.js >new file mode 100644 >index 0000000000000000000000000000000000000000..e5576e673520ea33504d8ddea0e862d54b28e8fb >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-not-exposed.https.worker.js >@@ -0,0 +1,7 @@ >+importScripts("/resources/testharness.js"); >+ >+test(() => { >+ assert_true(isSecureContext); >+ assert_false('PaymentRequest' in self); >+}, "PaymentRequest constructor must not be exposed in worker global scope"); >+done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html >index 32b56680e7fb3870432fa67b7532ed1b505fb591..c6e69d4c587602d51602aea41224731e692af2ae 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html >@@ -1,15 +1,16 @@ > <!DOCTYPE html> >-<!-- Copyright © 2017 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). --> > <meta charset="utf-8"> > <title>Test for PaymentRequest.show() method</title> > <link rel="help" href="https://w3c.github.io/browser-payment-api/#show-method"> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> >+<script src="/resources/testdriver.js"></script> >+<script src="/resources/testdriver-vendor.js"></script> > <script> >-'use strict'; >+"use strict"; > const defaultMethods = Object.freeze([ > { supportedMethods: "basic-card" }, >- { supportedMethods: "https://apple.com/pay" } >+ { supportedMethods: "https://apple.com/apple-pay" }, > ]); > > const defaultDetails = Object.freeze({ >@@ -27,4 +28,53 @@ promise_test(async t => { > const acceptPromise = request.show(); > await promise_rejects(t, "SecurityError", acceptPromise); > }, `Calling show() without being triggered by user interaction throws`); >+ >+promise_test(t => { >+ return test_driver.bless("show payment request", async () => { >+ const request = new PaymentRequest(defaultMethods, defaultDetails); >+ const acceptPromise = request.show(); // Sets state to "interactive" >+ await promise_rejects(t, "InvalidStateError", request.show()); >+ await request.abort(); >+ await promise_rejects(t, "AbortError", acceptPromise); >+ }); >+}, "Throws if the promise [[state]] is not 'created'."); >+ >+promise_test(t => { >+ return test_driver.bless("show payment request", async () => { >+ const request1 = new PaymentRequest(defaultMethods, defaultDetails); >+ const request2 = new PaymentRequest(defaultMethods, defaultDetails); >+ const acceptPromise1 = request1.show(); >+ const acceptPromise2 = request2.show(); >+ await promise_rejects(t, "AbortError", acceptPromise2); >+ await request1.abort(); >+ await promise_rejects(t, "AbortError", acceptPromise1); >+ }); >+}, `If the user agent's "payment request is showing" boolean is true, then return a promise rejected with an "AbortError" DOMException.`); >+ >+promise_test(t => { >+ return test_driver.bless("show payment request", async () => { >+ const request = new PaymentRequest( >+ [{ supportedMethods: "this-is-not-supported" }], >+ defaultDetails >+ ); >+ const acceptPromise = request.show(); >+ await promise_rejects(t, "NotSupportedError", acceptPromise); >+ }); >+}, `If payment method consultation produces no supported method of payment, then return a promise rejected with a "NotSupportedError" DOMException.`); >+ >+promise_test(t => { >+ return test_driver.bless("show payment request", async () => { >+ const request = new PaymentRequest( >+ [{ supportedMethods: "basic-card" }], >+ defaultDetails >+ ); >+ const promises = new Set([request.show(), request.show(), request.show()]); >+ await request.abort(); >+ assert_equals(promises.size, 3, "Must have three unique objects"); >+ }); >+}, "Calling show() multiple times is always a new object."); > </script> >+<small> >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. >+</small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html >index 509fa4d110b91ac8874a081c7263427fe61047df..a9da9eed9cbaed0540ef542f75896f532a60d13e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html >@@ -11,34 +11,40 @@ > async function runManualTest({ completeWith: result }, button) { > button.disabled = true; > const { response, request } = await getPaymentRequestResponse(); >- promise_test(async () => { >+ promise_test(async t => { > try { > // We .complete() as normal, using the passed test value >- const promise = response.complete(result); >- assert_true(promise instanceof Promise, "returns a promise"); >- const returnedValue = await promise; >+ const completePromise = response.complete(result); >+ assert_true(completePromise instanceof Promise, "returns a promise"); >+ // Immediately calling complete() again yields a rejected promise. >+ const invalidComplete = response.complete(result); >+ await promise_rejects(t, "InvalidStateError", invalidComplete); >+ // but the original promise is unaffected >+ const returnedValue = await completePromise; > assert_equals( > returnedValue, > undefined, > "Returned value must always be undefined" > ); > // We now call .complete() again, to force an exception >- // because [[completeCalled]] is true. >- try { >- await response.complete(result); >- assert_unreached("Expected InvalidStateError to be thrown"); >- } catch (err) { >- assert_equals( >- err.code, >- DOMException.INVALID_STATE_ERR, >- "Must throw an InvalidStateError" >- ); >- } >+ // because [[complete]] is true. >+ const afterComplete = response.complete(result); >+ await promise_rejects(t, "InvalidStateError", afterComplete); > button.innerHTML = `â ${button.textContent}`; > } catch (err) { > button.innerHTML = `â ${button.textContent}`; > assert_unreached("Unexpected exception: " + err.message); > } >+ const allPromises = new Set([ >+ completePromise, >+ invalidComplete, >+ afterComplete, >+ ]); >+ assert_equals( >+ allPromises.length, >+ 3, >+ "Calling complete() multiple times is always a new object." >+ ); > }, button.textContent.trim()); > } > </script> >@@ -79,6 +85,6 @@ async function runManualTest({ completeWith: result }, button) { > </li> > </ol> > <small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. > </small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/helpers.js b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/helpers.js >index bf938c5edba56a1acdf22a3596a34c02dfd49a51..807f794e71efb35f8622eb0aa478ae6a6039c260 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/helpers.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/helpers.js >@@ -35,7 +35,7 @@ test(() => { > * @param PaymentOptions options > */ > async function getPaymentResponse(options, id) { >- const { response } = getPaymentRequestResponse(options, id); >+ const { response } = await getPaymentRequestResponse(options, id); > return response; > } > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html >index cd25e942c6f16f410f2fe50d609babf7ccc9eecd..0a8ef6c77e87e68a1b7f9aa28588be4de3da98f0 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html >@@ -23,6 +23,6 @@ > </li> > </ol> > <small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. > </small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..aa6653288bdc1d76d48cd63fc5abf9cf8f3d65d8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.https-expected.txt >@@ -0,0 +1,8 @@ >+ >+FAIL PaymentResponse inherits from EventTarget assert_equals: expected function "function EventTarget() { >+ [native code] >+}" but got function "function () { >+ [native code] >+}" >+FAIL PaymentResponse has an onpayerdetailchange in the prototype chain assert_true: expected true got false >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..ed9e6e885b842ae18c5f87f9992d0c9a9cb6401a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.https.html >@@ -0,0 +1,14 @@ >+<!doctype html> >+<meta charset=utf-8> >+<title>PaymentResponse.prototype.onpayerdetailschange attribute</title> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script> >+test(() => { >+ assert_equals(Object.getPrototypeOf(PaymentResponse), window.EventTarget); >+}, "PaymentResponse inherits from EventTarget"); >+ >+test(() => { >+ assert_true("onpayerdetailchange" in PaymentResponse.prototype); >+}, "PaymentResponse has an onpayerdetailchange in the prototype chain"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.manual.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..9f92d284063fcec7c0ffefb09a076a285cd4b766 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.manual.https.html >@@ -0,0 +1,66 @@ >+<!doctype html> >+<meta charset=utf-8> >+<title>PaymentResponse.prototype.onpayerdetailchange attribute</title> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src="helpers.js"></script> >+<script> >+function runTest(button, options, expected){ >+ button.disabled = true; >+ promise_test(async () => { >+ const response = await getPaymentResponse(options); >+ const eventPromise = new Promise(resolve => { >+ response.addEventListener("payerdetailchange", resolve); >+ }); >+ const error = button.previousElementSibling.textContent.trim(); >+ const retryPromise = response.retry({ error }); >+ const event = await eventPromise; >+ assert_true(event instanceof PaymentRequestUpdateEvent); >+ for(const [prop, value] of Object.entries(expected)){ >+ assert_equals(response[prop], value); >+ } >+ await response.complete("success"); >+ }, button.textContent.trim()); >+} >+</script> >+<h2>Handling PaymentResponse.prototype.onpayerdetailchange events</h2> >+<p> >+ Each button will bring up the Payment Request UI window. >+ When shown the payment sheet, use any details and hit pay. >+</p> >+<p> >+ When asked to retry the payment: >+</p> >+<ol> >+ <li> >+ <p> >+ Change payer's name to "pass". >+ </p> >+ <button onclick="runTest(this, { requestPayerName: true }, { payerName: 'pass' });"> >+ PaymentRequestUpdateEvent is dispatched when payer name changes. >+ </button> >+ </li> >+ <li> >+ <p> >+ Change payer's email to "pass@pass.pass". >+ </p> >+ <button onclick="runTest(this, {requestPayerEmail: true}, { payerEmail: 'pass@pass.pass' });"> >+ PaymentRequestUpdateEvent is dispatched when payer email changes. >+ </button> >+ </li> >+ <li> >+ <p> >+ Change payer's phone to "+1-800-000-0000". >+ </p> >+ <button onclick="runTest(this, {requestPayerPhone: true}, { payerPhone: '+1-800-000-0000' })"> >+ PaymentRequestUpdateEvent is dispatched when payer phone changes. >+ </button> >+ </li> >+ <li> >+ <button onclick="done();">DONE!</button> >+ </li> >+</ol> >+<small> >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/OWNERS">owners</a>. >+</small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html >index c7eaf65ffccaa4cd7ec8898377c0252c3ce85bf2..28ce4c28a85c5bdb79f08438edd2086fd6b09c08 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html >@@ -43,6 +43,6 @@ > </li> > </ol> > <small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. > </small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html >index b2636e37cb872620274b49d9d95c80d5aab086cd..44d741ae45cb7f8f34fa1550b47b49cf3e0c450b 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html >@@ -43,6 +43,6 @@ > </li> > </ol> > <small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. > </small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html >index c74f45e9c2338aa43583a16aabcd694f87052bf1..85a44a819cd8555e032520f887cf89508bdb98b6 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html >@@ -43,6 +43,6 @@ > </li> > </ol> > <small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. > </small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/rejects_if_not_active-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/rejects_if_not_active-manual.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..60dd9655dd5bafcdb7768b929696cb9104214b29 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/rejects_if_not_active-manual.https.html >@@ -0,0 +1,150 @@ >+<!DOCTYPE html> >+<meta charset=utf-8> >+<link rel="help" href="https://w3c.github.io/payment-request/#retry-method"> >+<title>PaymentResponse retry() rejects if doc is not fully active</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentresponse-retry"> >+<body> >+<script> >+setup({ explicit_done: true, explicit_timeout: true }); >+const validMethod = Object.freeze({ >+ supportedMethods: "basic-card", >+}); >+const validMethods = Object.freeze([validMethod]); >+const validAmount = Object.freeze({ >+ currency: "USD", >+ value: "5.00", >+}); >+const validTotal = Object.freeze({ >+ label: "Total due", >+ amount: validAmount, >+}); >+const validDetails = Object.freeze({ >+ total: validTotal, >+}); >+ >+function getLoadedPaymentResponse(iframe, url) { >+ return new Promise(resolve => { >+ iframe.addEventListener( >+ "load", >+ async () => { >+ const { PaymentRequest } = iframe.contentWindow; >+ const response = await new PaymentRequest( >+ validMethods, >+ validDetails >+ ).show(); >+ resolve(response); >+ }, >+ { once: true } >+ ); >+ iframe.src = url; >+ }); >+} >+ >+function methodNotFullyActive(button, method, ...args) { >+ const text = button.textContent.trim(); >+ promise_test(async t => { >+ const iframe = document.createElement("iframe"); >+ iframe.allowPaymentRequest = true; >+ document.body.appendChild(iframe); >+ >+ // We first got to page1.html, grab a PaymentResponse instance. >+ const response = await getLoadedPaymentResponse( >+ iframe, >+ "/payment-request/resources/page1.html" >+ ); >+ // We navigate the iframe again, putting response's document into an inactive state. >+ await new Promise(resolve => { >+ iframe.addEventListener("load", resolve); >+ iframe.src = "/payment-request/resources/page2.html"; >+ }); >+ // Now, response's relevant global object's document is no longer active. >+ // So, promise needs to reject appropriately. >+ const promise = response[methodName](...args); >+ await promise_rejects( >+ t, >+ "AbortError", >+ promise, >+ "Inactive document, so must throw AbortError" >+ ); >+ // We are done, so clean up. >+ iframe.remove(); >+ }, text); >+} >+ >+function methodBecomesNotFullyActive(button, methodName, ...args) { >+ const text = button.textContent.trim(); >+ promise_test(async t => { >+ const iframe = document.createElement("iframe"); >+ iframe.allowPaymentRequest = true; >+ document.body.appendChild(iframe); >+ >+ // We first got to page1.html, grab a PaymentResponse instance. >+ const response = await getLoadedPaymentResponse( >+ iframe, >+ "/payment-request/resources/page1.html" >+ ); >+ >+ // we get the promise from page1.html, while it's active! >+ const promise = response[methodName](...args); >+ >+ // We navigate the iframe again, putting response's document into an inactive state. >+ await new Promise(resolve => { >+ iframe.addEventListener("load", resolve); >+ iframe.src = "/payment-request/resources/page2.html"; >+ }); >+ >+ // Now, response's relevant global object's document is no longer active. >+ // So, promise needs to reject appropriately. >+ await promise_rejects( >+ t, >+ "AbortError", >+ promise, >+ "Inactive document, so must throw AbortError" >+ ); >+ // We are done, so clean up. >+ iframe.remove(); >+ }, text); >+} >+</script> >+<section> >+ <p> >+ For each test, when the payment sheet is shown, select a payment method and hit "Pay". >+ </p> >+ <h2>retry() and document active state</h2> >+ <p>Manual Tests for PaymentResponse.retry() - Please run in order!</p> >+ <ol> >+ <li> >+ <button onclick="methodNotFullyActive(this, 'retry', {});"> >+ retry()'s retryPromise rejects if document is not fully active. >+ </button> >+ </li> >+ <li> >+ <button onclick="methodBecomesNotFullyActive(this, 'retry', {});"> >+ retry()'s retryPromise rejects if the document becomes not fully active. >+ </button> >+ </li> >+ </ol> >+ <h2>complete() and document active state</h2> >+ <p>Manual Tests for PaymentResponse.complete() - Please run in order!</p> >+ <ol> >+ <li> >+ <button onclick="methodNotFullyActive(this, 'complete', 'success');"> >+ complete()'s completePromise rejects if document is not fully active. >+ </button> >+ </li> >+ <li> >+ <button onclick="methodBecomesNotFullyActive(this, 'complete', 'success');"> >+ complete()'s completePromise rejects if the document becomes not fully active. >+ </button> >+ </li> >+ <li> >+ <button onclick="done();">Done</button> >+ </li> >+ </ol> >+</section> >+<small> >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. >+</small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html >index 653ed55bdf9d85b8ed2daf98f86048c93f385ed4..ddb1e0d831dac65cd2f5dc64c7218a45b2e154a8 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html >@@ -29,6 +29,6 @@ > </li> > </ol> > <small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. > </small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..82821a9a39c6c9ce6def2c076e39aa08f00921cc >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html >@@ -0,0 +1,274 @@ >+<!doctype html> >+<meta charset="utf8"> >+<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentresponse-retry"> >+<title> >+ PaymentResponse.prototype.retry() method >+</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="helpers.js"></script> >+<script> >+test(() => { >+ assert_true( >+ "retry" in PaymentResponse.prototype, >+ "retry must be in prototype" >+ ); >+ assert_true( >+ PaymentResponse.prototype.retry instanceof Function, >+ "retry must be a function" >+ ); >+}, "PaymentResponse.prototype must have a retry() function (smoke test)."); >+ >+function checkCompletedCantRetry(button) { >+ button.disabled = true; >+ promise_test(async t => { >+ const { response } = await getPaymentRequestResponse(); >+ // sets response.[[complete]] to true. >+ await response.complete("success"); >+ return promise_rejects( >+ t, >+ "InvalidStateError", >+ response.retry({}), >+ "response.[[complete]] is true, so rejects with InvalidStateError." >+ ); >+ }, button.textContent.trim()); >+} >+ >+function repeatedCallsToRetry(button) { >+ button.disabled = true; >+ promise_test(async t => { >+ const { response } = await getPaymentRequestResponse(); >+ const retryPromise = response.retry({}); >+ await promise_rejects( >+ t, >+ "InvalidStateError", >+ response.retry({}), >+ "Calling retry() again rejects with an InvalidStateError" >+ ); >+ await retryPromise; >+ await response.complete("success"); >+ }, button.textContent.trim()); >+} >+ >+function callCompleteWhileRetrying(button) { >+ button.disabled = true; >+ promise_test(async t => { >+ const { response } = await getPaymentRequestResponse(); >+ const retryPromise = response.retry({}); >+ await promise_rejects( >+ t, >+ "InvalidStateError", >+ response.complete("success"), >+ "Calling complete() while retrying rejects with an InvalidStateError" >+ ); >+ await retryPromise; >+ await response.complete("success"); >+ }, button.textContent.trim()); >+} >+ >+function callingRequestAbortMustNotAbort(button) { >+ button.disabled = true; >+ promise_test(async t => { >+ const { response, request } = await getPaymentRequestResponse(); >+ const retryPromise = response.retry({}); >+ await promise_rejects( >+ t, >+ "InvalidStateError", >+ request.abort(), >+ "Calling request.abort() while retrying rejects with an InvalidStateError" >+ ); >+ await retryPromise; >+ await response.complete("success"); >+ }, button.textContent.trim()); >+} >+ >+function canRetryMultipleTimes(button) { >+ button.disabled = true; >+ promise_test(async t => { >+ const { response } = await getPaymentRequestResponse(); >+ assert_equals( >+ await response.retry({}), >+ undefined, >+ "Expected undefined as the resolve value" >+ ); >+ assert_equals( >+ await response.retry({}), >+ undefined, >+ "Expected undefined as the resolve value" >+ ); >+ await response.complete("success"); >+ await promise_rejects( >+ t, >+ "InvalidStateError", >+ response.retry({}), >+ "Calling retry() after complete() rejects with a InvalidStateError" >+ ); >+ }, button.textContent.trim()); >+} >+ >+function userCanAbortARetry(button) { >+ button.disabled = true; >+ promise_test(async t => { >+ const { response } = await getPaymentRequestResponse(); >+ await promise_rejects( >+ t, >+ "AbortError", >+ response.retry({}), >+ "The user aborting a retry rejects with a AbortError" >+ ); >+ await promise_rejects( >+ t, >+ "InvalidStateError", >+ response.retry({}), >+ "After the user aborts, response [[complete]] is true so retry() must reject with InvalidStateError" >+ ); >+ await promise_rejects( >+ t, >+ "InvalidStateError", >+ response.complete("success"), >+ "After the user aborts, response [[complete]] is true, so complete() rejects with a InvalidStateError" >+ ); >+ }, button.textContent.trim()); >+} >+ >+function userIsShownErrorsFields(button) { >+ button.disabled = true; >+ promise_test(async t => { >+ const { response, request } = await getPaymentRequestResponse({ requestShipping: true }); >+ const retryPromise = response.retry({ >+ shippingAddress: { city: "Invalid city", addressLine: "Invalid address line" }, >+ }); >+ await retryPromise; >+ await response.complete("success"); >+ }, button.textContent.trim()); >+} >+ >+function abortTheUpdate(button) { >+ button.disabled = true; >+ promise_test(async t => { >+ const { response, request } = await getPaymentRequestResponse({ requestShipping: true }); >+ // causes "abort the update" to run >+ const shippingChangedPromise = new Promise(resolve => { >+ request.onshippingoptionchange = () => { >+ event.updateWith({ total: { amount: { currency: "USD", value: "INVALID" } }}); >+ resolve(); >+ }; >+ }); >+ const retryPromise = response.retry({}); >+ await shippingChangedPromise; >+ await promise_rejects( >+ t, >+ new TypeError(), >+ retryPromise, >+ "retry() aborts with a TypeError, because totals' value is invalid" >+ ); >+ await promise_rejects( >+ t, >+ "InvalidStateError", >+ response.complete("success"), >+ "After the user aborts, response [[complete]] is true, so complete() rejects with a InvalidStateError" >+ ); >+ }, button.textContent.trim()); >+} >+ >+function callingRetryReturnsUniquePromise(button){ >+ button.disabled = true; >+ promise_test(async t => { >+ const { response } = await getPaymentRequestResponse(); >+ const retryPromise = response.retry({}); >+ const promises = new Set([ >+ retryPromise, >+ response.retry({}), >+ response.retry({}), >+ ]); >+ assert_equals(promises.size, 3, "Must have three unique objects"); >+ await retryPromise; >+ await response.complete(); >+ }, button.textContent.trim()); >+}; >+ >+ >+</script> >+<h2> >+ Manual Tests for PaymentResponse.retry() - Please run in order! >+</h2> >+<p> >+ Click on each button in sequence from top to bottom without refreshing the page. >+ Each button will bring up the Payment Request UI window. >+</p> >+<p> >+ When presented with the payment sheet, use any credit card select to "Pay" multiple times. >+</p> >+<ol> >+ <li> >+ <button onclick="checkCompletedCantRetry(this);"> >+ A completed payment request cannot be retried. >+ </button> >+ </li> >+ <li> >+ <button onclick="repeatedCallsToRetry(this);"> >+ Calling retry() more than once yield a rejected promise, but the >+ retryPromise resolves independently. >+ </button> >+ </li> >+ <li> >+ <button onclick="callCompleteWhileRetrying(this);"> >+ Calling complete() while a retry() is in progress results in an InvalidStateError. >+ </button> >+ </li> >+ <li> >+ <button onclick="callingRequestAbortMustNotAbort(this);"> >+ Trying to abort() via PaymentRequest is not possible. >+ </button> >+ </li> >+ <li> >+ <button onclick="canRetryMultipleTimes(this);"> >+ It's possible to retry() multiple times and eventually complete(). >+ After complete(), however, retry() rejects with an InvalidStateError. >+ </button> >+ </li> >+ <li> >+ <p> >+ When shown the payment sheet, hit pay once, then abort retrying the payment. >+ </p> >+ <button onclick="userCanAbortARetry(this);"> >+ The user aborting retrying a payment causes the retryPromise to reject with AbortError. >+ Aborting a payment is causes it complete. >+ </button> >+ </li> >+ <li> >+ <p> >+ When shown the payment sheet, hit pay once. Check payment sheet for error fields. >+ Then hit escape or otherwise abort the payment. >+ </p> >+ <button onclick="userIsShownErrorsFields(this);"> >+ When retrying, the user is shown error fields to fix. >+ </button> >+ </li> >+ <li> >+ <p> >+ When shown the payment sheet, hit pay once. Then retry once. >+ </p> >+ <button onclick="abortTheUpdate(this);"> >+ When "abort the update" occurs because of an update error, >+ the `retryPromise` is rejected and response.[[complete]] becomes true. >+ </button> >+ </li> >+ <li> >+ <p> >+ When shown the payment sheet, hit pay once. Then retry once. >+ </p> >+ <button onclick="callingRetryReturnsUniquePromise(this);"> >+ Calling retry() multiple times is always a new object. >+ </button> >+ </li> >+ <li> >+ <button onclick="done();"> >+ Done! >+ </button> >+ </li> >+</ol> >+<small> >+ If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+</small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html >index b5a4082d7f69350b50acb70c8b20e322d9a6de09..92bac2bb5e5e270cedfb5b84bc8c8998df46265e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html >@@ -96,6 +96,6 @@ async function runManualTest(button, options = {}, expected = {}, id) { > </li> > </ol> > <small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. > </small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html >index eec7a4d9bded702c391796db0c237ff925fb41de..687d3a52de9f6bfdb10456147586008b18683eb2 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html >@@ -38,6 +38,6 @@ > </li> > </ol> > <small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. > </small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/w3c-import.log >index 5125feb146b6187fb2538980c4c606c9387d3baa..eb55e282287f408830c1709450223543ccc6d130 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >@@ -17,9 +17,13 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/helpers.js > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.https.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.manual.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/rejects_if_not_active-manual.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/resources/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/payment-request/resources/w3c-import.log >index 3d11dd1ada2a1ceabacb70b335d5c21f4ed3c793..149fb58cd24c7505f908d515f3a6404b3fa45063 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/resources/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/resources/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html >index 1ce6e527b12178601fe75ef8e6eefee957bb208a..07b530657c339434aa924d1dfe96814fad2dbf3b 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html >@@ -80,6 +80,6 @@ function testShippingAddressChange() { > </li> > </ol> > <small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. > </small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-rejects-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-rejects-manual.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..5c1028eec667c8573df890d201d1f1b9136dde57 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-rejects-manual.https.html >@@ -0,0 +1,281 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>Test for PaymentRequest.show(optional detailsPromise) method</title> >+<link rel="help" href="https://w3c.github.io/browser-payment-api/#show-method"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+ // See function testBadUpdate() for test details! >+ setup({ >+ allow_uncaught_exception: true, >+ explicit_done: true, >+ explicit_timeout: true, >+ }); >+ >+ // == TEST DATA === >+ // PaymentMethod >+ const validMethod = Object.freeze({ >+ supportedMethods: "valid-but-wont-ever-match", >+ }); >+ >+ const validMethodBasicCard = Object.freeze({ >+ supportedMethods: "basic-card", >+ }); >+ >+ const validMethodApplePay = Object.freeze({ >+ supportedMethods: "https://apple.com/apple-pay", >+ }); >+ >+ // Methods >+ const validMethods = Object.freeze([ >+ validMethodBasicCard, >+ validMethod, >+ validMethodApplePay, >+ ]); >+ >+ // Amounts >+ const validAmount = Object.freeze({ >+ currency: "USD", >+ value: "1.00", >+ }); >+ >+ const invalidAmount = Object.freeze({ >+ currency: "¡INVALID!", >+ value: "A1.0", >+ }); >+ >+ const negativeAmount = Object.freeze({ >+ currency: "USD", >+ value: "-1.00", >+ }); >+ >+ // Totals >+ const validTotal = Object.freeze({ >+ label: "Valid Total", >+ amount: validAmount, >+ }); >+ >+ const invalidTotal = Object.freeze({ >+ label: "Invalid Total", >+ amount: invalidAmount, >+ }); >+ >+ const invalidNegativeTotal = Object.freeze({ >+ label: "Invalid negative total", >+ amount: negativeAmount, >+ }); >+ >+ // PaymentDetailsInit >+ const validDetails = Object.freeze({ >+ total: validTotal, >+ }); >+ >+ const invalidDetailsNegativeTotal = Object.freeze({ >+ total: invalidNegativeTotal, >+ }); >+ >+ // PaymentOptions >+ const validOptions = Object.freeze({ >+ requestShipping: true, >+ }); >+ >+ // PaymentItem >+ const validPaymentItem = Object.freeze({ >+ amount: validAmount, >+ label: "Valid payment item", >+ }); >+ >+ const invalidPaymentItem = Object.freeze({ >+ amount: invalidAmount, >+ label: "Invalid payment item", >+ }); >+ >+ // PaymentItem >+ const validPaymentItems = Object.freeze([validPaymentItem]); >+ const invalidPaymentItems = Object.freeze([invalidPaymentItem]); >+ >+ // PaymentShippingOption >+ const invalidShippingOption = Object.freeze({ >+ id: "abc", >+ label: "Invalid shipping option", >+ amount: invalidAmount, >+ selected: true, >+ }); >+ >+ // PaymentShippingOptions >+ const validShippingOption = Object.freeze({ >+ id: "abc", >+ label: "valid shipping option", >+ amount: validAmount, >+ }); >+ >+ const validShippingOptions = Object.freeze([validShippingOption]); >+ const invalidShippingOptions = Object.freeze([invalidShippingOption]); >+ >+ // PaymentDetailsModifier >+ const validModifier = Object.freeze({ >+ additionalDisplayItems: validPaymentItems, >+ supportedMethods: "valid-but-wont-ever-match", >+ total: validTotal, >+ }); >+ >+ const modifierWithInvalidDisplayItems = Object.freeze({ >+ additionalDisplayItems: invalidPaymentItems, >+ supportedMethods: "basic-card", >+ total: validTotal, >+ }); >+ >+ const modifierWithValidDisplayItems = Object.freeze({ >+ additionalDisplayItems: validPaymentItems, >+ supportedMethods: "basic-card", >+ total: validTotal, >+ }); >+ >+ const modifierWithInvalidTotal = Object.freeze({ >+ additionalDisplayItems: validPaymentItems, >+ supportedMethods: "basic-card", >+ total: invalidTotal, >+ }); >+ >+ const recursiveData = {}; >+ recursiveData.foo = recursiveData; >+ Object.freeze(recursiveData); >+ >+ const modifierWithRecursiveData = Object.freeze({ >+ supportedMethods: validMethodBasicCard, >+ total: validTotal, >+ data: recursiveData, >+ }); >+ // == END OF TEST DATA === >+ /* >+ These test work by creating a "valid" payment request and then >+ performing a bad update via `show(detailsPromise)`. >+ The `badDetails` cause detailsPromise to reject with `expectedError`. >+ */ >+ function testBadUpdate(testAssertion, badDetails, expectedError) { >+ promise_test(async t => { >+ const request = new PaymentRequest( >+ validMethods, >+ validDetails, >+ validOptions >+ ); >+ const detailsPromise = Promise.resolve(badDetails); >+ const acceptPromise = request.show(detailsPromise); >+ await promise_rejects( >+ t, >+ expectedError, >+ acceptPromise, >+ "badDetails must cause acceptPromise to reject with expectedError" >+ ); >+ }, testAssertion); >+ } >+</script> >+<h2> >+ PaymentRequest <code>.show(optional detailsPromise)</code> tests >+</h2> >+<h3> >+ Bad details - causes `detailsPromise` to reject. >+</h3> >+<p> >+ Click on each button in sequence from top to bottom without refreshing the page. >+ No payment sheet should be shown, as all provided values cause an error. >+</p> >+<p> >+ <strong> >+ If you see a payment sheet, it means the test has failed. >+ </strong> >+</p> >+<ol> >+ <li><button onclick=" >+ const rejectedPromise = Promise.reject(new SyntaxError('test')) >+ .catch(err => err); >+ testBadUpdate(this.textContent, rejectedPromise, 'AbortError'); >+ "> >+ Rejection of detailsPromise must abort the update with an 'AbortError' DOMException. >+ </button></li> >+ >+ <li><button onclick=" >+ const invalidDetails = { total: `this will cause a TypeError!` }; >+ testBadUpdate(this.textContent, invalidDetails, new TypeError()); >+ "> >+ Total in the update is a string, so converting to IDL must abort the update with a TypeError. >+ </button></li> >+ >+ <li><button onclick=" >+ const invalidDetails = { total: recursiveData }; >+ testBadUpdate(this.textContent, invalidDetails, new TypeError()); >+ "> >+ Total is recursive, so converting to IDL must abort the update with a TypeError. >+ </button></li> >+ >+ <li><button onclick=" >+ testBadUpdate(this.textContent, invalidDetailsNegativeTotal, new TypeError()); >+ "> >+ Updating with a negative total results in a TypeError. >+ </button></li> >+ >+ <li><button onclick=" >+ const badDetails = Object.assign({}, validDetails, { >+ displayItems: invalidPaymentItems >+ }); >+ testBadUpdate(this.textContent, badDetails, new RangeError()); >+ "> >+ Updating with a displayItem with an invalid currency results in RangeError. >+ </button></li> >+ >+ <li><button onclick=" >+ const duplicateShippingOptions = [validShippingOption, validShippingOption]; >+ const badDetails = Object.assign({}, validDetails, { >+ shippingOptions: duplicateShippingOptions, >+ }); >+ testBadUpdate(this.textContent, badDetails, new TypeError()); >+ "> >+ Updating with duplicate shippingOptions (same IDs) results in a TypeError. >+ </button></li> >+ <li><button onclick=" >+ const badDetails = Object.assign({}, validDetails, { >+ shippingOptions: invalidShippingOptions, >+ }); >+ testBadUpdate(this.textContent, badDetails, new RangeError()); >+ "> >+ Updating with a shippingOption with an invalid currency value results in a RangError. >+ </button></li> >+ >+ <li><button onclick=" >+ // validModifier is there as to avoid false positives >+ const badModifiers = { modifiers: [modifierWithInvalidTotal, validModifier] }; >+ const badDetails = Object.assign({}, validDetails, badModifiers); >+ testBadUpdate(this.textContent, badDetails, new RangeError()); >+ "> >+ Must throw a RangeError when a modifier's total item has an invalid currency. >+ </button></li> >+ >+ <li><button onclick=" >+ // validModifier is there as to avoid false positives >+ const badModifiers = { >+ modifiers: [modifierWithInvalidDisplayItems, validModifier], >+ }; >+ const badDetails = Object.assign({}, validDetails, badModifiers); >+ testBadUpdate(this.textContent, badDetails, new RangeError()); >+ "> >+ Must throw a RangeError when a modifier display item has an invalid currency. >+ </button></li> >+ >+ <li><button onclick=" >+ // validModifier is there as to avoid false positives >+ const badModifiers = { >+ modifiers: [modifierWithRecursiveData, validModifier], >+ }; >+ const badDetails = Object.assign({}, validDetails, badModifiers); >+ testBadUpdate(this.textContent, badDetails, new TypeError()); >+ "> >+ Must throw as Modifier has a recursive dictionary. >+ </button></li> >+ >+ <li><button onclick="done();">Done!</button></li> >+</ol> >+ >+<small> >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. >+</small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-resolves-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-resolves-manual.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..70c97faaf7a4496982a382a415e3a85e9a17c465 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-resolves-manual.https.html >@@ -0,0 +1,319 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>Test for PaymentRequest.show(optional promise) method</title> >+<link rel="help" href="https://w3c.github.io/browser-payment-api/#show-method"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+"use strict"; >+setup({ >+ allow_uncaught_exception: true, >+ explicit_done: true, >+ explicit_timeout: true, >+}); >+ >+// DATA USED BY TESTS >+// PaymentMethods >+const validMethods = Object.freeze([ >+ { >+ supportedMethods: "valid-but-wont-ever-match", >+ }, >+ { >+ supportedMethods: "basic-card", >+ }, >+ { >+ supportedMethods: "https://apple.com/apple-pay", >+ }, >+]); >+ >+// Amounts >+const failAmount = Object.freeze({ >+ currency: "USD", >+ value: "1.00", >+}); >+const passAmount = Object.freeze({ >+ currency: "CAD", >+ value: "50.00", >+}); >+const neutralAmount = Object.freeze({ >+ currency: "AUD", >+ value: "0.00", >+}); >+ >+// Labels >+const failLabel = "ð¥ TEST HAS FAILED ð¥"; >+const passLabel = "â TEST HAS PASSED â "; >+const neutralLabel = "Ignore this label"; >+// Totals >+const failTotal = Object.freeze({ >+ label: failLabel, >+ amount: failAmount, >+}); >+const passTotal = Object.freeze({ >+ label: passLabel, >+ amount: passAmount, >+}); >+const neutralTotal = Object.freeze({ >+ label: neutralLabel, >+ amount: passAmount, >+}); >+ >+// PaymentItem >+const failPaymentItem = Object.freeze({ >+ amount: failAmount, >+ label: failLabel, >+}); >+const failPaymentItems = Object.freeze([failPaymentItem]); >+ >+const passPaymentItem = Object.freeze({ >+ amount: passAmount, >+ label: passLabel, >+}); >+const passPaymentItems = Object.freeze([passPaymentItem]); >+ >+// PaymentShippingOptions >+const failShippingOption = Object.freeze({ >+ id: "fail", >+ label: failLabel, >+ amount: failAmount, >+}); >+const failShippingOptions = Object.freeze([failShippingOption]); >+ >+const neutralShippingOption = Object.freeze({ >+ id: "neutral", >+ label: neutralLabel, >+ amount: neutralAmount, >+}); >+ >+const updatedShippingOption1 = Object.freeze({ >+ id: "updated-1", >+ label: `${passLabel} - option 1`, >+ amount: passAmount, >+}); >+const updatedShippingOption2 = Object.freeze({ >+ id: "updated-2", >+ label: `${passLabel} - option 2 (MUST BE SELECTED!)`, >+ amount: passAmount, >+ selected: true, >+}); >+const passShippingOptions = Object.freeze([ >+ updatedShippingOption1, >+ updatedShippingOption2, >+]); >+ >+// Modifiers >+// create a modifier objects for each validMethods >+// and single additional display item >+const failModifiers = validMethods.map(modifier => { >+ const label = `${failLabel} - (${modifier.supportedMethods})`; >+ return { >+ ...modifier, >+ total: { >+ ...failTotal, >+ label, >+ }, >+ additionalDisplayItems: [ >+ { >+ ...failPaymentItem, >+ label, >+ }, >+ ], >+ }; >+}); >+// Updates the total for each, and changes the additionalDisplayItems >+const passModifiers = failModifiers.map(modifier => { >+ const label = `${passLabel} - (${modifier.supportedMethods})`; >+ return { >+ ...modifier, >+ total: { >+ ...passTotal, >+ label, >+ }, >+ additionalDisplayItems: [ >+ { >+ ...passPaymentItem, >+ label, >+ }, >+ ], >+ }; >+}); >+ >+// PaymentDetailsInit >+const failDetails = Object.freeze({ >+ displayItems: failPaymentItems, >+ id: "this cannot be changed", >+ modifiers: failModifiers, >+ shippingOptions: failShippingOptions, >+ total: failTotal, >+}); >+ >+const neutralDetails = Object.freeze({ >+ displayItems: [], >+ modifiers: [], >+ shippingOptions: [neutralShippingOption], >+ total: neutralTotal, >+}); >+ >+function smokeTest() { >+ promise_test(async t => { >+ const request = new PaymentRequest(validMethods, failDetails); >+ await promise_rejects( >+ t, >+ new TypeError(), >+ request.show({ >+ total: "This throws a TypeError", >+ }), >+ "expected TypeError" >+ ); >+ }, "smoke test - checks if the optional details are supported on show() method"); >+} >+ >+function runUpdateDetailsAlgorithm( >+ buttonElement, >+ details, >+ options = { >+ requestShipping: true, >+ } >+) { >+ const testAssertion = buttonElement.textContent.trim(); >+ buttonElement.disabled = true; >+ promise_test(async t => { >+ const request = new PaymentRequest(validMethods, failDetails, options); >+ const detailsPromise = Promise.resolve(details); >+ const acceptPromise = request.show(detailsPromise); >+ assert_equals(request.id, "this cannot be changed", "id must never change."); >+ await promise_rejects( >+ t, >+ "AbortError", >+ acceptPromise, >+ "expected AbortError" >+ ); >+ }, testAssertion); >+} >+</script> >+<h2> >+ PaymentRequest <code>.show(optional detailsPromise)</code> tests >+</h2> >+<p> >+ These test cause <code>detailsPromise</code> to resolve successfully with some updated value. As such, that will cause >+ something in the payment sheet to change. Each test describes what is expected to change - if anything. >+</p> >+<p> >+ <strong>Instructions:</strong> Click on each button in sequence from top to bottom without refreshing the page. The payment >+ sheet will be shown. If required, confirm that the expected value appears in the payment sheet. Finally, manually abort/cancel >+ the payment request by closing the payment sheet. >+</p> >+<ol> >+ <li><button onclick="smokeTest()">If the payment sheet is shown, the test has failed.</button></li> >+ <li><button onclick=" >+ const details = { >+ ...neutralDetails, >+ id: 'fail', >+ }; >+ runUpdateDetailsAlgorithm(this, details); >+ "> >+ When the payment sheet is shown, the provided `id` must have no effect on the payment request. >+ </button></li> >+ <li><button onclick=" >+ const details = { >+ ...neutralDetails, >+ total: passTotal >+ }; >+ runUpdateDetailsAlgorithm(this, details); >+ "> >+ When the payment sheet is shown, the total must be CAD$50 with the label "â TEST HAS PASSED â ". >+ </button></li> >+ <li><button onclick=" >+ const details = { >+ ...neutralDetails, >+ displayItems: passPaymentItems, >+ }; >+ runUpdateDetailsAlgorithm(this, details); >+ "> >+ When the payment sheet is shown, there must be a one display item with a value of CAD$50 with the label "â TEST HAS PASSED â ". >+ </button> >+ </li> >+ <li><button onclick=" >+ const auItem = { >+ ...passPaymentItem, >+ amount: { value: '40', currency: 'AUD'}, >+ pending: true >+ } >+ const details = { >+ ...neutralDetails, >+ displayItems: passPaymentItems.concat(auItem), >+ }; >+ runUpdateDetailsAlgorithm(this, details); >+ "> >+ When the payment sheet is shown, there must be >+ two display items: One with a value of CAD$50, another with >+ value AUD$40 that is pending. >+ </button> >+ </li> >+ <li><button onclick=" >+ const details = { >+ ...neutralDetails, >+ shippingOptions: [updatedShippingOption1], >+ }; >+ runUpdateDetailsAlgorithm(this, details); >+ "> >+ When the payment sheet is shown, there must be a one shipping option >+ with a value of CAD$50. >+ </button> >+ </li> >+ <li><button onclick=" >+ const details = { >+ ...neutralDetails, >+ shippingOptions: passShippingOptions, >+ }; >+ runUpdateDetailsAlgorithm(this, details); >+ "> >+ When the payment sheet is shown, there must be >+ two shipping options: One with a value of CAD$50, another with >+ value AUD$40 that is selected. >+ </button> >+ </li> >+ <li><button onclick=" >+ const details = { >+ ...neutralDetails, >+ modifiers: passModifiers, >+ }; >+ runUpdateDetailsAlgorithm(this, details); >+ "> >+ When the payment sheet is shown, the total should be CAD$50. >+ </button> >+ </li> >+ <li> >+ <button onclick=" >+ const details = { >+ ...neutralDetails, >+ shippingOptions: [], >+ error: passLabel, >+ }; >+ runUpdateDetailsAlgorithm(this, details); >+ "> >+ When the payment sheet is shown, the string "â TEST HAS PASSED â " should be shown >+ somewhere in the user interface. Alternatively, the payment sheet must indicate to the >+ end user that it's not possible to ship their order. >+ </button> >+ </li> >+ <li> >+ <button onclick=" >+ const details = { >+ ...neutralDetails, >+ error: failLabel, >+ }; >+ runUpdateDetailsAlgorithm(this, details, {requestShipping: false}); >+ "> >+ When the payment sheet is shown, there should not be any errors shown. >+ </button> >+ </li> >+ <li> >+ <button onclick="done();">Done!</button> >+ </li> >+</ol> >+ >+<small> >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. >+</small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-postmessage-iframe.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-postmessage-iframe.html >new file mode 100644 >index 0000000000000000000000000000000000000000..12a1e0cef82886f0514cae56eb9f4e11321ab5de >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-postmessage-iframe.html >@@ -0,0 +1,40 @@ >+<h1>This iframe calls shows() via postMessage()</h1> >+<script> >+"use strict"; >+const defaultMethods = Object.freeze([ >+ { supportedMethods: "basic-card" }, >+ { supportedMethods: "https://apple.com/apple-pay" }, >+]); >+ >+const defaultDetails = Object.freeze({ >+ id: "fail", >+ total: { >+ label: "Total", >+ amount: { >+ currency: "USD", >+ value: "1.00", >+ }, >+ }, >+}); >+ >+// We are going to use the id to prove that this works >+// which we will pass back to the caller >+window.onmessage = async event => { >+ const { source, data: { id, request } } = event; >+ switch (request) { >+ case "show-payment-request": { >+ const details = Object.assign({}, defaultDetails, { id }); >+ const request = new PaymentRequest(defaultMethods, details); >+ try { >+ const response = await request.show(); >+ source.postMessage(response.toJSON(), window.location.origin); >+ await response.complete(); >+ } catch (err) { >+ source.postMessage({ requestId: "fail" }, window.location.origin); >+ await request.abort(); >+ } >+ } >+ } >+}; >+ >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-postmessage-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-postmessage-manual.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e4ab550e4189e1518a4b601aa4c9e249df4c5ecd >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-postmessage-manual.https.html >@@ -0,0 +1,81 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<title>Test for PaymentRequest.show() method</title> >+<link rel="help" href="https://w3c.github.io/browser-payment-api/#show-method"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+"use strict"; >+setup({ >+ explicit_done: true, >+ explicit_timeout: true, >+ allow_uncaught_exception: true, >+}); >+ >+const defaultMethods = Object.freeze([ >+ { supportedMethods: "basic-card" }, >+ { supportedMethods: "https://apple.com/apple-pay" }, >+]); >+ >+const defaultDetails = Object.freeze({ >+ id: "fail", >+ total: { >+ label: "Total", >+ amount: { >+ currency: "USD", >+ value: "1.00", >+ }, >+ }, >+}); >+ >+test(() => { >+ assert_throws( >+ "SecurityError", >+ () => { >+ const request = new PaymentRequest(defaultMethods, defaultDetails); >+ request.show(); // <--- should throw here >+ request.abort(); >+ }, >+ "throws a SecurityError if not triggered by user activation" >+ ); >+}); >+ >+async function runUserActivation(button) { >+ button.disabled = true; >+ const { contentWindow: iframeWindow } = document.getElementById("iframe"); >+ const expectedId = "pass123"; >+ await Promise.resolve(); // next tick >+ const promiseForResponse = new Promise(resolve => { >+ window.onmessage = ({ data: { requestId } }) => resolve(requestId); >+ }); >+ const ops = { id: expectedId, request: "show-payment-request" }; >+ iframeWindow.postMessage(ops, window.location.origin); >+ promise_test(async () => { >+ const actualId = await promiseForResponse; >+ assert_equals(actualId, expectedId, "ids must match"); >+ }, button.textContent.trim()); >+ done(); >+} >+ >+</script> >+<h2>Test PaymentRequest.show() triggered by user activation using postMessage()</h2> >+<p> >+ Tests that user activation works over postMessage(). >+</p> >+<p> >+ Click on bottom below. Hit "Pay". >+</p> >+<ol> >+ <li> >+ <button onclick="runUserActivation(this)"> >+ show() is triggered by user activation passed through postMessage() and a promise >+ </button> >+ </li> >+</ol> >+<iframe width="100%" id="iframe" src="show-method-postmessage-iframe.html" allowpaymentrequest></iframe> >+<p> >+ <small> >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. >+ </small> >+</p> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html >index adc3d6aaefdbbf134d05999234611d4ea7476d0b..06852bf8c47cb9e720190b9b0e2f81d9e7ddd335 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html >@@ -126,6 +126,6 @@ function manualTest(button, { invalidMethod }) { > </li> > </ol> > <small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. > </small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html >index bfc83ab942c4cf585bbb5dcc7c26829aa5c15612..0ba0405c52fbd5805a36d2707618dc84a7111351 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html >@@ -65,6 +65,6 @@ async function runAbortTest(button) { > </li> > </ol> > <small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. > </small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html b/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html >index c4d390f273d8a8d8d8df13fc923e52e1d8f1e4d4..abaf6cb4e8580df5c6034e8b137ae8fc343067a6 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html >@@ -215,6 +215,6 @@ function testAcceptRequestAlgorithm( > </ol> > </section> > <small> >- If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a> >- and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>. >+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> >+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. > </small> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/payment-request/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/payment-request/w3c-import.log >index dfabbd2ad85007f0cc5b1b1a1219805e5caa8178..151f01c4bf25e09ac96fc903162e84dbe862800a 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/payment-request/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/payment-request/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >@@ -14,18 +14,22 @@ Property values requiring vendor prefixes: > None > ------------------------------------------------------------------------ > List of files: >-/LayoutTests/imported/w3c/web-platform-tests/payment-request/OWNERS >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/META.yml > /LayoutTests/imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-select-last-manual.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/historical.https.html >-/LayoutTests/imported/w3c/web-platform-tests/payment-request/interfaces.https.html >-/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method-manual.https.html >-/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-manual.https.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/idlharness.https.window.js >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor-crash.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-currency-code-checks.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-pmi-handling.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-id-attribute.https.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-insecure.http.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-not-exposed.https.worker.js > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-onshippingaddresschange-attribute.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-onshippingoptionchange-attribute.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-shippingAddress-attribute.https.html >@@ -34,6 +38,10 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-rejects-manual.https.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-resolves-manual.https.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-postmessage-iframe.html >+/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-postmessage-manual.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html > /LayoutTests/imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html >diff --git a/LayoutTests/platform/mac-wk2/TestExpectations b/LayoutTests/platform/mac-wk2/TestExpectations >index 555d7e19eda01f47184ec7ac922e0c38bacc4bd4..2aa97de2d771af4e6185c88ab89a88625e502c93 100644 >--- a/LayoutTests/platform/mac-wk2/TestExpectations >+++ b/LayoutTests/platform/mac-wk2/TestExpectations >@@ -46,18 +46,28 @@ imported/w3c/web-platform-tests/payment-request/payment-request-show-method.http > imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html [ WontFix ] > > # skip manual payment-request tests >+imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html [ Skip ] >+imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html [ Skip ] >+imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-shippingAddress-member-manual.https.html [ Skip ] > imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html [ Skip ] > imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html [ Skip ] >+imported/w3c/web-platform-tests/payment-request/change-shipping-option-select-last-manual.https.html [ Skip ] > imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html [ Skip ] > imported/w3c/web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html [ Skip ] >+imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.manual.https.html [ Skip ] > imported/w3c/web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html [ Skip ] > imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html [ Skip ] > imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html [ Skip ] >+imported/w3c/web-platform-tests/payment-request/payment-response/rejects_if_not_active-manual.https.html [ Skip ] > imported/w3c/web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html [ Skip ] >+imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html [ Skip ] > imported/w3c/web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html [ Skip ] > imported/w3c/web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html [ Skip ] > imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html [ Skip ] > imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html [ Skip ] >+imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-rejects-manual.https.html [ Skip ] >+imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-resolves-manual.https.html [ Skip ] >+imported/w3c/web-platform-tests/payment-request/show-method-postmessage-manual.https.html [ Skip ] > imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html [ Skip ] > imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html [ Skip ] > imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html [ Skip ]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188985
:
348156
| 348157