From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- ...ionList_onconnectionavailable-manual.https.html | 77 +++++ ...resentationConnection_onclose-manual.https.html | 84 ++++++ ...sentationConnection_onmessage-manual.https.html | 64 ++++ .../PresentationConnection_send-manual.https.html | 97 ++++++ ...sentationConnection_terminate-manual.https.html | 71 +++++ .../PresentationReceiver_create-manual.https.html | 272 +++++++++++++++++ .../tests/presentation-api/receiving-ua/cache.txt | 1 + .../tests/presentation-api/receiving-ua/common.js | 63 ++++ .../receiving-ua/idlharness-manual.https.html | 44 +++ .../presentation-api/receiving-ua/serviceworker.js | 15 + ...ionList_onconnectionavailable_receiving-ua.html | 92 ++++++ ...resentationConnection_onclose_receiving-ua.html | 89 ++++++ ...sentationConnection_onmessage_receiving-ua.html | 108 +++++++ .../PresentationConnection_send_receiving-ua.html | 45 +++ ...sentationConnection_terminate_receiving-ua.html | 23 ++ .../PresentationReceiver_create_receiving-ua.html | 328 +++++++++++++++++++++ ...entationReceiver_create_receiving-ua_child.html | 171 +++++++++++ ...resentationReceiver_unreached_receiving-ua.html | 21 ++ .../support/idlharness_receiving-ua.html | 41 +++ .../receiving-ua/support/iframe.html | 22 ++ .../receiving-ua/support/serviceworker.js | 9 + .../presentation-api/receiving-ua/support/stash.js | 98 ++++++ .../presentation-api/receiving-ua/support/stash.py | 10 + 23 files changed, 1845 insertions(+) create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnectionList_onconnectionavailable-manual.https.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnection_onclose-manual.https.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnection_onmessage-manual.https.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnection_send-manual.https.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnection_terminate-manual.https.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/PresentationReceiver_create-manual.https.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/cache.txt create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/common.js create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/idlharness-manual.https.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/serviceworker.js create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnectionList_onconnectionavailable_receiving-ua.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnection_onclose_receiving-ua.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnection_onmessage_receiving-ua.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnection_send_receiving-ua.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnection_terminate_receiving-ua.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationReceiver_create_receiving-ua.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationReceiver_create_receiving-ua_child.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationReceiver_unreached_receiving-ua.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/support/idlharness_receiving-ua.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/support/iframe.html create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/support/serviceworker.js create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/support/stash.js create mode 100644 testing/web-platform/tests/presentation-api/receiving-ua/support/stash.py (limited to 'testing/web-platform/tests/presentation-api/receiving-ua') diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnectionList_onconnectionavailable-manual.https.html b/testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnectionList_onconnectionavailable-manual.https.html new file mode 100644 index 0000000000..9b75a85e9f --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnectionList_onconnectionavailable-manual.https.html @@ -0,0 +1,77 @@ + + +Monitoring incoming presentation connections + + + + + + +

Click the button below and select the available presentation display, to start the manual test.

+ + + + diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnection_onclose-manual.https.html b/testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnection_onclose-manual.https.html new file mode 100644 index 0000000000..50585f7813 --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnection_onclose-manual.https.html @@ -0,0 +1,84 @@ + + +Closing a PresentationConnection + + + + + + +

Click the button below and select the available presentation display, to start the manual test.

+ + + + diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnection_onmessage-manual.https.html b/testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnection_onmessage-manual.https.html new file mode 100644 index 0000000000..53451a6cef --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnection_onmessage-manual.https.html @@ -0,0 +1,64 @@ + + +Receiving a message through PresentationConnection + + + + + +

Click the button below and select the available presentation display, to start the manual test.

+ + + diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnection_send-manual.https.html b/testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnection_send-manual.https.html new file mode 100644 index 0000000000..188f7e3fc1 --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnection_send-manual.https.html @@ -0,0 +1,97 @@ + + +Sending a message through PresentationConnection + + + + + + + +

Click the button below and select the available presentation display, to start the manual test.

+ + + diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnection_terminate-manual.https.html b/testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnection_terminate-manual.https.html new file mode 100644 index 0000000000..6484e97c5a --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/PresentationConnection_terminate-manual.https.html @@ -0,0 +1,71 @@ + + +Terminating a presentation in a receiving browsing context + + + + + + + + +

Click the button below and select the available presentation display, to start the manual test.

+ + + + diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/PresentationReceiver_create-manual.https.html b/testing/web-platform/tests/presentation-api/receiving-ua/PresentationReceiver_create-manual.https.html new file mode 100644 index 0000000000..96fc6f345d --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/PresentationReceiver_create-manual.https.html @@ -0,0 +1,272 @@ + + +Creating a receiving browsing context + + + + + + + +

+ Click the button below and select the available presentation display, to start the manual test. The test passes if a "PASS" result appears.
+ This test asks you to click the button twice, unless the test fails.
+ +

+ + diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/cache.txt b/testing/web-platform/tests/presentation-api/receiving-ua/cache.txt new file mode 100644 index 0000000000..551e8ff210 --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/cache.txt @@ -0,0 +1 @@ +Hello, Presentation API! \ No newline at end of file diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/common.js b/testing/web-platform/tests/presentation-api/receiving-ua/common.js new file mode 100644 index 0000000000..cbee5b4702 --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/common.js @@ -0,0 +1,63 @@ +(window => { + // Both a controlling side and a receiving one must share the same Stash ID to + // transmit data from one to the other. On the other hand, due to polling mechanism + // which cleans up a stash, stashes in both controller-to-receiver direction + // and one for receiver-to-controller are necessary. + window.stashIds = { + toController: '0c382524-5738-4df0-837d-4f53ea8addc2', + toReceiver: 'a9618cd1-ca2b-4155-b7f6-630dce953c44' + } + + // handle a test result received from a receiving page + const parseValue = value => { + let r; + + // String + if (r = value.match(/^(\(string\)\s+)?"(.*)"$/)) + return r[2]; + // Object + else if (r = value.match(/^(\(object\)\s+)?object\s+"\[object\s+(.*)\]"$/)) + return window[r[2]].prototype; + // Number, boolean, null, undefined + else { + if (r = value.match(/^(\(\S+\)\s+)?(\S+)$/)) { + try { + return JSON.parse(r[2]); + } catch(e) { + return value; + } + } + else + return value; + } + }; + + window.parseResult = message => { + let r = message.match(/^(assert_.*):\s+(.*)$/); + if (r) { + const assertion = r[1]; + const body = r[2]; + let args; + switch (assertion) { + case 'assert_equals': + if (r = body.match(/^((.*)\s+)?expected\s+((\(\S*\)\s+)?(\S+|(\S+\s+)?\".*\"))\s+but\s+got\s+((\(\S*\)\s+)?(\S+|(\S+\s+)?\".*\"))$/)) + args = [parseValue(r[7]), parseValue(r[3]), r[2]]; + break; + case 'assert_true': + if (r = body.match(/^((.*)\s+)?expected\s+(true|false)\s+got\s+(\S+|(\S+\s+)?\".*\")$/)) + args = [parseValue(r[4]), r[2]]; + break; + case 'assert_unreached': + if (r = body.match(/^((.*)\s+)?Reached\s+unreachable\s+code$/)) + args = [r[2]]; + break; + } + if (args) { + window[assertion](args[0], args[1], args[2]); + return; + } + } + // default + assert_unreached('Test result received from a receiving user agent: ' + message + ': '); + }; +})(window); \ No newline at end of file diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/idlharness-manual.https.html b/testing/web-platform/tests/presentation-api/receiving-ua/idlharness-manual.https.html new file mode 100644 index 0000000000..c7bd7344d5 --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/idlharness-manual.https.html @@ -0,0 +1,44 @@ + + +Presentation API IDL tests for Receiving User Agent + + + + + +

Click the button below and select the available presentation display, to start the manual test.

+ + + diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/serviceworker.js b/testing/web-platform/tests/presentation-api/receiving-ua/serviceworker.js new file mode 100644 index 0000000000..ae50ad6498 --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/serviceworker.js @@ -0,0 +1,15 @@ +self.addEventListener('install', () => { + // activate this service worker immediately + self.skipWaiting(); +}); + +self.addEventListener('activate', event => { + // let this service worker control window clients immediately + event.waitUntil(self.clients.claim()); +}); + +self.addEventListener('message', event => { + event.waitUntil(clients.matchAll().then(windows => { + event.ports[0].postMessage(windows.map(w => { return w.url; }).sort()); + })); +}); diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnectionList_onconnectionavailable_receiving-ua.html b/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnectionList_onconnectionavailable_receiving-ua.html new file mode 100644 index 0000000000..74d8dfa0ed --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnectionList_onconnectionavailable_receiving-ua.html @@ -0,0 +1,92 @@ + + + +Monitoring incoming presentation connections + + + + + + + + diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnection_onclose_receiving-ua.html b/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnection_onclose_receiving-ua.html new file mode 100644 index 0000000000..7194c6f4d9 --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnection_onclose_receiving-ua.html @@ -0,0 +1,89 @@ + + + +Closing a PresentationConnection + + + + + + + + diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnection_onmessage_receiving-ua.html b/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnection_onmessage_receiving-ua.html new file mode 100644 index 0000000000..0734a5570c --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnection_onmessage_receiving-ua.html @@ -0,0 +1,108 @@ + + +Receiving a message through PresentationConnection + + + + + + + + diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnection_send_receiving-ua.html b/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnection_send_receiving-ua.html new file mode 100644 index 0000000000..bc482e9dfd --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnection_send_receiving-ua.html @@ -0,0 +1,45 @@ + + + +Sending a message through PresentationConnection + + + + + + diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnection_terminate_receiving-ua.html b/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnection_terminate_receiving-ua.html new file mode 100644 index 0000000000..3a234aaa83 --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationConnection_terminate_receiving-ua.html @@ -0,0 +1,23 @@ + + + +Terminating a presentation in a receiving browsing context + + + + + + diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationReceiver_create_receiving-ua.html b/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationReceiver_create_receiving-ua.html new file mode 100644 index 0000000000..53f7601442 --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationReceiver_create_receiving-ua.html @@ -0,0 +1,328 @@ + + + +Creating a receiving browsing context + + + + + + + + + +

Checking : if you see this message, please wait for test to time out.

+do not navigate + diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationReceiver_create_receiving-ua_child.html b/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationReceiver_create_receiving-ua_child.html new file mode 100644 index 0000000000..2f67f7fac0 --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationReceiver_create_receiving-ua_child.html @@ -0,0 +1,171 @@ + + + +Creating a receiving browsing context + + + + +

Checking : if you see this message, please wait for test to time out.

+ + diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationReceiver_unreached_receiving-ua.html b/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationReceiver_unreached_receiving-ua.html new file mode 100644 index 0000000000..2b2a8b315e --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/support/PresentationReceiver_unreached_receiving-ua.html @@ -0,0 +1,21 @@ + + + +Creating a receiving browsing context + + + + + + + diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/support/idlharness_receiving-ua.html b/testing/web-platform/tests/presentation-api/receiving-ua/support/idlharness_receiving-ua.html new file mode 100644 index 0000000000..2d5a5b17f1 --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/support/idlharness_receiving-ua.html @@ -0,0 +1,41 @@ + + +Presentation API IDL tests for Receiving User Agent + + + + + + + + + + + diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/support/iframe.html b/testing/web-platform/tests/presentation-api/receiving-ua/support/iframe.html new file mode 100644 index 0000000000..61f18b8912 --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/support/iframe.html @@ -0,0 +1,22 @@ + + +Helper functions invoked by a nested browsing context + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/support/serviceworker.js b/testing/web-platform/tests/presentation-api/receiving-ua/support/serviceworker.js new file mode 100644 index 0000000000..d2d4449ded --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/support/serviceworker.js @@ -0,0 +1,9 @@ +self.addEventListener('install', () => { + // activate this service worker immediately + self.skipWaiting(); +}); + +self.addEventListener('activate', event => { + // let this service worker control window clients immediately + event.waitUntil(self.clients.claim()); +}); diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/support/stash.js b/testing/web-platform/tests/presentation-api/receiving-ua/support/stash.js new file mode 100644 index 0000000000..eb63bb8623 --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/support/stash.js @@ -0,0 +1,98 @@ +var Stash = function(inbound, outbound) { + this.stashPath = '/presentation-api/receiving-ua/support/stash.py?id='; + this.inbound = inbound; + this.outbound = outbound; +} + +// initialize a stash on wptserve +Stash.prototype.init = function() { + return Promise.all([ + fetch(this.stashPath + this.inbound).then(response => { + return response.text(); + }), + fetch(this.stashPath + this.outbound).then(response => { + return response.text(); + }) + ]); +} + +// upload a test result to a stash on wptserve +Stash.prototype.send = function(result) { + return fetch(this.stashPath + this.outbound, { + method: 'POST', + body: JSON.stringify({ type: 'data', data: result }) + }).then(response => { + return response.text(); + }).then(text => { + return text === 'ok' ? null : Promise.reject(); + }) +}; + +// upload a test result to a stash on wptserve via navigator.sendBeacon +Stash.prototype.sendBeacon = function(result) { + if ('sendBeacon' in navigator) { + navigator.sendBeacon(this.stashPath + this.outbound, JSON.stringify({ type: 'data', data: result })); + } + // Note: The following could be discarded, since XHR in synchronous mode is now being deprecated. + else { + return new Promise(resolve, reject => { + const xhr = new XMLHttpRequest(); + xhr.open('POST', this.stashPath + this.outbound, false); + xhr.send(JSON.stringify({ type: 'data', data: result })); + }); + } +}; + +// wait until a test result is uploaded to a stash on wptserve +Stash.prototype.receive = function() { + return new Promise((resolve, reject) => { + let intervalId; + const interval = 500; // msec + const polling = () => { + return fetch(this.stashPath + this.inbound).then(response => { + return response.text(); + }).then(text => { + if (text) { + try { + const json = JSON.parse(text); + if (json.type === 'data') + resolve(json.data); + else + reject(); + } catch(e) { + resolve(text); + } + clearInterval(intervalId); + } + }); + }; + intervalId = setInterval(polling, interval); + }); +}; + +// reset a stash on wptserve +Stash.prototype.stop = function() { + return Promise.all([ + fetch(this.stashPath + this.inbound).then(response => { + return response.text(); + }), + fetch(this.stashPath + this.outbound).then(response => { + return response.text(); + }) + ]).then(() => { + return Promise.all([ + fetch(this.stashPath + this.inbound, { + method: 'POST', + body: JSON.stringify({ type: 'stop' }) + }).then(response => { + return response.text(); + }), + fetch(this.stashPath + this.outbound, { + method: 'POST', + body: JSON.stringify({ type: 'stop' }) + }).then(response => { + return response.text(); + }) + ]); + }); +} diff --git a/testing/web-platform/tests/presentation-api/receiving-ua/support/stash.py b/testing/web-platform/tests/presentation-api/receiving-ua/support/stash.py new file mode 100644 index 0000000000..83653d365a --- /dev/null +++ b/testing/web-platform/tests/presentation-api/receiving-ua/support/stash.py @@ -0,0 +1,10 @@ +def main(request, response): + key = request.GET.first(b"id") + + if request.method == u"POST": + request.server.stash.put(key, request.body) + return b"ok" + else: + value = request.server.stash.take(key) + assert request.server.stash.take(key) is None + return value \ No newline at end of file -- cgit v1.2.3