From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- ...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 + 13 files changed, 1057 insertions(+) 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/support') 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