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 --- .../tests/infrastructure/server/context.any.js | 13 + .../server/http2-context.sub.h2.any.js | 12 + .../server/http2-websocket.sub.h2.any.js | 20 ++ .../infrastructure/server/order-of-metas.any.js | 10 + .../infrastructure/server/order-of-metas.window.js | 8 + .../server/resources/expect-global.js | 5 + .../server/resources/expect-seen-testharness.js | 5 + .../server/resources/expect-title-meta.js | 11 + .../infrastructure/server/resources/proxy.sub.pac | 7 + .../server/secure-context.https.any.js | 10 + .../server/subdomain-flag.www.sub.window.js | 5 + .../tests/infrastructure/server/test-pac.html | 12 + .../tests/infrastructure/server/title.any.js | 13 + .../server/webtransport-h3.https.sub.any.js | 26 ++ .../infrastructure/server/wpt-server-http.sub.html | 262 +++++++++++++++++++++ .../server/wpt-server-websocket.sub.html | 122 ++++++++++ .../server/wpt-server-wpt-flags.sub.html | 32 +++ 17 files changed, 573 insertions(+) create mode 100644 testing/web-platform/tests/infrastructure/server/context.any.js create mode 100644 testing/web-platform/tests/infrastructure/server/http2-context.sub.h2.any.js create mode 100644 testing/web-platform/tests/infrastructure/server/http2-websocket.sub.h2.any.js create mode 100644 testing/web-platform/tests/infrastructure/server/order-of-metas.any.js create mode 100644 testing/web-platform/tests/infrastructure/server/order-of-metas.window.js create mode 100644 testing/web-platform/tests/infrastructure/server/resources/expect-global.js create mode 100644 testing/web-platform/tests/infrastructure/server/resources/expect-seen-testharness.js create mode 100644 testing/web-platform/tests/infrastructure/server/resources/expect-title-meta.js create mode 100644 testing/web-platform/tests/infrastructure/server/resources/proxy.sub.pac create mode 100644 testing/web-platform/tests/infrastructure/server/secure-context.https.any.js create mode 100644 testing/web-platform/tests/infrastructure/server/subdomain-flag.www.sub.window.js create mode 100644 testing/web-platform/tests/infrastructure/server/test-pac.html create mode 100644 testing/web-platform/tests/infrastructure/server/title.any.js create mode 100644 testing/web-platform/tests/infrastructure/server/webtransport-h3.https.sub.any.js create mode 100644 testing/web-platform/tests/infrastructure/server/wpt-server-http.sub.html create mode 100644 testing/web-platform/tests/infrastructure/server/wpt-server-websocket.sub.html create mode 100644 testing/web-platform/tests/infrastructure/server/wpt-server-wpt-flags.sub.html (limited to 'testing/web-platform/tests/infrastructure/server') diff --git a/testing/web-platform/tests/infrastructure/server/context.any.js b/testing/web-platform/tests/infrastructure/server/context.any.js new file mode 100644 index 0000000000..11ab76d874 --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/context.any.js @@ -0,0 +1,13 @@ +// META: global=window,dedicatedworker,sharedworker,serviceworker,dedicatedworker-module,sharedworker-module,serviceworker-module +test(t => { + // Test for object that's only exposed in serviceworker + if (self.clients) { + assert_true(self.isSecureContext); + assert_equals(location.protocol, "https:"); + } else { + assert_false(self.isSecureContext); + assert_equals(location.protocol, "http:"); + } +}); + +done(); diff --git a/testing/web-platform/tests/infrastructure/server/http2-context.sub.h2.any.js b/testing/web-platform/tests/infrastructure/server/http2-context.sub.h2.any.js new file mode 100644 index 0000000000..26f7007418 --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/http2-context.sub.h2.any.js @@ -0,0 +1,12 @@ +// META: global=window,dedicatedworker,sharedworker,serviceworker +test(() => { + assert_true(self.isSecureContext); +}, "Use of .h2. file name flag implies secure context"); + +test(() => { + assert_equals(location.protocol, "https:"); +}, "Use of .h2. file name flag implies HTTPS scheme"); + +test(() => { + assert_equals(location.port, "{{ports[h2][0]}}"); +}, "Use of .h2. file name flag implies correct port"); diff --git a/testing/web-platform/tests/infrastructure/server/http2-websocket.sub.h2.any.js b/testing/web-platform/tests/infrastructure/server/http2-websocket.sub.h2.any.js new file mode 100644 index 0000000000..617f9ca4e0 --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/http2-websocket.sub.h2.any.js @@ -0,0 +1,20 @@ +function check(protocol, domain, port, done) { + var url = protocol + '://' + domain + ':' + port + '/echo'; + var ws = new WebSocket(url); + + ws.addEventListener('error', function() { + done(false); + }); + + ws.addEventListener('open', function() { + done(true); + }); +} + +async_test(function(t) { + check('wss', '{{browser_host}}', {{ports[h2][0]}}, t.step_func(function(result) { + assert_true(result); + + t.done(); + })); +}, 'WSS over h2'); diff --git a/testing/web-platform/tests/infrastructure/server/order-of-metas.any.js b/testing/web-platform/tests/infrastructure/server/order-of-metas.any.js new file mode 100644 index 0000000000..20f678475c --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/order-of-metas.any.js @@ -0,0 +1,10 @@ +// META: global=window,dedicatedworker,sharedworker +// META: script=resources/expect-seen-testharness.js +// META: timeout=long +// META: title=foo +// META: script=resources/expect-global.js +// META: script=resources/expect-title-meta.js + +test(() => { + assert_array_equals(scripts, ['expect-seen-testharness.js', 'expect-global.js', 'expect-title-meta.js']); +}, "order of scripts"); diff --git a/testing/web-platform/tests/infrastructure/server/order-of-metas.window.js b/testing/web-platform/tests/infrastructure/server/order-of-metas.window.js new file mode 100644 index 0000000000..ec2848056a --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/order-of-metas.window.js @@ -0,0 +1,8 @@ +// META: script=resources/expect-seen-testharness.js +// META: timeout=long +// META: title=foo +// META: script=resources/expect-title-meta.js + +test(() => { + assert_array_equals(scripts, ['expect-seen-testharness.js', 'expect-title-meta.js']); +}, "order of scripts"); diff --git a/testing/web-platform/tests/infrastructure/server/resources/expect-global.js b/testing/web-platform/tests/infrastructure/server/resources/expect-global.js new file mode 100644 index 0000000000..63d4944e61 --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/resources/expect-global.js @@ -0,0 +1,5 @@ +test(() => { + assert_true('GLOBAL' in self); +}, 'GLOBAL exists'); + +scripts.push('expect-global.js'); diff --git a/testing/web-platform/tests/infrastructure/server/resources/expect-seen-testharness.js b/testing/web-platform/tests/infrastructure/server/resources/expect-seen-testharness.js new file mode 100644 index 0000000000..29af1fca55 --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/resources/expect-seen-testharness.js @@ -0,0 +1,5 @@ +test(() => { + assert_true('add_completion_callback' in self); +}, 'add_completion_callback exists'); + +var scripts = ['expect-seen-testharness.js']; diff --git a/testing/web-platform/tests/infrastructure/server/resources/expect-title-meta.js b/testing/web-platform/tests/infrastructure/server/resources/expect-title-meta.js new file mode 100644 index 0000000000..d17588a18f --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/resources/expect-title-meta.js @@ -0,0 +1,11 @@ +if (!self.GLOBAL || self.GLOBAL.isWindow()) { + test(() => { + assert_equals(document.title, "foo"); + }, ' exists'); + + test(() => { + assert_equals(document.querySelectorAll("meta[name=timeout][content=long]").length, 1); + }, '<meta name=timeout> exists'); +} + +scripts.push('expect-title-meta.js'); diff --git a/testing/web-platform/tests/infrastructure/server/resources/proxy.sub.pac b/testing/web-platform/tests/infrastructure/server/resources/proxy.sub.pac new file mode 100644 index 0000000000..78ce023448 --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/resources/proxy.sub.pac @@ -0,0 +1,7 @@ +function FindProxyForURL(url, host) { + if (dnsDomainIs(host, '.wpt.test')) { + return "PROXY 127.0.0.1:{{ports[http][0]}}" + } + + return "DIRECT"; +} diff --git a/testing/web-platform/tests/infrastructure/server/secure-context.https.any.js b/testing/web-platform/tests/infrastructure/server/secure-context.https.any.js new file mode 100644 index 0000000000..626fa70069 --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/secure-context.https.any.js @@ -0,0 +1,10 @@ +// META: global=window,dedicatedworker,sharedworker,serviceworker +test(() => { + assert_true(self.isSecureContext); +}, "Use of .https file name flag implies secure context"); + +test(() => { + assert_equals(location.protocol, "https:"); +}, "Use of .https file name flag implies HTTPS scheme"); + +done(); diff --git a/testing/web-platform/tests/infrastructure/server/subdomain-flag.www.sub.window.js b/testing/web-platform/tests/infrastructure/server/subdomain-flag.www.sub.window.js new file mode 100644 index 0000000000..9b4140340a --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/subdomain-flag.www.sub.window.js @@ -0,0 +1,5 @@ +test(() => { + assert_equals(location.hostname, "{{domains[www]}}"); +}, "Use of .www. file name flag implies www subdomain"); + +done(); diff --git a/testing/web-platform/tests/infrastructure/server/test-pac.html b/testing/web-platform/tests/infrastructure/server/test-pac.html new file mode 100644 index 0000000000..598836d376 --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/test-pac.html @@ -0,0 +1,12 @@ +<!DOCTYPE HTML> +<title>test behavior of PROXY configuration (PAC) + + + + diff --git a/testing/web-platform/tests/infrastructure/server/title.any.js b/testing/web-platform/tests/infrastructure/server/title.any.js new file mode 100644 index 0000000000..df2f8b048c --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/title.any.js @@ -0,0 +1,13 @@ +// META: global=window,dedicatedworker,sharedworker +// META: title=foobar +test(t => { + if (GLOBAL.isWindow()) { + assert_equals(document.title, 'foobar'); + assert_false('META_TITLE' in self); + } else { + assert_equals(META_TITLE, 'foobar'); + } + assert_equals(t.name, 'foobar'); +}); + +done(); diff --git a/testing/web-platform/tests/infrastructure/server/webtransport-h3.https.sub.any.js b/testing/web-platform/tests/infrastructure/server/webtransport-h3.https.sub.any.js new file mode 100644 index 0000000000..1a0c10031d --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/webtransport-h3.https.sub.any.js @@ -0,0 +1,26 @@ +// META: global=window,worker +// META: script=/common/get-host-info.sub.js + +const HOST = get_host_info().ORIGINAL_HOST; +const PORT = '{{ports[webtransport-h3][0]}}'; +const BASE = `https://${HOST}:${PORT}`; + +promise_test(async t => { + const wt = new WebTransport(`${BASE}/webtransport/handlers/echo.py`); + // When a connection fails `closed` attribute will be rejected. + wt.closed.catch((error) => { + t.unreached_func(`The 'closed' attribute should not be rejected: ${error}`); + }); + await wt.ready; + + const stream = await wt.createBidirectionalStream(); + + const writer = stream.writable.getWriter(); + await writer.write(new Uint8Array([42])); + writer.releaseLock(); + + const reader = stream.readable.getReader(); + const { value } = await reader.read(); + + assert_equals(value[0], 42); +}, "WebTransport server should be running and should handle a bidirectional stream"); diff --git a/testing/web-platform/tests/infrastructure/server/wpt-server-http.sub.html b/testing/web-platform/tests/infrastructure/server/wpt-server-http.sub.html new file mode 100644 index 0000000000..8d71e7e3a2 --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/wpt-server-http.sub.html @@ -0,0 +1,262 @@ + + + + WPT Server checker + + + + + + + + + diff --git a/testing/web-platform/tests/infrastructure/server/wpt-server-websocket.sub.html b/testing/web-platform/tests/infrastructure/server/wpt-server-websocket.sub.html new file mode 100644 index 0000000000..ea7973a62e --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/wpt-server-websocket.sub.html @@ -0,0 +1,122 @@ + + + + WPT Server checker + + + + + + + + + diff --git a/testing/web-platform/tests/infrastructure/server/wpt-server-wpt-flags.sub.html b/testing/web-platform/tests/infrastructure/server/wpt-server-wpt-flags.sub.html new file mode 100644 index 0000000000..9af9cda463 --- /dev/null +++ b/testing/web-platform/tests/infrastructure/server/wpt-server-wpt-flags.sub.html @@ -0,0 +1,32 @@ + + + + WPT Server checker + + + + + + + + + + + + -- cgit v1.2.3