Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (237994 => 237995)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2018-11-08 19:49:01 UTC (rev 237994)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2018-11-08 19:53:53 UTC (rev 237995)
@@ -1,3 +1,24 @@
+2018-11-08 Andy Estes <[email protected]>
+
+ [Payment Request] Update web platform tests
+ https://bugs.webkit.org/show_bug.cgi?id=191426
+
+ Updated web-platform-tests/payment-request/ to match wpt as of commit 577284e.
+
+ Reviewed by Jiewen Tan.
+
+ * resources/import-expectations.json:
+ * web-platform-tests/payment-request/META.yml:
+ * web-platform-tests/payment-request/payment-request-abort-method.https.html:
+ * web-platform-tests/payment-request/payment-request-canmakepayment-method-protection.https-expected.txt: Added.
+ * web-platform-tests/payment-request/payment-request-canmakepayment-method-protection.https.html: Added.
+ * web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html:
+ * web-platform-tests/payment-request/payment-request-constructor.https.html:
+ * web-platform-tests/payment-request/payment-request-id-attribute.https.html:
+ * web-platform-tests/payment-request/payment-response/retry-method-manual.https.html:
+ * web-platform-tests/payment-request/rejects_if_not_active.https.html:
+ * web-platform-tests/payment-request/w3c-import.log:
+
2018-11-07 Youenn Fablet <[email protected]>
Allow setting RTCRtpTransceiver.direction
Modified: trunk/LayoutTests/imported/w3c/resources/import-expectations.json (237994 => 237995)
--- trunk/LayoutTests/imported/w3c/resources/import-expectations.json 2018-11-08 19:49:01 UTC (rev 237994)
+++ trunk/LayoutTests/imported/w3c/resources/import-expectations.json 2018-11-08 19:53:53 UTC (rev 237995)
@@ -354,4 +354,4 @@
"web-platform-tests/worklets": "skip",
"web-platform-tests/x-frame-options": "skip",
"web-platform-tests/xhr": "import"
-}
+}
\ No newline at end of file
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/META.yml (237994 => 237995)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/META.yml 2018-11-08 19:49:01 UTC (rev 237994)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/META.yml 2018-11-08 19:53:53 UTC (rev 237995)
@@ -3,6 +3,7 @@
- marcoscaceres
- rsolomakhin
- domenic
- - MSFTkihans
+ - zouhir
- mnoorenberghe
- romandev
+ - edenchuang
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html (237994 => 237995)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html 2018-11-08 19:49:01 UTC (rev 237994)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html 2018-11-08 19:53:53 UTC (rev 237995)
@@ -36,41 +36,41 @@
}, `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());
- });
-});
+ const request = new PaymentRequest(defaultMethods, defaultDetails);
+ const acceptPromise = test_driver.bless("show payment request", () =>
+ 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());
+}, "The same request cannot be shown multiple times.");
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);
- });
-});
+ // 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 = test_driver.bless("show payment request", () =>
+ 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);
+}, "Aborting a request before it is shown doesn't prevent it from being shown later.");
promise_test(async t => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-protection.https-expected.txt (0 => 237995)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-protection.https-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-protection.https-expected.txt 2018-11-08 19:53:53 UTC (rev 237995)
@@ -0,0 +1,4 @@
+If you find a buggy test, please file a bug and tag one of the suggested reviewers.
+
+PASS Optionally, at the user agent's discretion, return a promise rejected with a "NotAllowedError" DOMException.
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-protection.https.html (0 => 237995)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-protection.https.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-protection.https.html 2018-11-08 19:53:53 UTC (rev 237995)
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Tests for PaymentRequest.canMakePayment() method</title>
+<link rel="help" href=""
+<script src=""
+<script src=""
+<script src=''></script>
+<script src=""
+<script>
+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 => {
+ // 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.`);
+</script>
+
+<small>
+ If you find a buggy test, please <a href="" a bug</a>
+ and tag one of the <a href="" reviewers</a>.
+</small>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html (237994 => 237995)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html 2018-11-08 19:49:01 UTC (rev 237994)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html 2018-11-08 19:53:53 UTC (rev 237995)
@@ -8,7 +8,10 @@
<script src=""
<script>
const basicCard = Object.freeze({ supportedMethods: "basic-card" });
-const defaultMethods = Object.freeze([basicCard]);
+const applePay = Object.freeze({
+ supportedMethods: "https://apple.com/apple-pay",
+});
+const defaultMethods = Object.freeze([basicCard, applePay]);
const defaultDetails = Object.freeze({
total: {
label: "Total",
@@ -19,10 +22,68 @@
},
});
+const unsupportedMethods = [
+ { supportedMethods: "this-is-not-supported" },
+ { supportedMethods: "https://not.supported" },
+];
+
promise_test(async t => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
+ assert_true(
+ await request.canMakePayment(),
+ "one of the methods should be supported"
+ );
+}, `If payment method identifier are supported, resolve promise with true.`);
+
+promise_test(async t => {
+ const request = new PaymentRequest(defaultMethods, defaultDetails);
+ const acceptPromise = test_driver.bless("show payment request", () => {
+ 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(async t => {
+ const request = new PaymentRequest(defaultMethods, defaultDetails);
+ const acceptPromise = test_driver.bless("show payment request", () => {
+ request.show(); // Sets state to "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.');
+
+promise_test(async t => {
+ const request = new PaymentRequest(defaultMethods, defaultDetails);
+ try {
+ assert_true(
await request.canMakePayment(),
`canMakePaymentPromise should be true`
);
@@ -40,144 +101,20 @@
}, `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.`);
+ const noneSupported = new PaymentRequest(
+ unsupportedMethods,
+ defaultDetails
+ ).canMakePayment();
+ assert_false(await noneSupported, `methods must not be supported`);
+}, "All methods are unsupported");
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" }],
+ const someSupported = new PaymentRequest(
+ [...unsupportedMethods, ...defaultMethods],
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.");
+ ).canMakePayment();
+ assert_true(await someSupported, `At least one method is expected to be supported.`);
+}, `Mix of supported and unsupported methods, at least one method is supported.`);
</script>
<small>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.html (237994 => 237995)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.html 2018-11-08 19:49:01 UTC (rev 237994)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.html 2018-11-08 19:53:53 UTC (rev 237995)
@@ -283,9 +283,6 @@
[
{
supportedMethods: "https://wpt.fyi/payment-request",
- data: {
- supportedTypes: ["debit"],
- },
},
],
{
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-id-attribute.https.html (237994 => 237995)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-id-attribute.https.html 2018-11-08 19:49:01 UTC (rev 237994)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-id-attribute.https.html 2018-11-08 19:53:53 UTC (rev 237995)
@@ -20,7 +20,7 @@
// Test for https://github.com/w3c/payment-request/pull/665
test(() => {
- const uuidRegExp = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-4][0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
+ const uuidRegExp = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
const request1 = new PaymentRequest(methods, {
total,
});
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html (237994 => 237995)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html 2018-11-08 19:49:01 UTC (rev 237994)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html 2018-11-08 19:53:53 UTC (rev 237995)
@@ -28,7 +28,7 @@
return promise_rejects(
t,
"InvalidStateError",
- response.retry({}),
+ response.retry(),
"response.[[complete]] is true, so rejects with InvalidStateError."
);
}, button.textContent.trim());
@@ -38,11 +38,11 @@
button.disabled = true;
promise_test(async t => {
const { response } = await getPaymentRequestResponse();
- const retryPromise = response.retry({});
+ const retryPromise = response.retry();
await promise_rejects(
t,
"InvalidStateError",
- response.retry({}),
+ response.retry(),
"Calling retry() again rejects with an InvalidStateError"
);
await retryPromise;
@@ -54,7 +54,7 @@
button.disabled = true;
promise_test(async t => {
const { response } = await getPaymentRequestResponse();
- const retryPromise = response.retry({});
+ const retryPromise = response.retry();
await promise_rejects(
t,
"InvalidStateError",
@@ -70,7 +70,7 @@
button.disabled = true;
promise_test(async t => {
const { response, request } = await getPaymentRequestResponse();
- const retryPromise = response.retry({});
+ const retryPromise = response.retry();
await promise_rejects(
t,
"InvalidStateError",
@@ -87,12 +87,12 @@
promise_test(async t => {
const { response } = await getPaymentRequestResponse();
assert_equals(
- await response.retry({}),
+ await response.retry(),
undefined,
"Expected undefined as the resolve value"
);
assert_equals(
- await response.retry({}),
+ await response.retry(),
undefined,
"Expected undefined as the resolve value"
);
@@ -100,7 +100,7 @@
await promise_rejects(
t,
"InvalidStateError",
- response.retry({}),
+ response.retry(),
"Calling retry() after complete() rejects with a InvalidStateError"
);
}, button.textContent.trim());
@@ -113,13 +113,13 @@
await promise_rejects(
t,
"AbortError",
- response.retry({}),
+ response.retry(),
"The user aborting a retry rejects with a AbortError"
);
await promise_rejects(
t,
"InvalidStateError",
- response.retry({}),
+ response.retry(),
"After the user aborts, response [[complete]] is true so retry() must reject with InvalidStateError"
);
await promise_rejects(
@@ -154,7 +154,7 @@
resolve();
};
});
- const retryPromise = response.retry({});
+ const retryPromise = response.retry();
await shippingChangedPromise;
await promise_rejects(
t,
@@ -175,11 +175,11 @@
button.disabled = true;
promise_test(async t => {
const { response } = await getPaymentRequestResponse();
- const retryPromise = response.retry({});
+ const retryPromise = response.retry();
const promises = new Set([
retryPromise,
- response.retry({}),
- response.retry({}),
+ response.retry(),
+ response.retry(),
]);
assert_equals(promises.size, 3, "Must have three unique objects");
await retryPromise;
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html (237994 => 237995)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html 2018-11-08 19:49:01 UTC (rev 237994)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html 2018-11-08 19:53:53 UTC (rev 237995)
@@ -4,6 +4,8 @@
<title>PaymentRequest show() rejects if doc is not fully active</title>
<script src=""
<script src=""
+<script src=""
+<script src=""
<link rel="help" href=""
<body>
<script>
@@ -39,50 +41,45 @@
}
promise_test(async t => {
- // Check that PaymentRequests can be constructed.
- new PaymentRequest(validMethods, validDetails);
const iframe = document.createElement("iframe");
iframe.allowPaymentRequest = true;
document.body.appendChild(iframe);
-
// We first got to page1.html, grab a PaymentRequest instance.
const request1 = await getLoadedPaymentRequest(
iframe,
"/payment-request/resources/page1.html"
);
-
// We navigate the iframe again, putting request1's document into an inactive state.
const request2 = await getLoadedPaymentRequest(
iframe,
"/payment-request/resources/page2.html"
);
-
- // Now, request1's relevant global object's document is no longer active.
- // So, call .show(), and make sure it rejects appropriately.
- await promise_rejects(
- t,
- "AbortError",
- request1.show(),
- "Inactive document, so must throw AbortError"
- );
-
- // request2 has an active document tho, so confirm it's working as expected:
- request2.show();
- await request2.abort();
- await promise_rejects(
- t,
- "InvalidStateError",
- request2.show(),
- "Abort already called, so InvalidStateError"
- );
- // We are done, so clean up.
- iframe.remove();
+ await test_driver.bless("show payment request", async () => {
+ // Now, request1's relevant global object's document is no longer active.
+ // So, call .show(), and make sure it rejects appropriately.
+ await promise_rejects(
+ t,
+ "AbortError",
+ request1.show(),
+ "Inactive document, so must throw AbortError"
+ );
+ });
+ await test_driver.bless("show payment request", async () => {
+ // request2 has an active document tho, so confirm it's working as expected:
+ request2.show();
+ await request2.abort();
+ await promise_rejects(
+ t,
+ "InvalidStateError",
+ request2.show(),
+ "Abort already called, so InvalidStateError"
+ );
+ // We are done, so clean up.
+ iframe.remove();
+ });
}, "PaymentRequest.show() aborts if the document is not active");
promise_test(async t => {
- // check that PaymentRequests can be constructed (smoke test).
- new PaymentRequest(validMethods, validDetails);
-
// We nest two iframes and wait for them to load.
const outerIframe = document.createElement("iframe");
outerIframe.allowPaymentRequest = true;
@@ -112,6 +109,10 @@
outerIframe.addEventListener("load", resolve);
outerIframe.src = ""
});
+
+ const showPromise = await test_driver.bless("show payment request", () => {
+ return request.show();
+ });
// Now, request's relevant global object's document is still active
// (it is the active document of the inner iframe), but is not fully active
// (since the parent of the inner iframe is itself no longer active).
@@ -119,16 +120,15 @@
await promise_rejects(
t,
"AbortError",
- request.show(),
+ showPromise,
"Active, but not fully active, so must throw AbortError"
);
// We are done, so clean up.
+
iframe.remove();
}, "PaymentRequest.show() aborts if the document is active, but not fully active");
promise_test(async t => {
- // Check that PaymentRequests can be constructed.
- new PaymentRequest(validMethods, validDetails);
const iframe = document.createElement("iframe");
iframe.allowPaymentRequest = true;
document.body.appendChild(iframe);
@@ -137,8 +137,9 @@
iframe,
"/payment-request/resources/page1.html"
);
- // Present the payment sheet.
- const showPromise = request.show();
+ const showPromise = await test_driver.bless("show payment request", () => {
+ return request.show();
+ });
// Navigate the iframe to a new location. Wait for the load event to fire.
await new Promise(resolve => {
iframe.addEventListener("load", resolve);
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/w3c-import.log (237994 => 237995)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/w3c-import.log 2018-11-08 19:49:01 UTC (rev 237994)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/w3c-import.log 2018-11-08 19:53:53 UTC (rev 237995)
@@ -23,6 +23,7 @@
/LayoutTests/imported/w3c/web-platform-tests/payment-request/onmerchantvalidation-attribute.https.html
/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-protection.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