Changeset 264239 in webkit
- Timestamp:
- Jul 10, 2020, 2:48:27 PM (6 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 25 added
- 60 edited
- 1 copied
- 7 moved
-
ChangeLog (modified) (1 diff)
-
TestExpectations (modified) (1 diff)
-
imported/w3c/ChangeLog (modified) (1 diff)
-
imported/w3c/resources/resource-files.json (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/META.yml (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/complete-method.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.https-expected.txt (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.https.html (modified) (4 diffs)
-
imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html (modified) (2 diffs)
-
imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-call-immediate-manual.https.html (modified) (6 diffs)
-
imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-duplicate-shipping-options-manual.https.html (modified) (2 diffs)
-
imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-incremental-update-manual.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-method-abort-update-manual.https.html (modified) (14 diffs)
-
imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-state-checks-manual.https.html (modified) (3 diffs)
-
imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html (modified) (3 diffs)
-
imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-shippingAddress-member-manual.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html (modified) (2 diffs)
-
imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/active-document-cross-origin.https.sub-expected.txt (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/active-document-cross-origin.https.sub.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/active-document-same-origin.https-expected.txt (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/active-document-same-origin.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/removing-allowpaymentrequest.https.sub.html (modified) (2 diffs)
-
imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html (modified) (2 diffs)
-
imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest.https.sub.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/billing-address-changed-manual.https-expected.txt (added)
-
imported/w3c/web-platform-tests/payment-request/billing-address-changed-manual.https.html (added)
-
imported/w3c/web-platform-tests/payment-request/blank.html (added)
-
imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/change-shipping-option-select-last-manual.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/constructor_convert_method_data.https.html (modified) (2 diffs)
-
imported/w3c/web-platform-tests/payment-request/dynamically-change-shipping-options-manual.https-expected.txt (added)
-
imported/w3c/web-platform-tests/payment-request/dynamically-change-shipping-options-manual.https.html (added)
-
imported/w3c/web-platform-tests/payment-request/historical.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/onmerchantvalidation-attribute.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/onpaymentmethodchange-attribute.https-expected.txt (moved) (moved from trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https-expected.txt )
-
imported/w3c/web-platform-tests/payment-request/onpaymentmethodchange-attribute.https.html (moved) (moved from trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https.html ) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/payment-is-showing.https-expected.txt (added)
-
imported/w3c/web-platform-tests/payment-request/payment-is-showing.https.html (added)
-
imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html (modified) (4 diffs)
-
imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-protection.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https-expected.txt (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html (modified) (3 diffs)
-
imported/w3c/web-platform-tests/payment-request/payment-request-constructor-thcrash.https-expected.txt (moved) (moved from trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor-crash.https-expected.txt )
-
imported/w3c/web-platform-tests/payment-request/payment-request-constructor-thcrash.https.html (moved) (moved from trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor-crash.https.html ) (2 diffs)
-
imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.sub-expected.txt (added)
-
imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.sub.html (moved) (moved from trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.html ) (21 diffs)
-
imported/w3c/web-platform-tests/payment-request/payment-request-ctor-currency-code-checks.https.sub-expected.txt (added)
-
imported/w3c/web-platform-tests/payment-request/payment-request-ctor-currency-code-checks.https.sub.html (moved) (moved from trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-currency-code-checks.https.html ) (19 diffs)
-
imported/w3c/web-platform-tests/payment-request/payment-request-ctor-pmi-handling.https.sub-expected.txt (added)
-
imported/w3c/web-platform-tests/payment-request/payment-request-ctor-pmi-handling.https.sub.html (moved) (moved from trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-pmi-handling.https.html ) (4 diffs)
-
imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method-manual.tentative.https-expected.txt (added)
-
imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method-manual.tentative.https.html (added)
-
imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method-protection.tentative.https-expected.txt (added)
-
imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method-protection.tentative.https.html (copied) (copied from trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-protection.https.html ) (3 diffs)
-
imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https-expected.txt (added)
-
imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https.html (added)
-
imported/w3c/web-platform-tests/payment-request/payment-request-onshippingaddresschange-attribute.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/payment-request-onshippingoptionchange-attribute.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/payment-request-shippingType-attribute.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html (modified) (3 diffs)
-
imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html (modified) (5 diffs)
-
imported/w3c/web-platform-tests/payment-request/payment-response/helpers.js (modified) (2 diffs)
-
imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute-manual.https.html (modified) (3 diffs)
-
imported/w3c/web-platform-tests/payment-request/payment-response/payerdetailschange-updateWith-immediate-manual.https-expected.txt (added)
-
imported/w3c/web-platform-tests/payment-request/payment-response/payerdetailschange-updateWith-immediate-manual.https.html (added)
-
imported/w3c/web-platform-tests/payment-request/payment-response/payerdetailschange-updateWith-manual.https-expected.txt (added)
-
imported/w3c/web-platform-tests/payment-request/payment-response/payerdetailschange-updateWith-manual.https.html (added)
-
imported/w3c/web-platform-tests/payment-request/payment-response/rejects_if_not_active-manual.https.html (modified) (3 diffs)
-
imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html (modified) (11 diffs)
-
imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-warnings-manual.https-expected.txt (added)
-
imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-warnings-manual.https.html (added)
-
imported/w3c/web-platform-tests/payment-request/payment-response/w3c-import.log (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/rejects_if_not_active-manual.https-expected.txt (added)
-
imported/w3c/web-platform-tests/payment-request/rejects_if_not_active-manual.https.html (added)
-
imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html (modified) (4 diffs)
-
imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html (modified) (2 diffs)
-
imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-rejects-manual.https.html (modified) (11 diffs)
-
imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-resolves-manual.https.html (modified) (4 diffs)
-
imported/w3c/web-platform-tests/payment-request/show-method-postmessage-iframe.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/show-method-postmessage-manual.https.html (modified) (1 diff)
-
imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html (modified) (5 diffs)
-
imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html (modified) (2 diffs)
-
imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html (modified) (4 diffs)
-
imported/w3c/web-platform-tests/payment-request/w3c-import.log (modified) (2 diffs)
-
platform/ios-wk2/TestExpectations (modified) (1 diff)
-
platform/mac-wk1/imported/w3c/web-platform-tests/payment-request (added)
-
platform/mac-wk1/imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https-expected.txt (added)
-
platform/mac-wk2/TestExpectations (modified) (1 diff)
-
tests-options.json (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r264235 r264239 1 2020-07-10 Chris Dumez <cdumez@apple.com> 2 3 Resync web-platform-tests/payment-request from upstream 4 https://bugs.webkit.org/show_bug.cgi?id=214167 5 6 Reviewed by Sam Weinig. 7 8 * tests-options.json: 9 1 10 2020-07-10 Chris Fleizach <cfleizach@apple.com> 2 11 -
trunk/LayoutTests/TestExpectations
r264223 r264239 337 337 imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-protocol-setter-non-broken-weird.html [ DumpJSConsoleLogInStdErr ] 338 338 imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-invalid-args.html [ DumpJSConsoleLogInStdErr ] 339 imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https.html [ DumpJSConsoleLogInStdErr ] 339 340 imported/w3c/web-platform-tests/workers/WorkerGlobalScope_ErrorEvent_lineno.htm [ DumpJSConsoleLogInStdErr ] 340 341 imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audionode-interface/audionode-disconnect-audioparam.html [ DumpJSConsoleLogInStdErr ] -
trunk/LayoutTests/imported/w3c/ChangeLog
r264202 r264239 1 2020-07-10 Chris Dumez <cdumez@apple.com> 2 3 Resync web-platform-tests/payment-request from upstream 4 https://bugs.webkit.org/show_bug.cgi?id=214167 5 6 Reviewed by Sam Weinig. 7 8 Resync web-platform-tests/payment-request from upstream cef93b58e7cf31f1d47c. 9 10 * resources/resource-files.json: 11 * web-platform-tests/payment-request/*: Updated. 12 1 13 2020-07-09 Chris Dumez <cdumez@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/resources/resource-files.json
r264117 r264239 2559 2559 "web-platform-tests/mediacapture-record/support/MediaRecorder-iframe.html", 2560 2560 "web-platform-tests/payment-request/allowpaymentrequest/echo-PaymentRequest.html", 2561 "web-platform-tests/payment-request/blank.html", 2561 2562 "web-platform-tests/payment-request/payment-request-response-id.html", 2562 2563 "web-platform-tests/payment-request/show-method-postmessage-iframe.html", -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/META.yml
r237995 r264239 3 3 - marcoscaceres 4 4 - rsolomakhin 5 - domenic6 5 - zouhir 7 - mnoorenberghe8 6 - romandev 9 - edenchuang 7 - aestes 8 - danyao -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/complete-method.https.html
r236570 r264239 9 9 test(() => { 10 10 const event = new MerchantValidationEvent("test"); 11 assert_throws ("InvalidStateError", () => {11 assert_throws_dom("InvalidStateError", () => { 12 12 event.complete(""); 13 13 }) -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.https-expected.txt
r237521 r264239 6 6 PASS Must throw TypeError if initialized with an invalid URL. 7 7 PASS Relative validationURLs use the document as the base. 8 FAIL Relative validationURLs use the document.baseURI as the base. assert_equals: expected "https://pass.com/pass" but got "https://localhost:9443/payment-request/MerchantValidationEvent/pass" 8 9 PASS Must have a methodName IDL attribute, which is initialized with to the methodName dictionary value. 9 10 PASS When no methodName is passed, methodName attribute defaults to the empty string -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.https.html
r236570 r264239 9 9 const applePay = Object.freeze({ 10 10 supportedMethods: "https://apple.com/apple-pay", 11 data: { 12 version: 3, 13 merchantIdentifier: "merchant.com.example", 14 countryCode: "US", 15 merchantCapabilities: ["supports3DS"], 16 supportedNetworks: ["visa"], 17 } 11 18 }); 12 19 const basicCard = Object.freeze({ supportedMethods: "basic-card" }); … … 58 65 test(() => { 59 66 const validationURL = "http://\u005B"; // invalid URL 60 assert_throws (new TypeError(), () => {67 assert_throws_js(TypeError, () => { 61 68 new MerchantValidationEvent("test", { validationURL }); 62 69 }); … … 72 79 } 73 80 }, "Relative validationURLs use the document as the base."); 81 82 test(() => { 83 const validationURL = "pass"; 84 const base = document.createElement("base"); 85 base.href = "https://pass.com"; 86 document.head.append(base); 87 const event = new MerchantValidationEvent("test", { validationURL }); 88 try { 89 assert_idl_attribute(event, "validationURL"); 90 assert_equals(event.validationURL, "https://pass.com/pass"); 91 } finally { 92 base.remove(); 93 } 94 }, "Relative validationURLs use the document.baseURI as the base."); 74 95 75 96 test(() => { … … 115 136 ]; 116 137 for (const methodName of invalidPMIs) { 117 assert_throws (118 new RangeError(),138 assert_throws_js( 139 RangeError, 119 140 () => { 120 141 const event = new MerchantValidationEvent("test", { methodName }); -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html
r236570 r264239 29 29 "Expected addressLine to be an array" 30 30 ); 31 assert_throws (32 new TypeError(),31 assert_throws_js( 32 TypeError, 33 33 () => { 34 34 addr.addressLine.push("this must throw"); … … 74 74 dependentLocality: '', 75 75 postalCode: '6095', 76 region: 'QLD', 76 77 sortingCode: '', 77 78 organization: 'w3c', -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https.html
r236570 r264239 18 18 const { test } = event.methodDetails; 19 19 assert_equals(test, "pass"); 20 assert_equals(event.methodDetails, methodDetails);21 20 }, "Must have a methodDetails IDL attribute, which is initialized with to the methodName dictionary value"); 22 21 -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html
r235600 r264239 7 7 <script src="/resources/testharnessreport.js"></script> 8 8 <script> 9 const applePay = Object.freeze({ 10 supportedMethods: "https://apple.com/apple-pay", 11 data: { 12 version: 3, 13 merchantIdentifier: "merchant.com.example", 14 countryCode: "US", 15 merchantCapabilities: ["supports3DS"], 16 supportedNetworks: ["visa"], 17 } 18 }); 9 19 const basicCard = Object.freeze({ supportedMethods: "basic-card" }); 10 const defaultMethods = Object.freeze([basicCard ]);20 const defaultMethods = Object.freeze([basicCard, applePay]); 11 21 const defaultDetails = Object.freeze({ 12 22 total: { -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-call-immediate-manual.https.html
r235600 r264239 10 10 <script> 11 11 setup({ explicit_done: true, explicit_timeout: true }); 12 const applePay = Object.freeze({ 13 supportedMethods: "https://apple.com/apple-pay", 14 data: { 15 version: 3, 16 merchantIdentifier: "merchant.com.example", 17 countryCode: "US", 18 merchantCapabilities: ["supports3DS"], 19 supportedNetworks: ["visa"], 20 } 21 }); 12 22 const validMethod = Object.freeze({ supportedMethods: "basic-card" }); 13 const validMethods = Object.freeze([validMethod ]);23 const validMethods = Object.freeze([validMethod, applePay]); 14 24 const validAmount = Object.freeze({ currency: "USD", value: "5.00" }); 15 25 const validTotal = Object.freeze({ … … 46 56 request.addEventListener( 47 57 "shippingaddresschange", 48 async ev => { 49 // spin the event loop, sets [[waitForUpdate]] to true. 50 await Promise.resolve(); 51 try { 52 ev.updateWith(validDetails); 53 resolve(); // This is bad. 54 } catch (err) { 55 reject(err); // this is good. 56 } 58 ev => { 59 // Forces updateWith() to be run in the next event loop tick so that 60 // [[waitForUpdate]] is already true when it runs. 61 t.step_timeout(() => { 62 try { 63 ev.updateWith(validDetails); 64 resolve(); // This is bad. 65 } catch (err) { 66 reject(err); // this is good. 67 } 68 }); 57 69 }, 58 70 { once: true } 59 71 ); 60 72 }); 61 const response = awaitrequest.show();62 await promise_rejects (73 const acceptPromise = request.show(); 74 await promise_rejects_dom( 63 75 t, 64 76 "InvalidStateError", … … 66 78 "The event loop already spun, so [[waitForUpdate]] is now true" 67 79 ); 80 const response = await acceptPromise; 68 81 await response.complete(); 69 82 }, testName.trim()); … … 91 104 }); 92 105 const responsePromise = request.show(); 93 await promise_rejects (106 await promise_rejects_dom( 94 107 t, 95 108 "InvalidStateError", … … 136 149 // Here, we try to be sneaky, and reuse the addressChangeEvent to perform the update. 137 150 // However, addressChangeEvent [[waitingForUpdate]] is true, so it throws. 138 assert_throws (151 assert_throws_dom( 139 152 "InvalidStateError", 140 153 () => { … … 147 160 optionChangeEvent.updateWith(validDetails); 148 161 149 assert_throws (162 assert_throws_dom( 150 163 "InvalidStateError", 151 164 () => { -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-duplicate-shipping-options-manual.https.html
r235600 r264239 9 9 <script> 10 10 setup({ explicit_done: true, explicit_timeout: true }); 11 11 const applePay = Object.freeze({ 12 supportedMethods: "https://apple.com/apple-pay", 13 data: { 14 version: 3, 15 merchantIdentifier: "merchant.com.example", 16 countryCode: "US", 17 merchantCapabilities: ["supports3DS"], 18 supportedNetworks: ["visa"], 19 } 20 }); 12 21 const validMethod = Object.freeze({ supportedMethods: "basic-card" }); 13 const validMethods = [validMethod ];22 const validMethods = [validMethod, applePay]; 14 23 const validAmount = Object.freeze({ 15 24 currency: "USD", … … 65 74 }); 66 75 const acceptPromise = request.show(); 67 await promise_rejects (76 await promise_rejects_js( 68 77 t, 69 new TypeError(),78 TypeError, 70 79 acceptPromise, 71 80 "Duplicate shippingOption ids must abort with TypeError" -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-incremental-update-manual.https.html
r235600 r264239 15 15 const methods = [{ 16 16 supportedMethods: "basic-card", 17 }, { 18 supportedMethods: "https://apple.com/apple-pay", 19 data: { 20 version: 3, 21 merchantIdentifier: "merchant.com.example", 22 countryCode: "US", 23 merchantCapabilities: ["supports3DS"], 24 supportedNetworks: ["visa"], 25 } 17 26 }]; 18 27 -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-method-abort-update-manual.https.html
r235600 r264239 19 19 }); 20 20 21 const applePay = Object.freeze({ 22 supportedMethods: "https://apple.com/apple-pay", 23 data: { 24 version: 3, 25 merchantIdentifier: "merchant.com.example", 26 countryCode: "US", 27 merchantCapabilities: ["supports3DS"], 28 supportedNetworks: ["visa"], 29 } 30 }); 31 21 32 // Methods 22 const validMethods = Object.freeze([validMethodBasicCard, validMethod ]);33 const validMethods = Object.freeze([validMethodBasicCard, validMethod, applePay]); 23 34 24 35 // Amounts … … 131 142 132 143 const modifierWithRecursiveData = Object.freeze({ 133 supportedMethods: validMethodBasicCard,144 supportedMethods: "basic-card", 134 145 total: validTotal, 135 146 data: recursiveData, … … 149 160 // First we check the bad update. 150 161 const acceptPromise = request.show(); 151 await promise_rejects( 162 let test_func; 163 if (typeof expectedError == "function") { 164 test_func = promise_rejects_js; 165 } else { 166 test_func = promise_rejects_dom; 167 } 168 await test_func( 152 169 t, 153 170 expectedError, … … 156 173 ); 157 174 // The request [[state]] is now "closed", so let's check for InvalidStateError 158 await promise_rejects (175 await promise_rejects_dom( 159 176 t, 160 177 "InvalidStateError", … … 176 193 <li> 177 194 <button onclick=" 178 const rejectedPromise = Promise.reject(new SyntaxError('test')) .catch(err => err);195 const rejectedPromise = Promise.reject(new SyntaxError('test')); 179 196 testBadUpdate(this, rejectedPromise, 'AbortError'); 180 197 "> … … 185 202 <button onclick=" 186 203 const invalidDetails = { total: `this will cause a TypeError!` }; 187 testBadUpdate(this, invalidDetails, new TypeError());204 testBadUpdate(this, invalidDetails, TypeError); 188 205 "> 189 206 Total in the update is a string, so converting to IDL must abort the update with a TypeError. … … 193 210 <button onclick=" 194 211 const invalidDetails = { total: recursiveData }; 195 testBadUpdate(this, invalidDetails, new TypeError());212 testBadUpdate(this, invalidDetails, TypeError); 196 213 "> 197 214 Total is recursive, so converting to IDL must abort the update with a TypeError. … … 200 217 <li> 201 218 <button onclick=" 202 testBadUpdate(this, invalidDetailsNegativeTotal, new TypeError());219 testBadUpdate(this, invalidDetailsNegativeTotal, TypeError); 203 220 "> 204 221 Updating with a negative total results in a TypeError. … … 208 225 <button onclick=" 209 226 const badDetails = Object.assign({}, validDetails, { displayItems: invalidPaymentItems }); 210 testBadUpdate(this, badDetails, new RangeError());211 "> 212 Updating with a displayItem with an invalid currency results in TypeError.227 testBadUpdate(this, badDetails, RangeError); 228 "> 229 Updating with a displayItem with an invalid currency results in RangeError. 213 230 </button> 214 231 </li> … … 217 234 const duplicateShippingOptions = [validShippingOption, validShippingOption]; 218 235 const badDetails = Object.assign({}, validDetails, { shippingOptions: duplicateShippingOptions }); 219 testBadUpdate(this, badDetails, new TypeError());236 testBadUpdate(this, badDetails, TypeError); 220 237 "> 221 238 Updating with duplicate shippingOptions (same IDs) results in a TypeError. … … 225 242 <button onclick=" 226 243 const badDetails = Object.assign({}, validDetails, { shippingOptions: invalidShippingOptions }); 227 testBadUpdate(this, badDetails, new RangeError());244 testBadUpdate(this, badDetails, RangeError); 228 245 "> 229 246 Updating with a shippingOption with an invalid currency value results in a RangError. … … 235 252 const badModifiers = { modifiers: [ modifierWithInvalidTotal, validModifier ] }; 236 253 const badDetails = Object.assign({}, validDetails, badModifiers); 237 testBadUpdate(this, badDetails, new RangeError());254 testBadUpdate(this, badDetails, RangeError); 238 255 "> 239 256 Must throw a RangeError when a modifier's total item has an invalid currency. … … 245 262 const badModifiers = { modifiers: [ modifierWithInvalidDisplayItems, validModifier ] }; 246 263 const badDetails = Object.assign({}, validDetails, badModifiers); 247 testBadUpdate(this, badDetails, new RangeError());264 testBadUpdate(this, badDetails, RangeError); 248 265 "> 249 266 Must throw a RangeError when a modifier display item has an invalid currency. … … 255 272 const badModifiers = { modifiers: [ modifierWithRecursiveData, validModifier ] }; 256 273 const badDetails = Object.assign({}, validDetails, badModifiers); 257 testBadUpdate(this, badDetails, new TypeError());274 testBadUpdate(this, badDetails, TypeError); 258 275 "> 259 276 Must throw as Modifier has a recursive dictionary. -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-state-checks-manual.https.html
r235600 r264239 7 7 <script> 8 8 setup({ explicit_done: true, explicit_timeout: true }); 9 const applePay = Object.freeze({ 10 supportedMethods: "https://apple.com/apple-pay", 11 data: { 12 version: 3, 13 merchantIdentifier: "merchant.com.example", 14 countryCode: "US", 15 merchantCapabilities: ["supports3DS"], 16 supportedNetworks: ["visa"], 17 } 18 }); 9 19 const validMethod = Object.freeze({ supportedMethods: "basic-card" }); 10 const validMethods = Object.freeze([validMethod ]);20 const validMethods = Object.freeze([validMethod, applePay]); 11 21 const validAmount = Object.freeze({ currency: "USD", value: "5.00" }); 12 22 const validTotal = Object.freeze({ … … 46 56 // Set request.[[state]] to closed 47 57 await event.target.abort(); 48 assert_throws (58 assert_throws_dom( 49 59 "InvalidStateError", 50 60 () => { … … 71 81 // Set request.[[updating]] to true 72 82 event.updateWith(pendingPromise); 73 assert_throws (83 assert_throws_dom( 74 84 "InvalidStateError", 75 85 () => { -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html
r235600 r264239 7 7 <script src="/resources/testharnessreport.js"></script> 8 8 <script> 9 const applePay = Object.freeze({ 10 supportedMethods: "https://apple.com/apple-pay", 11 data: { 12 version: 3, 13 merchantIdentifier: "merchant.com.example", 14 countryCode: "US", 15 merchantCapabilities: ["supports3DS"], 16 supportedNetworks: ["visa"], 17 } 18 }); 9 19 const basicCard = Object.freeze({ supportedMethods: "basic-card" }); 10 const defaultMethods = Object.freeze([basicCard ]);20 const defaultMethods = Object.freeze([basicCard, applePay]); 11 21 const defaultDetails = Object.freeze({ 12 22 total: { … … 34 44 new PaymentRequestUpdateEvent("shippingoptionchange"), 35 45 ].forEach(ev => { 36 assert_throws (46 assert_throws_dom( 37 47 "InvalidStateError", 38 48 () => { … … 54 64 request.dispatchEvent(ev); // set .target and dispatch flag 55 65 // unstrusted event. 56 assert_throws (66 assert_throws_dom( 57 67 "InvalidStateError", 58 68 () => { -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html
r235390 r264239 46 46 </ol> 47 47 <small> 48 If you find a buggy test, please <a href="https://github.com/w 3c/web-platform-tests/issues">file a bug</a>49 and tag one of the <a href="https://github.com/w 3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.48 If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> 49 and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">owners</a>. 50 50 </small> -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html
r235390 r264239 61 61 </ol> 62 62 <small> 63 If you find a buggy test, please <a href="https://github.com/w 3c/web-platform-tests/issues">file a bug</a>64 and tag one of the <a href="https://github.com/w 3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.63 If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> 64 and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">owners</a>. 65 65 </small> -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-shippingAddress-member-manual.https.html
r236570 r264239 99 99 </ol> 100 100 <small> 101 If you find a buggy test, please <a href="https://github.com/w 3c/web-platform-tests/issues">file a bug</a>102 and tag one of the <a href="https://github.com/w 3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.101 If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> 102 and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">owners</a>. 103 103 </small> -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html
r235390 r264239 16 16 supportedMethods: "basic-card", 17 17 }, 18 { 19 supportedMethods: "https://apple.com/apple-pay", 20 data: { 21 version: 3, 22 merchantIdentifier: "merchant.com.example", 23 countryCode: "US", 24 merchantCapabilities: ["supports3DS"], 25 supportedNetworks: ["visa"], 26 }, 27 } 18 28 ]; 19 29 const shippingOptions = { … … 101 111 const request = new PaymentRequest(methods, detailsNoShippingOptions); 102 112 // Await the user to abort 103 await promise_rejects (t, "AbortError", request.show());113 await promise_rejects_dom(t, "AbortError", request.show()); 104 114 // [[state]] is now closed 105 await promise_rejects (t, "InvalidStateError", request.show());115 await promise_rejects_dom(t, "InvalidStateError", request.show()); 106 116 }, testName.trim()); 107 117 } -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/active-document-cross-origin.https.sub-expected.txt
r224061 r264239 2 2 3 3 4 PASS PaymentRequest <iframe allowpaymentrequest> in non-active document (cross-origin) 4 FAIL PaymentRequest <iframe allowpaymentrequest> in non-active document (cross-origin) assert_throws_dom: function "() => { 5 new grabbedPaymentRequest(...paymentArgs); 6 }" threw an exception from the wrong global 5 7 -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/active-document-cross-origin.https.sub.html
r222307 r264239 18 18 }); 19 19 iframe.onload = t.step_func_done(() => { 20 assert_throws ({name: 'SecurityError'}, () => {20 assert_throws_dom('SecurityError', () => { 21 21 new grabbedPaymentRequest(...paymentArgs); 22 22 }); -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/active-document-same-origin.https-expected.txt
r224061 r264239 1 1 2 2 3 PASS PaymentRequest <iframe allowpaymentrequest> in non-active document (same-origin) 3 FAIL PaymentRequest <iframe allowpaymentrequest> in non-active document (same-origin) assert_throws_dom: function "() => { 4 new grabbedPaymentRequest(...paymentArgs); 5 }" threw an exception from the wrong global 4 6 -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/active-document-same-origin.https.html
r222307 r264239 14 14 win.location.href = '/common/blank.html'; 15 15 iframe.onload = t.step_func_done(() => { 16 assert_throws ({name: 'SecurityError'}, () => {16 assert_throws_dom('SecurityError', () => { 17 17 new grabbedPaymentRequest(...paymentArgs); 18 18 }); -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/removing-allowpaymentrequest.https.sub.html
r222307 r264239 28 28 29 29 window.onmessage = t.step_func((e) => { 30 // Ignore messages that are not part of the test. 31 if (e.source != iframe.contentWindow) return; 32 30 33 i++; 31 34 if (i === 1) { … … 49 52 // Since the allowpaymentrequest flag was not set, we expect an exception. 50 53 assert_equals(e.data.message, 'Exception', 'after navigation'); 51 assert_array_equals(e.data.details, [true /* ex instanceof DOMException*/, 18 /* ex.code */, 'SecurityError' /* ex.name */], 'after navigation'); 54 assert_equals(4, e.data.details.length); 55 // The last entry is the error stacktrace. Ignore it in comparison. 56 assert_array_equals(e.data.details.slice(0, 3), [true /* ex instanceof DOMException*/, 18 /* ex.code */, 'SecurityError' /* ex.name */], 'after navigation'); 52 57 t.done(); 53 58 } -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html
r222307 r264239 1 1 <!doctype html> 2 2 <title>PaymentRequest setting allowpaymentrequest after document creation, before response</title> 3 <meta name="timeout" content="long"> 3 4 <script src=/resources/testharness.js></script> 4 5 <script src=/resources/testharnessreport.js></script> … … 22 23 }); 23 24 24 window.onmessage = t.step_func_done((e) => { 25 window.onmessage = t.step_func((e) => { 26 // Ignore messages that are not part of the test. 27 if (e.source != iframe.contentWindow) return; 28 25 29 assert_equals(e.data.message, 'Exception'); 26 assert_array_equals(e.data.details, [true /* ex instanceof DOMException */, DOMException.SECURITY_ERR, 'SecurityError']); 30 assert_equals(4, e.data.details.length); 31 // The last entry is the error stacktrace. Ignore it in comparison. 32 assert_array_equals(e.data.details.slice(0, 3), [true /* ex instanceof DOMException */, DOMException.SECURITY_ERR, 'SecurityError']); 33 t.done(); 27 34 }); 28 35 -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest.https.sub.html
r220785 r264239 21 21 22 22 window.onmessage = t.step_func((e) => { 23 // Ignore messages that are not part of the test. 24 if (e.source != iframe.contentWindow) return; 25 23 26 i++; 24 27 if (i === 1) { 25 28 assert_equals(e.data.message, 'Exception', 'before navigation'); 26 assert_array_equals(e.data.details, [true /* ex instanceof DOMException*/, 18 /* ex.code */, 'SecurityError' /* ex.name */], 'before navigation'); 29 assert_equals(4, e.data.details.length); 30 // The last entry is the error stacktrace. Ignore it in comparison. 31 assert_array_equals(e.data.details.slice(0, 3), [true /* ex instanceof DOMException*/, 18 /* ex.code */, 'SecurityError' /* ex.name */], 'before navigation'); 27 32 28 33 // Navigate the iframe. This will fire a second 'load' event on the iframe. -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html
r235390 r264239 10 10 setup({ explicit_done: true, explicit_timeout: true }); 11 11 const validMethod = Object.freeze({ supportedMethods: "basic-card" }); 12 const validMethods = Object.freeze([validMethod]); 12 const applePayMethod = { 13 supportedMethods: "https://apple.com/apple-pay", 14 data: { 15 version: 3, 16 merchantIdentifier: "merchant.com.example", 17 countryCode: "US", 18 merchantCapabilities: ["supports3DS"], 19 supportedNetworks: ["visa"], 20 }, 21 }; 22 const validMethods = Object.freeze([validMethod, applePayMethod]); 13 23 const validAmount = Object.freeze({ currency: "USD", value: "5.00" }); 14 24 const validTotal = Object.freeze({ -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-select-last-manual.https.html
r235390 r264239 9 9 const validMethods = Object.freeze([ 10 10 { supportedMethods: "basic-card" }, 11 { supportedMethods: "https://apple.com/apple-pay" }, 11 { 12 supportedMethods: "https://apple.com/apple-pay", 13 data: { 14 version: 3, 15 merchantIdentifier: "merchant.com.example", 16 countryCode: "US", 17 merchantCapabilities: ["supports3DS"], 18 supportedNetworks: ["visa"], 19 }, 20 }, 12 21 ]); 13 22 const validAmount = Object.freeze({ currency: "USD", value: "5.00" }); -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/constructor_convert_method_data.https.html
r253986 r264239 33 33 const method = { supportedMethods }; 34 34 const request = new PaymentRequest([method], details); 35 assert_throws (36 new TypeError(),35 assert_throws_js( 36 TypeError, 37 37 () => { 38 38 const badMethod = Object.assign( … … 56 56 if (!(await request.canMakePayment())) continue; 57 57 58 assert_throws (59 new TypeError(),58 assert_throws_js( 59 TypeError, 60 60 () => { 61 61 const badMethod = Object.assign( -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/historical.https.html
r236570 r264239 35 35 methods.toString = () => { throw expectedError; }; 36 36 Object.defineProperty(methods, '0', { get: () => { throw unexpectedError; } }); 37 assert_throws (expectedError, () => {37 assert_throws_exactly(expectedError, () => { 38 38 new PaymentRequest([{supportedMethods: methods}], {total: {label: 'bar', amount: {currency: 'BAZ', value: '0'}}}); 39 39 }); -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/onmerchantvalidation-attribute.https.html
r235600 r264239 8 8 "use strict"; 9 9 const testMethod = Object.freeze({ supportedMethods: "not-a-real-method" }); 10 const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay" }); 10 const applePay = Object.freeze({ 11 supportedMethods: "https://apple.com/apple-pay", 12 data: { 13 version: 3, 14 merchantIdentifier: "merchant.com.example", 15 countryCode: "US", 16 merchantCapabilities: ["supports3DS"], 17 supportedNetworks: ["visa"], 18 }, 19 }); 11 20 const defaultMethods = Object.freeze([testMethod, applePay]); 12 21 const defaultDetails = Object.freeze({ -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/onpaymentmethodchange-attribute.https.html
r264238 r264239 8 8 "use strict"; 9 9 const testMethod = Object.freeze({ supportedMethods: "not-a-real-method" }); 10 const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay" }); 10 const applePay = Object.freeze({ 11 supportedMethods: "https://apple.com/apple-pay", 12 data: { 13 version: 3, 14 merchantIdentifier: "merchant.com.example", 15 countryCode: "US", 16 merchantCapabilities: ["supports3DS"], 17 supportedNetworks: ["visa"], 18 } 19 }); 11 20 const defaultMethods = Object.freeze([testMethod, applePay]); 12 21 const defaultDetails = Object.freeze({ -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html
r237995 r264239 2 2 <meta charset="utf-8"> 3 3 <title>Test for PaymentRequest.abort() method</title> 4 <link rel="help" href="https://w3c.github.io/ browser-payment-api/#abort-method">4 <link rel="help" href="https://w3c.github.io/payment-request/#abort-method"> 5 5 <script src="/resources/testharness.js"></script> 6 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/resources/testdriver.js"></script> 7 8 <script src='/resources/testdriver-vendor.js'></script> 8 <script src="/resources/testdriver.js"></script>9 9 <script> 10 10 "use strict"; … … 18 18 const applePay = Object.freeze({ 19 19 supportedMethods: "https://apple.com/apple-pay", 20 data: { 21 version: 3, 22 merchantIdentifier: "merchant.com.example", 23 countryCode: "US", 24 merchantCapabilities: ["supports3DS"], 25 supportedNetworks: ["visa"], 26 } 20 27 }); 21 28 const defaultMethods = Object.freeze([basicCard, applePay]); … … 33 40 // request is in "created" state 34 41 const request = new PaymentRequest(defaultMethods, defaultDetails); 35 await promise_rejects (t, "InvalidStateError", request.abort());42 await promise_rejects_dom(t, "InvalidStateError", request.abort()); 36 43 }, `Throws if the promise [[state]] is not "interactive"`); 37 38 promise_test(async t => {39 const request = new PaymentRequest(defaultMethods, defaultDetails);40 const acceptPromise = test_driver.bless("show payment request", () =>41 request.show()42 );43 try {44 await request.abort();45 } catch (err) {46 assert_unreached("Unexpected promise rejection: " + err.message);47 }48 await promise_rejects(t, "AbortError", acceptPromise);49 // As request is now "closed", trying to show it will fail50 await promise_rejects(t, "InvalidStateError", request.show());51 }, "The same request cannot be shown multiple times.");52 53 promise_test(async t => {54 // request is in "created" state.55 const request = new PaymentRequest(defaultMethods, defaultDetails);56 await promise_rejects(t, "InvalidStateError", request.abort());57 // Call it again, for good measure.58 await promise_rejects(t, "InvalidStateError", request.abort());59 // The request's state is "created", so let's show it60 // which changes the state to "interactive.".61 const acceptPromise = test_driver.bless("show payment request", () =>62 request.show()63 );64 // Let's set request the state to "closed" by calling .abort()65 try {66 await request.abort();67 } catch (err) {68 assert_unreached("Unexpected promise rejection: " + err.message);69 }70 // The request is now "closed", so...71 await promise_rejects(t, "InvalidStateError", request.abort());72 await promise_rejects(t, "AbortError", acceptPromise);73 }, "Aborting a request before it is shown doesn't prevent it from being shown later.");74 44 75 45 promise_test(async t => { … … 78 48 assert_equals(promises.size, 3, "Must have three unique objects"); 79 49 }, "Calling abort() multiple times is always a new object."); 50 51 promise_test(async t => { 52 const request = new PaymentRequest(defaultMethods, defaultDetails); 53 const [abortPromise, acceptPromise] = await test_driver.bless( 54 "show payment request", 55 () => { 56 const acceptPromise = request.show() 57 acceptPromise.catch(() => {}); // no-op, just to silence unhandled rejection in devtools. 58 const abortPromise = request.abort(); 59 return [abortPromise, acceptPromise]; 60 }); 61 62 await abortPromise; 63 await promise_rejects_dom(t, "AbortError", acceptPromise); 64 // As request is now "closed", trying to show it will fail 65 await promise_rejects_dom(t, "InvalidStateError", request.show()); 66 }, "The same request cannot be shown multiple times."); 67 68 promise_test(async t => { 69 // request is in "created" state. 70 const request = new PaymentRequest(defaultMethods, defaultDetails); 71 await promise_rejects_dom(t, "InvalidStateError", request.abort()); 72 // Call it again, for good measure. 73 await promise_rejects_dom(t, "InvalidStateError", request.abort()); 74 // The request's state is "created", so let's show it 75 // which changes the state to "interactive.". 76 const [abortPromise, acceptPromise] = await test_driver.bless( 77 "show payment request", 78 () => { 79 const acceptPromise = request.show() 80 // Let's set request the state to "closed" by calling .abort() 81 const abortPromise = request.abort(); 82 return [abortPromise, acceptPromise]; 83 }); 84 85 await abortPromise; 86 // The request is now "closed", so... 87 await promise_rejects_dom(t, "InvalidStateError", request.abort()); 88 await promise_rejects_dom(t, "AbortError", acceptPromise); 89 }, "Aborting a request before it is shown doesn't prevent it from being shown later."); 80 90 </script> 81 91 <small> 92 If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> 93 and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>. 94 </small> -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-protection.https.html
r237995 r264239 9 9 <script> 10 10 const basicCard = Object.freeze({ supportedMethods: "basic-card" }); 11 const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay" }); 11 const applePay = Object.freeze({ 12 supportedMethods: "https://apple.com/apple-pay", 13 data: { 14 version: 3, 15 merchantIdentifier: "merchant.com.example", 16 countryCode: "US", 17 merchantCapabilities: ["supports3DS"], 18 supportedNetworks: ["visa"], 19 } 20 }); 12 21 const defaultMethods = Object.freeze([basicCard, applePay]); 13 22 const defaultDetails = Object.freeze({ -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https-expected.txt
r244393 r264239 1 This test requires user interaction. 2 Please click here to allow show payment request.This test requires user interaction. 3 Please click here to allow show payment request. If you find a buggy test, please file a bug and tag one of the suggested reviewers. 1 If you find a buggy test, please file a bug and tag one of the suggested reviewers. 4 2 5 3 PASS If payment method identifier are supported, resolve promise with true. 6 FAIL If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException. assert_unreached: Should have rejected: undefined Reached unreachable code7 FAIL If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException. promise_test: Unhandled rejection with value: object "InvalidStateError: The object is in an invalid state."8 4 PASS If request.[[state]] is "created", then return a promise that resolves to true for known method. 9 5 PASS All methods are unsupported 10 6 PASS Mix of supported and unsupported methods, at least one method is supported. 7 FAIL If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException. assert_unreached: Should have rejected: undefined Reached unreachable code 8 FAIL If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException. promise_test: Unhandled rejection with value: object "InvalidStateError: The object is in an invalid state." 11 9 -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html
r237995 r264239 2 2 <meta charset="utf-8"> 3 3 <title>Tests for PaymentRequest.canMakePayment() method</title> 4 <link rel="help" href="https://w3c.github.io/ browser-payment-api/#show-method">4 <link rel="help" href="https://w3c.github.io/payment-request/#canmakepayment-method"> 5 5 <script src="/resources/testharness.js"></script> 6 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/resources/testdriver.js"></script> 7 8 <script src='/resources/testdriver-vendor.js'></script> 8 <script src="/resources/testdriver.js"></script>9 9 <script> 10 "use strict"; 10 11 const basicCard = Object.freeze({ supportedMethods: "basic-card" }); 11 12 const applePay = Object.freeze({ 12 13 supportedMethods: "https://apple.com/apple-pay", 14 data: { 15 version: 3, 16 merchantIdentifier: "merchant.com.example", 17 countryCode: "US", 18 merchantCapabilities: ["supports3DS"], 19 supportedNetworks: ["visa"], 20 } 13 21 }); 14 22 const defaultMethods = Object.freeze([basicCard, applePay]); … … 35 43 ); 36 44 }, `If payment method identifier are supported, resolve promise with true.`); 37 38 promise_test(async t => {39 const request = new PaymentRequest(defaultMethods, defaultDetails);40 const acceptPromise = test_driver.bless("show payment request", () => {41 request.show(); // Sets state to "interactive"42 });43 const canMakePaymentPromise = request.canMakePayment();44 try {45 const result = await canMakePaymentPromise;46 assert_true(47 false,48 `canMakePaymentPromise should have thrown InvalidStateError`49 );50 } catch (err) {51 await promise_rejects(t, "InvalidStateError", canMakePaymentPromise);52 } finally {53 await request.abort();54 await promise_rejects(t, "AbortError", acceptPromise);55 }56 // The state should be "closed"57 await promise_rejects(t, "InvalidStateError", request.canMakePayment());58 }, 'If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException.');59 60 promise_test(async t => {61 const request = new PaymentRequest(defaultMethods, defaultDetails);62 const acceptPromise = test_driver.bless("show payment request", () => {63 request.show(); // Sets state to "interactive"64 });65 acceptPromise.catch(() => {}); // no-op, just to silence unhandled rejection in devtools.66 await request.abort(); // The state is now "closed"67 await promise_rejects(t, "InvalidStateError", request.canMakePayment());68 try {69 const result = await request.canMakePayment();70 assert_true(71 false,72 `should have thrown InvalidStateError, but instead returned "${result}"`73 );74 } catch (err) {75 assert_equals(76 err.name,77 "InvalidStateError",78 "must be an InvalidStateError."79 );80 }81 }, 'If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException.');82 45 83 46 promise_test(async t => { … … 116 79 assert_true(await someSupported, `At least one method is expected to be supported.`); 117 80 }, `Mix of supported and unsupported methods, at least one method is supported.`); 81 82 promise_test(async t => { 83 const request = new PaymentRequest(defaultMethods, defaultDetails); 84 const [acceptPromise, canMakePaymentPromise] = await test_driver.bless( 85 "show payment request", 86 () => { 87 const acceptPromise = request.show(); // Sets state to "interactive" 88 const canMakePaymentPromise = request.canMakePayment(); 89 return [acceptPromise, canMakePaymentPromise]; 90 }); 91 92 await promise_rejects_dom(t, "InvalidStateError", canMakePaymentPromise); 93 request.abort(); 94 await promise_rejects_dom(t, "AbortError", acceptPromise); 95 96 // The state should be "closed" 97 await promise_rejects_dom(t, "InvalidStateError", request.canMakePayment()); 98 }, 'If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException.'); 99 100 promise_test(async t => { 101 const request = new PaymentRequest(defaultMethods, defaultDetails); 102 const [abortPromise, acceptPromise] = await test_driver.bless( 103 "show payment request", 104 () => { 105 const acceptPromise = request.show(); // Sets state to "interactive" 106 acceptPromise.catch(() => {}); // no-op, just to silence unhandled rejection in devtools. 107 const abortPromise = request.abort(); // Sets state to "closed" 108 return [abortPromise, acceptPromise]; 109 }); 110 111 await abortPromise; 112 await promise_rejects_dom(t, "AbortError", acceptPromise); 113 await promise_rejects_dom(t, "InvalidStateError", request.canMakePayment()); 114 }, 'If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException.'); 118 115 </script> 119 116 -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor-thcrash.https.html
r264238 r264239 29 29 const ABUSIVE_AMOUNT = 100000; 30 30 31 const applePay = { 32 supportedMethods: "https://apple.com/apple-pay", 33 data: { 34 version: 3, 35 merchantIdentifier: "merchant.com.example", 36 countryCode: "US", 37 merchantCapabilities: ["supports3DS"], 38 supportedNetworks: ["visa"], 39 } 40 }; 41 31 42 const basicCard = Object.freeze({ 32 43 supportedMethods: "basic-card", … … 43 54 }); 44 55 45 const defaultMethods = Object.freeze([basicCard ]);56 const defaultMethods = Object.freeze([basicCard, applePay]); 46 57 47 58 const defaultTotal = Object.freeze({ -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.sub.html
r264238 r264239 9 9 "use strict"; 10 10 const testMethod = Object.freeze({ 11 supportedMethods: "https:// wpt.fyi/payment-request",11 supportedMethods: "https://{{domains[nonexistent]}}/payment-request", 12 12 }); 13 13 const defaultMethods = Object.freeze([testMethod]); … … 109 109 test(() => { 110 110 smokeTest(); 111 assert_throws (new TypeError(), () => new PaymentRequest([], defaultDetails));111 assert_throws_js(TypeError, () => new PaymentRequest([], defaultDetails)); 112 112 }, "If the length of the methodData sequence is zero, then throw a TypeError"); 113 114 test(() => { 115 smokeTest(); 116 const duplicateMethods = [ 117 { 118 supportedMethods: "https://{{domains[nonexistent]}}/payment-request", 119 }, 120 { 121 supportedMethods: "https://{{domains[nonexistent]}}/payment-request", 122 }, 123 ]; 124 assert_throws_js(RangeError, () => new PaymentRequest(duplicateMethods, defaultDetails)); 125 }, "If payment method is duplicate, then throw a RangeError"); 113 126 114 127 test(() => { … … 119 132 const methods = [ 120 133 { 121 supportedMethods: "https:// wpt.fyi/payment-request",134 supportedMethods: "https://{{domains[nonexistent]}}/payment-request", 122 135 data, 123 136 }, … … 138 151 const recursiveDictionary = {}; 139 152 recursiveDictionary.foo = recursiveDictionary; 140 assert_throws (new TypeError(), () => {153 assert_throws_js(TypeError, () => { 141 154 const methods = [ 142 155 { 143 supportedMethods: "https:// wpt.fyi/payment-request",156 supportedMethods: "https://{{domains[nonexistent]}}/payment-request", 144 157 data: recursiveDictionary, 145 158 }, … … 147 160 new PaymentRequest(methods, defaultDetails); 148 161 }); 149 assert_throws (new TypeError(), () => {162 assert_throws_js(TypeError, () => { 150 163 const methods = [ 151 164 { 152 supportedMethods: "https:// wpt.fyi/payment-request",165 supportedMethods: "https://{{domains[nonexistent]}}/payment-request", 153 166 data: "a string", 154 167 }, … … 156 169 new PaymentRequest(methods, defaultDetails); 157 170 }); 158 assert_throws (159 new TypeError(),171 assert_throws_js( 172 TypeError, 160 173 () => { 161 174 const methods = [ 162 175 { 163 supportedMethods: "https:// wpt.fyi/payment-request",176 supportedMethods: "https://{{domains[nonexistent]}}/payment-request", 164 177 data: null, 165 178 }, … … 216 229 }, 217 230 }; 218 assert_throws (219 new TypeError(),231 assert_throws_js( 232 TypeError, 220 233 () => { 221 234 new PaymentRequest(defaultMethods, invalidDetails); … … 239 252 test(() => { 240 253 smokeTest(); 241 assert_throws (new TypeError(), () => {254 assert_throws_js(TypeError, () => { 242 255 new PaymentRequest(defaultMethods, { 243 256 total: { … … 267 280 ], 268 281 }; 269 assert_throws (270 new TypeError(),282 assert_throws_js( 283 TypeError, 271 284 () => { 272 285 new PaymentRequest(defaultMethods, invalidDetails); … … 283 296 [ 284 297 { 285 supportedMethods: "https:// wpt.fyi/payment-request",298 supportedMethods: "https://{{domains[nonexistent]}}/payment-request", 286 299 }, 287 300 ], … … 373 386 shippingOptions: [invalidShippingOption], 374 387 }); 375 assert_throws (376 new TypeError(),388 assert_throws_js( 389 TypeError, 377 390 () => { 378 391 new PaymentRequest(defaultMethods, details, { requestShipping: true }); … … 491 504 "shippingOption must be null, because requestShipping is false" 492 505 ); 493 assert_throws (494 new TypeError(),506 assert_throws_js( 507 TypeError, 495 508 () => { 496 509 new PaymentRequest(defaultMethods, details, { requestShipping: true }); … … 520 533 "shippingOption must be null, because requestShipping is false" 521 534 ); 522 assert_throws (523 new TypeError(),535 assert_throws_js( 536 TypeError, 524 537 () => { 525 538 new PaymentRequest(defaultMethods, details, { requestShipping: true }); … … 534 547 for (const invalidTotal of invalidTotalAmounts) { 535 548 const invalidModifier = { 536 supportedMethods: "https:// wpt.fyi/payment-request",549 supportedMethods: "https://{{domains[nonexistent]}}/payment-request", 537 550 total: { 538 551 label: "", … … 543 556 }, 544 557 }; 545 assert_throws (546 new TypeError(),558 assert_throws_js( 559 TypeError, 547 560 () => { 548 561 new PaymentRequest(defaultMethods, { … … 560 573 for (const invalidAmount of invalidAmounts) { 561 574 const invalidModifier = { 562 supportedMethods: "https:// wpt.fyi/payment-request",575 supportedMethods: "https://{{domains[nonexistent]}}/payment-request", 563 576 total: defaultTotal, 564 577 additionalDisplayItems: [ … … 572 585 ], 573 586 }; 574 assert_throws (575 new TypeError(),587 assert_throws_js( 588 TypeError, 576 589 () => { 577 590 new PaymentRequest(defaultMethods, { … … 590 603 modifiers: [ 591 604 { 592 supportedMethods: "https:// wpt.fyi/payment-request",605 supportedMethods: "https://{{domains[nonexistent]}}/payment-request", 593 606 data: ["some-data"], 594 607 }, … … 609 622 modifiers: [ 610 623 { 611 supportedMethods: "https:// wpt.fyi/payment-request",624 supportedMethods: "https://{{domains[nonexistent]}}/payment-request", 612 625 data: { 613 626 some: "data", … … 632 645 modifiers: [ 633 646 { 634 supportedMethods: "https:// wpt.fyi/payment-request",647 supportedMethods: "https://{{domains[nonexistent]}}/payment-request", 635 648 data: recursiveDictionary, 636 649 }, 637 650 ], 638 651 }); 639 assert_throws (new TypeError(), () => {652 assert_throws_js(TypeError, () => { 640 653 new PaymentRequest(defaultMethods, modifiedDetails); 641 654 }); … … 645 658 test(() => { 646 659 smokeTest(); 647 assert_throws (new TypeError(), () => {660 assert_throws_js(TypeError, () => { 648 661 new PaymentRequest(defaultMethods, defaultDetails, { 649 662 shippingType: "invalid", -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-currency-code-checks.https.sub.html
r264238 r264239 8 8 const defaultMethods = [ 9 9 Object.freeze({ 10 supportedMethods: "https:// wpt.fyi",10 supportedMethods: "https://{{domains[nonexistent]}}", 11 11 }), 12 12 ]; … … 49 49 ]; 50 50 51 const RANGE_ERROR = new RangeError();51 const RANGE_ERROR = RangeError; 52 52 53 53 const invalidAmount = Object.freeze({ … … 70 70 // Process the total: 71 71 test(() => { 72 assert_throws (RANGE_ERROR, smokeTest, "Expected smoke test to throw.");72 assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw."); 73 73 for (const validCurrency of wellFormedCurrencyCodes) { 74 74 const amount = { … … 94 94 95 95 test(() => { 96 assert_throws (RANGE_ERROR, smokeTest, "Expected smoke test to throw.");96 assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw."); 97 97 for (const invalidCurrency of invalidCurrencyCodes) { 98 98 const amount = { … … 107 107 total, 108 108 }; 109 assert_throws (109 assert_throws_js( 110 110 RANGE_ERROR, 111 111 () => { … … 119 119 // If the displayItems member of details is present, then for each item in details.displayItems: 120 120 test(() => { 121 assert_throws (RANGE_ERROR, smokeTest, "Expected smoke test to throw.");121 assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw."); 122 122 const displayItems = []; 123 123 for (const validCurrency of wellFormedCurrencyCodes) { … … 155 155 156 156 test(() => { 157 assert_throws (RANGE_ERROR, smokeTest, "Expected smoke test to throw.");157 assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw."); 158 158 for (const invalidCurrency of invalidCurrencyCodes) { 159 159 const amount = { … … 169 169 displayItems: [displayItem], 170 170 }; 171 assert_throws (171 assert_throws_js( 172 172 RANGE_ERROR, 173 173 () => { … … 181 181 // Process shipping options: 182 182 test(() => { 183 assert_throws (RANGE_ERROR, smokeTest, "Expected smoke test to throw.");183 assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw."); 184 184 const shippingOptions = []; 185 185 for (const validCurrency of wellFormedCurrencyCodes) { … … 214 214 215 215 test(() => { 216 assert_throws (RANGE_ERROR, smokeTest, "Expected smoke test to throw.");216 assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw."); 217 217 for (const invalidCurrency of invalidCurrencyCodes) { 218 218 const shippingOption = { … … 226 226 shippingOptions: [shippingOption], 227 227 }; 228 assert_throws (228 assert_throws_js( 229 229 RANGE_ERROR, 230 230 () => { … … 238 238 // Process payment details modifiers: 239 239 test(() => { 240 assert_throws (RANGE_ERROR, smokeTest, "Expected smoke test to throw.");240 assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw."); 241 241 for (const validCurrency of wellFormedCurrencyCodes) { 242 242 const modifier = { 243 supportedMethods: "https:// wpt.fyi",243 supportedMethods: "https://{{domains[nonexistent]}}", 244 244 total: { 245 245 label: "Total due", … … 262 262 263 263 test(() => { 264 assert_throws (RANGE_ERROR, smokeTest, "Expected smoke test to throw.");264 assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw."); 265 265 for (const invalidCurrency of invalidCurrencyCodes) { 266 266 const modifier = { 267 supportedMethods: "https:// wpt.fyi",267 supportedMethods: "https://{{domains[nonexistent]}}", 268 268 total: { 269 269 label: "Total due", … … 275 275 modifiers: [modifier], 276 276 }; 277 assert_throws (277 assert_throws_js( 278 278 RANGE_ERROR, 279 279 () => { … … 287 287 // Process payment details modifiers: 288 288 test(() => { 289 assert_throws (RANGE_ERROR, smokeTest, "Expected smoke test to throw.");289 assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw."); 290 290 for (const validCurrency of wellFormedCurrencyCodes) { 291 291 const additionalItem = { … … 294 294 }; 295 295 const modifier = { 296 supportedMethods: "https:// wpt.fyi",296 supportedMethods: "https://{{domains[nonexistent]}}", 297 297 total: defaultTotal, 298 298 additionalDisplayItems: [additionalItem], … … 313 313 314 314 test(() => { 315 assert_throws (RANGE_ERROR, smokeTest, "Expected smoke test to throw.");315 assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw."); 316 316 for (const invalidCurrency of invalidCurrencyCodes) { 317 317 const additionalItem = { … … 320 320 }; 321 321 const modifier = { 322 supportedMethods: "https:// wpt.fyi",322 supportedMethods: "https://{{domains[nonexistent]}}", 323 323 total: defaultTotal, 324 324 additionalDisplayItems: [additionalItem], … … 328 328 modifiers: [modifier], 329 329 }; 330 assert_throws (330 assert_throws_js( 331 331 RANGE_ERROR, 332 332 () => { -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-pmi-handling.https.sub.html
r264238 r264239 23 23 const validMethods = [ 24 24 "https://wpt", 25 "https:// wpt.fyi/",26 "https:// wpt.fyi/payment",27 "https:// wpt.fyi/payment-request",28 "https:// wpt.fyi/payment-request?",29 "https:// wpt.fyi/payment-request?this=is",30 "https:// wpt.fyi/payment-request?this=is&totally",31 "https:// wpt.fyi:443/payment-request?this=is&totally",32 "https:// wpt.fyi:443/payment-request?this=is&totally#fine",33 "https://:@ wpt.fyi:443/payment-request?this=is&totally#👍",25 "https://{{domains[nonexistent]}}/", 26 "https://{{domains[nonexistent]}}/payment", 27 "https://{{domains[nonexistent]}}/payment-request", 28 "https://{{domains[nonexistent]}}/payment-request?", 29 "https://{{domains[nonexistent]}}/payment-request?this=is", 30 "https://{{domains[nonexistent]}}/payment-request?this=is&totally", 31 "https://{{domains[nonexistent]}}:443/payment-request?this=is&totally", 32 "https://{{domains[nonexistent]}}:443/payment-request?this=is&totally#fine", 33 "https://:@{{domains[nonexistent]}}:443/payment-request?this=is&totally#👍", 34 34 " \thttps://wpt\n ", 35 35 "https://xn--c1yn36f", … … 112 112 ]; 113 113 for (const invalidMethod of invalidMethods) { 114 assert_throws (115 new RangeError(),114 assert_throws_js( 115 RangeError, 116 116 () => { 117 117 const methods = [{ supportedMethods: invalidMethod }]; … … 130 130 "http://username:password@example.com/pay", 131 131 "http://foo.com:100000000/pay", 132 "not-https:// wpt.fyi/payment-request",132 "not-https://{{domains[nonexistent]}}/payment-request", 133 133 "../realitive/url", 134 134 "/absolute/../path?", … … 136 136 ]; 137 137 for (const invalidMethod of invalidMethods) { 138 assert_throws (139 new RangeError(),138 assert_throws_js( 139 RangeError, 140 140 () => { 141 141 const methods = [{ supportedMethods: invalidMethod }]; -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method-protection.tentative.https.html
r264238 r264239 1 1 <!DOCTYPE html> 2 2 <meta charset="utf-8"> 3 <title>Tests for PaymentRequest. canMakePayment() method</title>4 <link rel="help" href="https://w3c.github.io/ browser-payment-api/#show-method">3 <title>Tests for PaymentRequest.hasEnrolledInstrument() method</title> 4 <link rel="help" href="https://w3c.github.io/payment-request/#hasenrolledinstrument-method"> 5 5 <script src="/resources/testharness.js"></script> 6 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/resources/testdriver.js"></script> 7 8 <script src='/resources/testdriver-vendor.js'></script> 8 <script src="/resources/testdriver.js"></script>9 9 <script> 10 const basicCard = Object.freeze({ supportedMethods: "basic-card" }); 11 const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay" }); 12 const defaultMethods = Object.freeze([basicCard, applePay]); 10 const visaMethod = Object.freeze({ 11 supportedMethods: "basic-card", 12 data: { 13 supportedNetworks: ['visa'] 14 } 15 }); 16 const mastercardMethod = Object.freeze({ 17 supportedMethods: "basic-card", 18 data: { 19 supportedNetworks: ['mastercard'] 20 } 21 }); 13 22 const defaultDetails = Object.freeze({ 14 23 total: { … … 22 31 23 32 promise_test(async t => { 24 // This test m ightnever actually hit its assertion, but that's allowed.25 const request = new PaymentRequest( defaultMethods, defaultDetails);33 // This test may never actually hit its assertion, but that's allowed. 34 const request = new PaymentRequest([visaMethod], defaultDetails); 26 35 for (let i = 0; i < 1000; i++) { 27 36 try { 28 await request. canMakePayment();37 await request.hasEnrolledInstrument(); 29 38 } catch (err) { 30 39 assert_equals( 31 40 err.name, 32 41 "NotAllowedError", 33 " if it throws, then it must be a NotAllowedError."42 "If it throws, then it must be a NotAllowedError." 34 43 ); 35 44 break; 36 45 } 37 46 } 47 38 48 for (let i = 0; i < 1000; i++) { 39 49 try { 40 await new PaymentRequest(defaultMethods, defaultDetails).canMakePayment(); 50 const request2 = new PaymentRequest([mastercardMethod], defaultDetails); 51 await request2.hasEnrolledInstrument(); 41 52 } catch (err) { 42 53 assert_equals( 43 54 err.name, 44 55 "NotAllowedError", 45 " if it throws, then it must be a NotAllowedError."56 "If it throws, then it must be a NotAllowedError." 46 57 ); 47 58 break; … … 49 60 } 50 61 }, `Optionally, at the user agent's discretion, return a promise rejected with a "NotAllowedError" DOMException.`); 62 51 63 </script> 52 64 -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-onshippingaddresschange-attribute.https.html
r224156 r264239 8 8 <script> 9 9 "use strict"; 10 const applePay = Object.freeze({ 11 supportedMethods: "https://apple.com/apple-pay", 12 data: { 13 version: 3, 14 merchantIdentifier: "merchant.com.example", 15 countryCode: "US", 16 merchantCapabilities: ["supports3DS"], 17 supportedNetworks: ["visa"], 18 } 19 }); 10 20 const basicCard = Object.freeze({ supportedMethods: "basic-card" }); 11 const defaultMethods = Object.freeze([basicCard ]);21 const defaultMethods = Object.freeze([basicCard, applePay]); 12 22 const defaultDetails = Object.freeze({ 13 23 total: { -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-onshippingoptionchange-attribute.https.html
r224156 r264239 8 8 <script> 9 9 "use strict"; 10 const applePay = Object.freeze({ 11 supportedMethods: "https://apple.com/apple-pay", 12 data: { 13 version: 3, 14 merchantIdentifier: "merchant.com.example", 15 countryCode: "US", 16 merchantCapabilities: ["supports3DS"], 17 supportedNetworks: ["visa"], 18 } 19 }); 10 20 const basicCard = Object.freeze({ supportedMethods: "basic-card" }); 11 const defaultMethods = Object.freeze([basicCard ]);21 const defaultMethods = Object.freeze([basicCard, applePay]); 12 22 const defaultDetails = Object.freeze({ 13 23 total: { -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-shippingType-attribute.https.html
r224156 r264239 9 9 "use strict"; 10 10 const paymentShipingTypes = Object.freeze(["delivery", "pickup", "shipping"]); 11 const applePay = Object.freeze({ 12 supportedMethods: "https://apple.com/apple-pay", 13 data: { 14 version: 3, 15 merchantIdentifier: "merchant.com.example", 16 countryCode: "US", 17 merchantCapabilities: ["supports3DS"], 18 supportedNetworks: ["visa"], 19 } 20 }); 11 21 const basicCard = Object.freeze({ supportedMethods: "basic-card" }); 12 const defaultMethods = Object.freeze([basicCard ]);22 const defaultMethods = Object.freeze([basicCard, applePay]); 13 23 const defaultDetails = Object.freeze({ 14 24 total: { -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html
r235390 r264239 2 2 <meta charset="utf-8"> 3 3 <title>Test for PaymentRequest.show() method</title> 4 <link rel="help" href="https://w3c.github.io/ browser-payment-api/#show-method">4 <link rel="help" href="https://w3c.github.io/payment-request/#show-method"> 5 5 <script src="/resources/testharness.js"></script> 6 6 <script src="/resources/testharnessreport.js"></script> … … 11 11 const defaultMethods = Object.freeze([ 12 12 { supportedMethods: "basic-card" }, 13 { supportedMethods: "https://apple.com/apple-pay" }, 13 { 14 supportedMethods: "https://apple.com/apple-pay", 15 data: { 16 version: 3, 17 merchantIdentifier: "merchant.com.example", 18 countryCode: "US", 19 merchantCapabilities: ["supports3DS"], 20 supportedNetworks: ["visa"], 21 } 22 }, 14 23 ]); 15 24 … … 27 36 const request = new PaymentRequest(defaultMethods, defaultDetails); 28 37 const acceptPromise = request.show(); 29 await promise_rejects(t, "SecurityError", acceptPromise); 38 // Abort the request after 2 seconds if it has not rejected. This allows the 39 // other tests in this file to run even if a non-compliant browser shows the 40 // payment sheet without user activation. 41 t.step_timeout(() => { 42 t.force_timeout(); 43 request.abort(); 44 }, 2000); 45 46 await promise_rejects_dom(t, "SecurityError", acceptPromise); 30 47 }, `Calling show() without being triggered by user interaction throws`); 31 48 32 promise_test(t => { 33 return test_driver.bless("show payment request", async () => { 34 const request = new PaymentRequest(defaultMethods, defaultDetails); 35 const acceptPromise = request.show(); // Sets state to "interactive" 36 await promise_rejects(t, "InvalidStateError", request.show()); 37 await request.abort(); 38 await promise_rejects(t, "AbortError", acceptPromise); 39 }); 49 promise_test(async t => { 50 const request = new PaymentRequest(defaultMethods, defaultDetails); 51 const [acceptPromise] = await test_driver.bless( 52 "test: throws if the promise [[state]] is not 'created'", 53 () => { 54 const acceptPromise = request.show(); // Sets state to "interactive" 55 return [acceptPromise]; 56 }); 57 await promise_rejects_dom(t, "InvalidStateError", request.show()); 58 await request.abort(); 59 await promise_rejects_dom(t, "AbortError", acceptPromise); 40 60 }, "Throws if the promise [[state]] is not 'created'."); 41 61 42 promise_test(t => { 43 return test_driver.bless("show payment request", async () => { 44 const request1 = new PaymentRequest(defaultMethods, defaultDetails); 45 const request2 = new PaymentRequest(defaultMethods, defaultDetails); 46 const acceptPromise1 = request1.show(); 47 const acceptPromise2 = request2.show(); 48 await promise_rejects(t, "AbortError", acceptPromise2); 49 await request1.abort(); 50 await promise_rejects(t, "AbortError", acceptPromise1); 51 }); 62 promise_test(async t => { 63 const request1 = new PaymentRequest(defaultMethods, defaultDetails); 64 const request2 = new PaymentRequest(defaultMethods, defaultDetails); 65 const [acceptPromise1] = await test_driver.bless( 66 `test: reject promise with "AbortedError" if payment request is already showing`, 67 async () => { 68 const acceptPromise1 = request1.show(); 69 const acceptPromise2 = request2.show(); 70 await promise_rejects_dom(t, "AbortError", acceptPromise2); 71 return [acceptPromise1]; 72 }); 73 74 await request1.abort(); 75 await promise_rejects_dom(t, "AbortError", acceptPromise1); 52 76 }, `If the user agent's "payment request is showing" boolean is true, then return a promise rejected with an "AbortError" DOMException.`); 53 77 54 promise_test(t => { 55 return test_driver.bless("show payment request", async () => { 56 const request = new PaymentRequest( 57 [{ supportedMethods: "this-is-not-supported" }], 58 defaultDetails 59 ); 60 const acceptPromise = request.show(); 61 await promise_rejects(t, "NotSupportedError", acceptPromise); 62 }); 78 promise_test(async t => { 79 const request = new PaymentRequest( 80 [{ supportedMethods: "this-is-not-supported" }], 81 defaultDetails 82 ); 83 const [acceptPromise] = await test_driver.bless( 84 `test: reject promise with "NotSupportedError"`, 85 () => { 86 const acceptPromise = request.show(); 87 return [acceptPromise]; 88 }); 89 await promise_rejects_dom(t, "NotSupportedError", acceptPromise); 63 90 }, `If payment method consultation produces no supported method of payment, then return a promise rejected with a "NotSupportedError" DOMException.`); 64 91 65 promise_test(t => { 66 return test_driver.bless("show payment request", async () => { 67 const request = new PaymentRequest( 68 [{ supportedMethods: "basic-card" }], 69 defaultDetails 70 ); 71 const promises = new Set([request.show(), request.show(), request.show()]); 72 await request.abort(); 73 assert_equals(promises.size, 3, "Must have three unique objects"); 74 }); 75 }, "Calling show() multiple times is always a new object."); 92 promise_test(async t => { 93 const request = new PaymentRequest(defaultMethods, defaultDetails); 94 const [p1, p2, p3] = await test_driver.bless( 95 `test: calling show() multiple times always returns a new promise`, 96 () => { 97 const p1 = request.show(); 98 const p2 = request.show(); 99 const p3 = request.show(); 100 return [p1, p2, p3]; 101 }); 102 const promises = new Set([p1, p2, p3]); 103 assert_equals(promises.size, 3, "Must have three unique objects"); 104 105 await promise_rejects_dom(t, "InvalidStateError", p2); 106 await promise_rejects_dom(t, "InvalidStateError", p3); 107 108 await request.abort(); 109 await promise_rejects_dom(t, "AbortError", p1); 110 }, "Calling show() multiple times always returns a new promise."); 111 76 112 </script> 77 113 <small> -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html
r235390 r264239 13 13 const { response, request } = await getPaymentRequestResponse(); 14 14 promise_test(async t => { 15 let completePromise; 16 let invalidComplete; 17 let afterComplete; 15 18 try { 16 19 // We .complete() as normal, using the passed test value 17 co nst completePromise = response.complete(result);20 completePromise = response.complete(result); 18 21 assert_true(completePromise instanceof Promise, "returns a promise"); 19 22 // Immediately calling complete() again yields a rejected promise. 20 constinvalidComplete = response.complete(result);21 await promise_rejects (t, "InvalidStateError", invalidComplete);23 invalidComplete = response.complete(result); 24 await promise_rejects_dom(t, "InvalidStateError", invalidComplete); 22 25 // but the original promise is unaffected 23 26 const returnedValue = await completePromise; … … 29 32 // We now call .complete() again, to force an exception 30 33 // because [[complete]] is true. 31 constafterComplete = response.complete(result);32 await promise_rejects (t, "InvalidStateError", afterComplete);34 afterComplete = response.complete(result); 35 await promise_rejects_dom(t, "InvalidStateError", afterComplete); 33 36 button.innerHTML = `✅ ${button.textContent}`; 34 37 } catch (err) { … … 42 45 ]); 43 46 assert_equals( 44 allPromises. length,47 allPromises.size, 45 48 3, 46 49 "Calling complete() multiple times is always a new object." … … 69 72 </li> 70 73 <li> 71 <button onclick="runManualTest({completeWith: 'unknown'}, this)">74 <button onclick="runManualTest({completeWith: undefined}, this)"> 72 75 Passing no argument defaults to "unknown", 73 76 eventually closing the sheet and doesn't throw. … … 80 83 </li> 81 84 <li> 82 <button onclick="runManualTest({completeWith: 'fail'}, this) .then(done)">85 <button onclick="runManualTest({completeWith: 'fail'}, this)"> 83 86 Passing "fail" eventually closes the sheet and doesn't throw. 84 87 </button> 88 </li> 89 <li> 90 <button onclick="runManualTest({completeWith: 'unknown'}, this)"> 91 Passing "unknown" eventually closes the sheet and doesn't throw. 92 </button> 93 </li> 94 <li> 95 <button onclick="done()">Done!</button> 85 96 </li> 86 97 </ol> -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/helpers.js
r235390 r264239 1 1 setup({ explicit_done: true, explicit_timeout: true }); 2 3 const applePay = Object.freeze({ 4 supportedMethods: "https://apple.com/apple-pay", 5 data: { 6 version: 3, 7 merchantIdentifier: "merchant.com.example", 8 countryCode: "US", 9 merchantCapabilities: ["supports3DS"], 10 supportedNetworks: ["visa"], 11 } 12 }); 2 13 3 14 const validMethod = Object.freeze({ … … 5 16 }); 6 17 7 const validMethods = Object.freeze([validMethod ]);18 const validMethods = Object.freeze([validMethod, applePay]); 8 19 9 20 const validAmount = Object.freeze({ -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute-manual.https.html
r236570 r264239 17 17 const event = await eventPromise; 18 18 assert_true(event instanceof PaymentRequestUpdateEvent); 19 for(const [prop, value] of Object.entries(expected)){ 19 for([prop, value] of Object.entries(expected)){ 20 if (prop === 'payerPhone') { 21 // |payerPhone| may optionally adhere to E164 structure, which does not 22 // contain formatting, e.g. +180000000 instead of +1-800-000-0000. 23 // Strip out the formatting in case the user agent implements E164. 24 // https://w3c.github.io/payment-request/#addressinit-dictionary 25 value = value.replace(/[-\(\) ]/g, ''); 26 } 20 27 assert_equals(response[prop], value); 21 28 } … … 53 60 Change payer's phone to "+1-800-000-0000". 54 61 </p> 55 <button onclick="runTest(this, {requestPayerPhone: true}, { payerPhone: '+1 -800-000-0000' })">62 <button onclick="runTest(this, {requestPayerPhone: true}, { payerPhone: '+18000000000' })"> 56 63 PaymentRequestUpdateEvent is dispatched when payer phone changes. 57 64 </button> … … 63 70 <small> 64 71 If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> 65 and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/ OWNERS">owners</a>.72 and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">owners</a>. 66 73 </small> -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/rejects_if_not_active-manual.https.html
r235390 r264239 12 12 supportedMethods: "basic-card", 13 13 }); 14 const validMethods = Object.freeze([validMethod]); 14 const applePay = Object.freeze({ 15 supportedMethods: "https://apple.com/apple-pay", 16 data: { 17 version: 3, 18 merchantIdentifier: "merchant.com.example", 19 countryCode: "US", 20 merchantCapabilities: ["supports3DS"], 21 supportedNetworks: ["visa"], 22 } 23 }); 24 const validMethods = Object.freeze([validMethod, applePay]); 15 25 const validAmount = Object.freeze({ 16 26 currency: "USD", … … 63 73 // So, promise needs to reject appropriately. 64 74 const promise = response[methodName](...args); 65 await promise_rejects (75 await promise_rejects_dom( 66 76 t, 67 77 "AbortError", … … 98 108 // Now, response's relevant global object's document is no longer active. 99 109 // So, promise needs to reject appropriately. 100 await promise_rejects (110 await promise_rejects_dom( 101 111 t, 102 112 "AbortError", -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html
r237995 r264239 26 26 // sets response.[[complete]] to true. 27 27 await response.complete("success"); 28 return promise_rejects (28 return promise_rejects_dom( 29 29 t, 30 30 "InvalidStateError", … … 40 40 const { response } = await getPaymentRequestResponse(); 41 41 const retryPromise = response.retry(); 42 await promise_rejects (42 await promise_rejects_dom( 43 43 t, 44 44 "InvalidStateError", … … 56 56 const { response } = await getPaymentRequestResponse(); 57 57 const retryPromise = response.retry(); 58 await promise_rejects( 59 t, 60 "InvalidStateError", 61 response.complete("success"), 58 const completePromise1 = response.complete("success"); 59 const completePromise2 = response.complete("fail"); 60 assert_not_equals( 61 completePromise1, 62 completePromise2, 63 "complete() must return unique promises" 64 ); 65 await promise_rejects_dom( 66 t, 67 "InvalidStateError", 68 completePromise1, 62 69 "Calling complete() while retrying rejects with an InvalidStateError" 63 70 ); 71 await promise_rejects_dom( 72 t, 73 "InvalidStateError", 74 completePromise2, 75 "Calling complete() while retrying rejects with an InvalidStateError" 76 ); 77 assert_not_equals( 78 completePromise1, 79 completePromise2, 80 "complete() must return unique promises" 81 ); 64 82 await retryPromise; 65 83 await response.complete("success"); … … 72 90 const { response, request } = await getPaymentRequestResponse(); 73 91 const retryPromise = response.retry(); 74 await promise_rejects (92 await promise_rejects_dom( 75 93 t, 76 94 "InvalidStateError", … … 98 116 ); 99 117 await response.complete("success"); 100 await promise_rejects (118 await promise_rejects_dom( 101 119 t, 102 120 "InvalidStateError", … … 111 129 promise_test(async t => { 112 130 const { response } = await getPaymentRequestResponse(); 113 await promise_rejects (131 await promise_rejects_dom( 114 132 t, 115 133 "AbortError", … … 117 135 "The user aborting a retry rejects with a AbortError" 118 136 ); 119 await promise_rejects (137 await promise_rejects_dom( 120 138 t, 121 139 "InvalidStateError", … … 123 141 "After the user aborts, response [[complete]] is true so retry() must reject with InvalidStateError" 124 142 ); 125 await promise_rejects (143 await promise_rejects_dom( 126 144 t, 127 145 "InvalidStateError", … … 147 165 button.disabled = true; 148 166 promise_test(async t => { 149 const { response, request } = await getPaymentRequestResponse({ requestShipping: true }); 150 // causes "abort the update" to run 151 const shippingChangedPromise = new Promise(resolve => { 152 request.onshippingoptionchange = () => { 153 event.updateWith({ total: { amount: { currency: "USD", value: "INVALID" } }}); 167 const { response, request } = await getPaymentRequestResponse({ 168 requestShipping: true, 169 }); 170 const shipOptionChangePromise = new Promise(resolve => { 171 request.onshippingoptionchange = event => { 172 // causes "abort the update" to run 173 event.updateWith({ total: "error!" }); 154 174 resolve(); 155 175 }; 156 176 }); 157 177 const retryPromise = response.retry(); 158 await ship pingChangedPromise;159 await promise_rejects (160 t, 161 new TypeError(),178 await shipOptionChangePromise; 179 await promise_rejects_js( 180 t, 181 TypeError, 162 182 retryPromise, 163 183 "retry() aborts with a TypeError, because totals' value is invalid" 164 184 ); 165 await promise_rejects (185 await promise_rejects_dom( 166 186 t, 167 187 "InvalidStateError", … … 248 268 <li> 249 269 <p> 250 When shown the payment sheet, hit pay once. Then retry once. 270 When shown the payment sheet, hit pay once. 271 Then, change the shipping option. 272 Select to pay again. 251 273 </p> 252 274 <button onclick="abortTheUpdate(this);"> … … 270 292 </ol> 271 293 <small> 272 If you find a buggy test, please <a href="https://github.com/w 3c/web-platform-tests/issues">file a bug</a>273 and tag one of the <a href="https://github.com/w 3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.294 If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> 295 and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">owners</a>. 274 296 </small> -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/w3c-import.log
r236570 r264239 23 23 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html 24 24 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html 25 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerdetailschange-updateWith-immediate-manual.https.html 26 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerdetailschange-updateWith-manual.https.html 25 27 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/rejects_if_not_active-manual.https.html 26 28 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html 27 29 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html 30 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-warnings-manual.https.html 28 31 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html 29 32 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html
r237995 r264239 1 1 <!DOCTYPE html> 2 2 <meta charset=utf-8> 3 <link rel="help" href="https://w3c.github.io/payment-request/#show()-method">4 3 <title>PaymentRequest show() rejects if doc is not fully active</title> 4 <link rel="help" href="https://w3c.github.io/payment-request/#show-method"> 5 5 <script src="/resources/testharness.js"></script> 6 6 <script src="/resources/testharnessreport.js"></script> 7 7 <script src="/resources/testdriver.js"></script> 8 8 <script src="/resources/testdriver-vendor.js"></script> 9 <link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentrequest-show()">10 9 <body> 11 10 <script> 11 const applePay = Object.freeze({ 12 supportedMethods: "https://apple.com/apple-pay", 13 data: { 14 version: 3, 15 merchantIdentifier: "merchant.com.example", 16 countryCode: "US", 17 merchantCapabilities: ["supports3DS"], 18 supportedNetworks: ["visa"], 19 } 20 }); 12 21 const validMethod = Object.freeze({ 13 22 supportedMethods: "basic-card", 14 23 }); 15 const validMethods = Object.freeze([validMethod ]);24 const validMethods = Object.freeze([validMethod, applePay]); 16 25 const validAmount = Object.freeze({ 17 26 currency: "USD", … … 45 54 iframe.allowPaymentRequest = true; 46 55 document.body.appendChild(iframe); 47 // We first got to page1.html, grab a PaymentRequest instance.48 const request1 = await getLoadedPaymentRequest(49 iframe,50 "/payment-request/resources/page1.html"51 );52 // We navigate the iframe again, putting request1's document into an inactive state.53 const request2 = await getLoadedPaymentRequest(54 iframe,55 "/payment-request/resources/page2.html"56 );57 await test_driver.bless("show payment request", async () => {58 // Now, request1's relevant global object's document is no longer active.59 // So, call .show(), and make sure it rejects appropriately.60 await promise_rejects(61 t,62 "AbortError",63 request1.show(),64 "Inactive document, so must throw AbortError"65 );66 });67 await test_driver.bless("show payment request", async () => {68 // request2 has an active document tho, so confirm it's working as expected:69 request2.show();70 await request2.abort();71 await promise_rejects(72 t,73 "InvalidStateError",74 request2.show(),75 "Abort already called, so InvalidStateError"76 );77 // We are done, so clean up.78 iframe.remove();79 });80 }, "PaymentRequest.show() aborts if the document is not active");81 82 promise_test(async t => {83 // We nest two iframes and wait for them to load.84 const outerIframe = document.createElement("iframe");85 outerIframe.allowPaymentRequest = true;86 document.body.appendChild(outerIframe);87 // Load the outer iframe (we don't care about the awaited request)88 await getLoadedPaymentRequest(89 outerIframe,90 "/payment-request/resources/page1.html"91 );92 93 // Now we create the inner iframe94 const innerIframe = outerIframe.contentDocument.createElement("iframe");95 innerIframe.allowPaymentRequest = true;96 97 // nest them98 outerIframe.contentDocument.body.appendChild(innerIframe);99 100 // load innerIframe, and get the PaymentRequest instance101 const request = await getLoadedPaymentRequest(102 innerIframe,103 "/payment-request/resources/page2.html"104 );105 106 // Navigate the outer iframe to a new location.107 // Wait for the load event to fire.108 await new Promise(resolve => {109 outerIframe.addEventListener("load", resolve);110 outerIframe.src = "/payment-request/resources/page2.html";111 });112 113 const showPromise = await test_driver.bless("show payment request", () => {114 return request.show();115 });116 // Now, request's relevant global object's document is still active117 // (it is the active document of the inner iframe), but is not fully active118 // (since the parent of the inner iframe is itself no longer active).119 // So, call request.show() and make sure it rejects appropriately.120 await promise_rejects(121 t,122 "AbortError",123 showPromise,124 "Active, but not fully active, so must throw AbortError"125 );126 // We are done, so clean up.127 128 iframe.remove();129 }, "PaymentRequest.show() aborts if the document is active, but not fully active");130 131 promise_test(async t => {132 const iframe = document.createElement("iframe");133 iframe.allowPaymentRequest = true;134 document.body.appendChild(iframe);135 56 // Make a request in the iframe. 136 57 const request = await getLoadedPaymentRequest( … … 138 59 "/payment-request/resources/page1.html" 139 60 ); 140 const showPromise= await test_driver.bless("show payment request", () => {141 return request.show();61 const [showPromise] = await test_driver.bless("show payment request", () => { 62 return [request.show()]; 142 63 }); 143 64 // Navigate the iframe to a new location. Wait for the load event to fire. … … 145 66 iframe.addEventListener("load", resolve); 146 67 iframe.src = "/payment-request/resources/page2.html"; 68 // An implementation may optionally reject |showPromise|. 69 showPromise.catch(e => {}); 147 70 }); 148 await promise_rejects( 149 t, 150 "AbortError", 151 showPromise, 152 "The iframe was navigated away, so showPromise must reject with AbortError" 153 ); 154 // We are done, so clean up. 155 iframe.remove(); 156 }, "If a payment request is showing, but its document is navigated away (so no longer fully active), the payment request aborts."); 71 72 // The navigaton should have dismissed the previous payment request so it 73 // should be possible to show another one now. 74 const request2 = new iframe.contentWindow.PaymentRequest( 75 validMethods, validDetails); 76 const [showPromise2] = await test_driver.bless( 77 "show 2nd payment request", () => { 78 return [request2.show()]; 79 }); 80 81 // Stop the test in 1 second if it has not rejected, which means that a 82 // payment sheet is successfully shown. 83 t.step_timeout(async () => { 84 // We are done, so clean up. 85 iframe.remove(); 86 t.done(); 87 }, 1000); 88 89 // This should never settle because the payment sheet should be pending. 90 await showPromise2.then(() => { 91 assert_true(false, "Second payment should be pending but is resolved."); 92 }) 93 .catch(e => { 94 assert_true(false, "Second payment should be pending but is rejected."); 95 }); 96 }, "If a payment request is showing, but its document is navigated away (so no longer fully active), the payment sheet is dismissed."); 157 97 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html
r235390 r264239 9 9 <script> 10 10 setup({ explicit_done: true, explicit_timeout: true }); 11 const applePay = Object.freeze({ 12 supportedMethods: "https://apple.com/apple-pay", 13 data: { 14 version: 3, 15 merchantIdentifier: "merchant.com.example", 16 countryCode: "US", 17 merchantCapabilities: ["supports3DS"], 18 supportedNetworks: ["visa"], 19 } 20 }); 11 21 const validMethod = Object.freeze({ supportedMethods: "basic-card" }); 12 const validMethods = Object.freeze([validMethod ]);22 const validMethods = Object.freeze([validMethod, applePay]); 13 23 const validAmount = Object.freeze({ currency: "USD", value: "5.00" }); 14 24 const validTotal = Object.freeze({ … … 54 64 request.show().catch(err => err); 55 65 const results = await Promise.all([listenerPromise, handlerPromise]); 56 assert_true( 57 results.every(obj => obj instanceof PaymentAddress), 58 "Expected instances of PaymentAddress" 59 ); 66 results.forEach(obj => { 67 assert_true(obj instanceof PaymentAddress, 68 "Expected instance of PaymentAddress"); 69 assert_equals(obj.organization, "", "organization should be redacted"); 70 assert_equals(obj.phone, "", "phone should be redacted"); 71 assert_equals(obj.recipient, "", "recipient should be redacted"); 72 assert_equals(obj.addressLine.length, 0, "addressLine should be redacted"); 73 }); 60 74 await request.abort(); 61 75 }); -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-rejects-manual.https.html
r235390 r264239 25 25 const validMethodApplePay = Object.freeze({ 26 26 supportedMethods: "https://apple.com/apple-pay", 27 data: { 28 version: 3, 29 merchantIdentifier: "merchant.com.example", 30 countryCode: "US", 31 merchantCapabilities: ["supports3DS"], 32 supportedNetworks: ["visa"], 33 } 27 34 }); 28 35 … … 162 169 const detailsPromise = Promise.resolve(badDetails); 163 170 const acceptPromise = request.show(detailsPromise); 164 await promise_rejects( 171 let test_func; 172 if (typeof expectedError == "function") { 173 test_func = promise_rejects_js; 174 } else { 175 test_func = promise_rejects_dom; 176 } 177 await test_func( 165 178 t, 166 179 expectedError, … … 197 210 <li><button onclick=" 198 211 const invalidDetails = { total: `this will cause a TypeError!` }; 199 testBadUpdate(this.textContent, invalidDetails, new TypeError());212 testBadUpdate(this.textContent, invalidDetails, TypeError); 200 213 "> 201 214 Total in the update is a string, so converting to IDL must abort the update with a TypeError. … … 204 217 <li><button onclick=" 205 218 const invalidDetails = { total: recursiveData }; 206 testBadUpdate(this.textContent, invalidDetails, new TypeError());219 testBadUpdate(this.textContent, invalidDetails, TypeError); 207 220 "> 208 221 Total is recursive, so converting to IDL must abort the update with a TypeError. … … 210 223 211 224 <li><button onclick=" 212 testBadUpdate(this.textContent, invalidDetailsNegativeTotal, new TypeError());225 testBadUpdate(this.textContent, invalidDetailsNegativeTotal, TypeError); 213 226 "> 214 227 Updating with a negative total results in a TypeError. … … 219 232 displayItems: invalidPaymentItems 220 233 }); 221 testBadUpdate(this.textContent, badDetails, new RangeError());234 testBadUpdate(this.textContent, badDetails, RangeError); 222 235 "> 223 236 Updating with a displayItem with an invalid currency results in RangeError. … … 229 242 shippingOptions: duplicateShippingOptions, 230 243 }); 231 testBadUpdate(this.textContent, badDetails, new TypeError());244 testBadUpdate(this.textContent, badDetails, TypeError); 232 245 "> 233 246 Updating with duplicate shippingOptions (same IDs) results in a TypeError. … … 237 250 shippingOptions: invalidShippingOptions, 238 251 }); 239 testBadUpdate(this.textContent, badDetails, new RangeError());252 testBadUpdate(this.textContent, badDetails, RangeError); 240 253 "> 241 254 Updating with a shippingOption with an invalid currency value results in a RangError. … … 246 259 const badModifiers = { modifiers: [modifierWithInvalidTotal, validModifier] }; 247 260 const badDetails = Object.assign({}, validDetails, badModifiers); 248 testBadUpdate(this.textContent, badDetails, new RangeError());261 testBadUpdate(this.textContent, badDetails, RangeError); 249 262 "> 250 263 Must throw a RangeError when a modifier's total item has an invalid currency. … … 257 270 }; 258 271 const badDetails = Object.assign({}, validDetails, badModifiers); 259 testBadUpdate(this.textContent, badDetails, new RangeError());272 testBadUpdate(this.textContent, badDetails, RangeError); 260 273 "> 261 274 Must throw a RangeError when a modifier display item has an invalid currency. … … 268 281 }; 269 282 const badDetails = Object.assign({}, validDetails, badModifiers); 270 testBadUpdate(this.textContent, badDetails, new TypeError());283 testBadUpdate(this.textContent, badDetails, TypeError); 271 284 "> 272 285 Must throw as Modifier has a recursive dictionary. -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-resolves-manual.https.html
r235390 r264239 24 24 { 25 25 supportedMethods: "https://apple.com/apple-pay", 26 data: { 27 version: 3, 28 merchantIdentifier: "merchant.com.example", 29 countryCode: "US", 30 merchantCapabilities: ["supports3DS"], 31 supportedNetworks: ["visa"], 32 } 26 33 }, 27 34 ]); … … 158 165 promise_test(async t => { 159 166 const request = new PaymentRequest(validMethods, failDetails); 160 await promise_rejects (167 await promise_rejects_js( 161 168 t, 162 new TypeError(),169 TypeError, 163 170 request.show({ 164 171 total: "This throws a TypeError", … … 174 181 options = { 175 182 requestShipping: true, 176 } 183 }, 184 initialDetails = failDetails, 177 185 ) { 178 186 const testAssertion = buttonElement.textContent.trim(); 179 187 buttonElement.disabled = true; 180 188 promise_test(async t => { 181 const request = new PaymentRequest(validMethods, failDetails, options);189 const request = new PaymentRequest(validMethods, initialDetails, options); 182 190 const detailsPromise = Promise.resolve(details); 183 191 const acceptPromise = request.show(detailsPromise); 184 192 assert_equals(request.id, "this cannot be changed", "id must never change."); 185 await promise_rejects (193 await promise_rejects_dom( 186 194 t, 187 195 "AbortError", … … 310 318 </li> 311 319 <li> 320 <button onclick=" 321 const initialDetails = {total: passTotal, id: 'this cannot be changed'}; 322 const updatedDetails = {}; 323 runUpdateDetailsAlgorithm( 324 this, updatedDetails, {requestShipping: false}, initialDetails); 325 "> 326 Resolving the show promise with empty details will preserve the details from 327 the constructor. When the payment sheet is shown, the string 328 "✅ TEST HAS PASSED ✅" should be shown. 329 </button> 330 </li> 331 <li> 312 332 <button onclick="done();">Done!</button> 313 333 </li> -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-postmessage-iframe.html
r235390 r264239 4 4 const defaultMethods = Object.freeze([ 5 5 { supportedMethods: "basic-card" }, 6 { supportedMethods: "https://apple.com/apple-pay" }, 6 { 7 supportedMethods: "https://apple.com/apple-pay", 8 data: { 9 version: 3, 10 merchantIdentifier: "merchant.com.example", 11 countryCode: "US", 12 merchantCapabilities: ["supports3DS"], 13 supportedNetworks: ["visa"], 14 } 15 }, 7 16 ]); 8 17 -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-postmessage-manual.https.html
r235390 r264239 11 11 explicit_timeout: true, 12 12 allow_uncaught_exception: true, 13 });14 15 const defaultMethods = Object.freeze([16 { supportedMethods: "basic-card" },17 { supportedMethods: "https://apple.com/apple-pay" },18 ]);19 20 const defaultDetails = Object.freeze({21 id: "fail",22 total: {23 label: "Total",24 amount: {25 currency: "USD",26 value: "1.00",27 },28 },29 });30 31 test(() => {32 assert_throws(33 "SecurityError",34 () => {35 const request = new PaymentRequest(defaultMethods, defaultDetails);36 request.show(); // <--- should throw here37 request.abort();38 },39 "throws a SecurityError if not triggered by user activation"40 );41 13 }); 42 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html
r235390 r264239 1 1 <!DOCTYPE html> 2 <!-- Copyright © 2017 Mozilla and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->3 2 <meta charset="utf-8"> 4 3 <title>Test for validity of payment method identifiers when calling updateWith() method</title> … … 8 7 <script> 9 8 "use strict"; 10 setup({ explicit_done: true, explicit_timeout: true }); 9 setup({ 10 explicit_done: true, 11 explicit_timeout: true, 12 allow_uncaught_exception: true, 13 }); 14 const applePay = Object.freeze({ 15 supportedMethods: "https://apple.com/apple-pay", 16 data: { 17 version: 3, 18 merchantIdentifier: "merchant.com.example", 19 countryCode: "US", 20 merchantCapabilities: ["supports3DS"], 21 supportedNetworks: ["visa"], 22 }, 23 }); 11 24 const validMethod = Object.freeze({ 12 25 supportedMethods: "https://:@wpt.fyi:443/payment-request", 13 26 }); 14 27 15 const validMethods = Object.freeze([validMethod]); 28 const validMethods = Object.freeze([ 29 validMethod, 30 applePay, 31 { supportedMethods: "basic-card" }, 32 ]); 16 33 17 34 const validAmount = Object.freeze({ … … 42 59 }); 43 60 44 test(() => {45 try {46 new PaymentRequest(validMethods, validDetails);47 } catch (err) {48 done();49 throw err;50 }51 }, "smoke test");52 53 61 function manualTest(button, { invalidMethod }) { 54 62 button.disabled = true; 55 63 promise_test(async t => { 56 const request = new PaymentRequest( 57 [{ supportedMethods: "basic-card" }], 58 validDetails, 59 { requestShipping: true } 60 ); 64 const request = new PaymentRequest(validMethods, validDetails, { 65 requestShipping: true, 66 }); 61 67 const listener = ev => { 62 68 const invalidModifier = Object.assign({}, validModifier, { … … 71 77 request.addEventListener("shippingaddresschange", listener, { once: true }); 72 78 const showPromise = request.show(); 73 await promise_rejects (t, new RangeError(), showPromise);79 await promise_rejects_js(t, RangeError, showPromise); 74 80 }, button.textContent.trim()); 75 81 } … … 121 127 </li> 122 128 <li> 123 <button onclick="manualTest(this, {invalidMethod: 'Basic-Card'}); done();">129 <button onclick="manualTest(this, {invalidMethod: 'Basic-Card'});"> 124 130 Must throw if standardized PMI has uppercase characters. 125 131 </button> 132 </li> 133 <li> 134 <button onclick="done();">Done!</button> 126 135 </li> 127 136 </ol> -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html
r235390 r264239 18 18 amount: validAmount, 19 19 }); 20 const applePay = Object.freeze({ 21 supportedMethods: "https://apple.com/apple-pay", 22 data: { 23 version: 3, 24 merchantIdentifier: "merchant.com.example", 25 countryCode: "US", 26 merchantCapabilities: ["supports3DS"], 27 supportedNetworks: ["visa"], 28 } 29 }); 20 30 const validMethod = Object.freeze({ 21 31 supportedMethods: "basic-card", 22 32 }); 23 const validMethods = Object.freeze([validMethod ]);33 const validMethods = Object.freeze([validMethod, applePay]); 24 34 const validDetails = Object.freeze({ 25 35 total: validTotal, … … 41 51 const request = new PaymentRequest(validMethods, validDetails); 42 52 // Await the user to abort 43 await promise_rejects (t, "AbortError", request.show());53 await promise_rejects_dom(t, "AbortError", request.show()); 44 54 // [[state]] is now closed 45 await promise_rejects (t, "InvalidStateError", request.show());55 await promise_rejects_dom(t, "InvalidStateError", request.show()); 46 56 }, testName.trim()); 47 57 } -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html
r235390 r264239 9 9 <script> 10 10 setup({ explicit_done: true, explicit_timeout: true }); 11 const applePay = Object.freeze({ 12 supportedMethods: "https://apple.com/apple-pay", 13 data: { 14 version: 3, 15 merchantIdentifier: "merchant.com.example", 16 countryCode: "US", 17 merchantCapabilities: ["supports3DS"], 18 supportedNetworks: ["visa"], 19 } 20 }); 11 21 const basicCardMethod = Object.freeze({ 12 22 supportedMethods: "basic-card", … … 15 25 supportedMethods: "this-is-just-for-testings-will-never-match", 16 26 }); 17 const methods = Object.freeze([basicCardMethod, validMethod ]);27 const methods = Object.freeze([basicCardMethod, validMethod, applePay]); 18 28 const validAmount = Object.freeze({ 19 29 currency: "USD", … … 88 98 // For good measure, test that subsequent complete() 89 99 for (const state of [undefined, "success", "fail", "unknown"]) { 90 await promise_rejects (100 await promise_rejects_dom( 91 101 t, 92 102 "InvalidStateError", … … 134 144 ); 135 145 } 136 await promise_rejects (146 await promise_rejects_dom( 137 147 t, 138 148 "InvalidStateError", -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/w3c-import.log
r253986 r264239 17 17 /LayoutTests/imported/w3c/web-platform-tests/payment-request/META.yml 18 18 /LayoutTests/imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html 19 /LayoutTests/imported/w3c/web-platform-tests/payment-request/billing-address-changed-manual.https.html 20 /LayoutTests/imported/w3c/web-platform-tests/payment-request/blank.html 19 21 /LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html 20 22 /LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-select-last-manual.https.html 21 23 /LayoutTests/imported/w3c/web-platform-tests/payment-request/constructor_convert_method_data.https.html 24 /LayoutTests/imported/w3c/web-platform-tests/payment-request/dynamically-change-shipping-options-manual.https.html 22 25 /LayoutTests/imported/w3c/web-platform-tests/payment-request/historical.https.html 23 26 /LayoutTests/imported/w3c/web-platform-tests/payment-request/idlharness.https.window.js 24 27 /LayoutTests/imported/w3c/web-platform-tests/payment-request/onmerchantvalidation-attribute.https.html 25 /LayoutTests/imported/w3c/web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https.html 28 /LayoutTests/imported/w3c/web-platform-tests/payment-request/onpaymentmethodchange-attribute.https.html 29 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-is-showing.https.html 26 30 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html 27 31 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-protection.https.html 28 32 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html 29 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor-crash.https.html 30 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.html 31 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-currency-code-checks.https.html 32 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-pmi-handling.https.html 33 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor-thcrash.https.html 34 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.sub.html 35 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-currency-code-checks.https.sub.html 36 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-pmi-handling.https.sub.html 37 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method-manual.tentative.https.html 38 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method-protection.tentative.https.html 39 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https.html 33 40 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-id-attribute.https.html 34 41 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-insecure.http.html … … 40 47 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-shippingType-attribute.https.html 41 48 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html 49 /LayoutTests/imported/w3c/web-platform-tests/payment-request/rejects_if_not_active-manual.https.html 42 50 /LayoutTests/imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html 43 51 /LayoutTests/imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html -
trunk/LayoutTests/platform/ios-wk2/TestExpectations
r264172 r264239 56 56 webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html [ Skip ] 57 57 webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest.https.sub.html [ Skip ] 58 imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html [ Skip ] 59 imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https.html [ Skip ] 58 60 59 61 # skip in favor of tests in http/tests/paymentrequest -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r264131 r264239 655 655 webkit.org/b/173779 [ Debug ] fast/scrolling/arrow-key-scroll-in-rtl-document.html [ Pass Failure ] 656 656 657 webkit.org/b/175773 [ Debug ] imported/w3c/web-platform-tests/payment-request/payment-request-constructor-crash.https.html [ Skip ]658 659 657 webkit.org/b/173672 imported/w3c/web-platform-tests/fetch/http-cache/invalidate.html [ Pass Failure ] 660 658 -
trunk/LayoutTests/tests-options.json
r264202 r264239 2457 2457 "slow" 2458 2458 ], 2459 "imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html": [ 2460 "slow" 2461 ], 2462 "imported/w3c/web-platform-tests/payment-request/payment-is-showing.https.html": [ 2463 "slow" 2464 ], 2459 2465 "imported/w3c/web-platform-tests/payment-request/payment-request-constructor-crash.https.html": [ 2466 "slow" 2467 ], 2468 "imported/w3c/web-platform-tests/payment-request/payment-request-constructor-thcrash.https.html": [ 2460 2469 "slow" 2461 2470 ],
Note:
See TracChangeset
for help on using the changeset viewer.