summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/infrastructure/server
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/infrastructure/server')
-rw-r--r--testing/web-platform/tests/infrastructure/server/context.any.js13
-rw-r--r--testing/web-platform/tests/infrastructure/server/http2-context.sub.h2.any.js12
-rw-r--r--testing/web-platform/tests/infrastructure/server/http2-websocket.sub.h2.any.js20
-rw-r--r--testing/web-platform/tests/infrastructure/server/order-of-metas.any.js10
-rw-r--r--testing/web-platform/tests/infrastructure/server/order-of-metas.window.js8
-rw-r--r--testing/web-platform/tests/infrastructure/server/resources/expect-global.js5
-rw-r--r--testing/web-platform/tests/infrastructure/server/resources/expect-seen-testharness.js5
-rw-r--r--testing/web-platform/tests/infrastructure/server/resources/expect-title-meta.js11
-rw-r--r--testing/web-platform/tests/infrastructure/server/resources/proxy.sub.pac7
-rw-r--r--testing/web-platform/tests/infrastructure/server/secure-context.https.any.js10
-rw-r--r--testing/web-platform/tests/infrastructure/server/subdomain-flag.www.sub.window.js5
-rw-r--r--testing/web-platform/tests/infrastructure/server/test-pac.html12
-rw-r--r--testing/web-platform/tests/infrastructure/server/title.any.js13
-rw-r--r--testing/web-platform/tests/infrastructure/server/webtransport-h3.https.sub.any.js26
-rw-r--r--testing/web-platform/tests/infrastructure/server/wpt-server-http.sub.html262
-rw-r--r--testing/web-platform/tests/infrastructure/server/wpt-server-websocket.sub.html122
-rw-r--r--testing/web-platform/tests/infrastructure/server/wpt-server-wpt-flags.sub.html32
17 files changed, 573 insertions, 0 deletions
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");
+ }, '<title> 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)</title>
+<meta name="pac" content="resources/proxy.sub.pac">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+ promise_test(async t => {
+ const response = await fetch('http://not-a-real-domain.wpt.test/infrastructure/resources/ok.txt');
+ const text = await response.text();
+ assert_equals(text, 'OK');
+ }, 'test that PAC metadata is respected');
+</script>
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 @@
+<!doctype html>
+<html>
+ <head>
+ <title>WPT Server checker</title>
+ <meta charset="utf-8" />
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+</body>
+<body>
+<script>
+function check(protocol, domain, port, done) {
+ var scheme = protocol == "h2" ? "https" : protocol;
+ var url = scheme + '://' + domain + ':' + port + '/media/1x1-green.png';
+ var img = document.createElement('img');
+ img.setAttribute('src', url);
+ img.style.display = 'none';
+ img.onerror = function() {
+ done(false);
+ };
+ img.onload = function() {
+ done(true);
+ };
+
+ document.body.appendChild(img);
+}
+
+async_test(function(t) {
+ check('http', '{{browser_host}}', {{ports[http][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTP protocol, no subdomain, port #1');
+
+async_test(function(t) {
+ check('http', '{{browser_host}}', {{ports[http][1]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTP protocol, no subdomain, port #2');
+
+async_test(function(t) {
+ check('http', '{{domains[www]}}', {{ports[http][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTP protocol, www subdomain #1, port #1');
+
+async_test(function(t) {
+ check('http', '{{domains[www]}}', {{ports[http][1]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTP protocol, www subdomain #1, port #2');
+
+async_test(function(t) {
+ check('http', '{{domains[www1]}}', {{ports[http][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTP protocol, www subdomain #2, port #1');
+
+async_test(function(t) {
+ check('http', '{{domains[www1]}}', {{ports[http][1]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTP protocol, www subdomain #2, port #2');
+
+async_test(function(t) {
+ check('http', '{{domains[www2]}}', {{ports[http][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTP protocol, www subdomain #3, port #1');
+
+async_test(function(t) {
+ check('http', '{{domains[www2]}}', {{ports[http][1]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTP protocol, www subdomain #3, port #2');
+
+async_test(function(t) {
+ check('http', '{{domains[élève]}}', {{ports[http][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTP protocol, punycode subdomain #1, port #1');
+
+async_test(function(t) {
+ check('http', '{{domains[élève]}}', {{ports[http][1]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTP protocol, punycode subdomain #1, port #2');
+
+async_test(function(t) {
+ check('http', '{{domains[天気の良い日]}}', {{ports[http][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTP protocol, punycode subdomain #2, port #1');
+
+async_test(function(t) {
+ check('http', '{{domains[天気の良い日]}}', {{ports[http][1]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTP protocol, punycode subdomain #2, port #2');
+
+async_test(function(t) {
+ check('http', 'nonexistent.{{domains[]}}', {{ports[http][0]}}, t.step_func(function(result) {
+ assert_false(result);
+
+ t.done();
+ }));
+}, 'HTTP protocol, non-existent domain, port #1');
+
+async_test(function(t) {
+ check('http', 'nonexistent.{{domains[]}}', {{ports[http][1]}}, t.step_func(function(result) {
+ assert_false(result);
+
+ t.done();
+ }));
+}, 'HTTP protocol, non-existent domain, port #2');
+
+async_test(function(t) {
+ check('https', '{{browser_host}}', {{ports[https][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTPS protocol, no subdomain');
+
+async_test(function(t) {
+ check('https', '{{domains[www]}}', {{ports[https][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTPS protocol, www subdomain #1');
+
+async_test(function(t) {
+ check('https', '{{domains[www1]}}', {{ports[https][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTPS protocol, www subdomain #2');
+
+async_test(function(t) {
+ check('https', '{{domains[www2]}}', {{ports[https][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTPS protocol, www subdomain #3');
+
+async_test(function(t) {
+ check('https', '{{domains[élève]}}', {{ports[https][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTPS protocol, punycode subdomain #1');
+
+async_test(function(t) {
+ check('https', '{{domains[天気の良い日]}}', {{ports[https][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'HTTPS protocol, punycode subdomain #2');
+
+async_test(function(t) {
+ check('https', 'nonexistent.{{domains[]}}', {{ports[http][0]}}, t.step_func(function(result) {
+ assert_false(result);
+
+ t.done();
+ }));
+}, 'HTTPS protocol, non-existent domain, port #1');
+
+async_test(function(t) {
+ check('https', 'nonexistent.{{domains[]}}', {{ports[http][1]}}, t.step_func(function(result) {
+ assert_false(result);
+
+ t.done();
+ }));
+}, 'HTTPS protocol, non-existent domain, port #2');
+
+async_test(function(t) {
+ check('h2', '{{browser_host}}', {{ports[h2][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'H2 protocol, no subdomain');
+
+async_test(function(t) {
+ check('h2', '{{domains[www]}}', {{ports[h2][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'H2 protocol, www subdomain #1');
+
+async_test(function(t) {
+ check('h2', '{{domains[www1]}}', {{ports[h2][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'H2 protocol, www subdomain #2');
+
+async_test(function(t) {
+ check('h2', '{{domains[www2]}}', {{ports[h2][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'H2 protocol, www subdomain #3');
+
+async_test(function(t) {
+ check('h2', '{{domains[élève]}}', {{ports[h2][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'H2 protocol, punycode subdomain #1');
+
+async_test(function(t) {
+ check('h2', '{{domains[天気の良い日]}}', {{ports[h2][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'H2 protocol, punycode subdomain #2');
+
+async_test(function(t) {
+ check('h2', 'nonexistent.{{domains[]}}', {{ports[http][0]}}, t.step_func(function(result) {
+ assert_false(result);
+
+ t.done();
+ }));
+}, 'H2 protocol, non-existent domain, port #1');
+
+</script>
+</body>
+</html>
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 @@
+<!doctype html>
+<html>
+ <head>
+ <title>WPT Server checker</title>
+ <meta charset="utf-8" />
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+</body>
+<body>
+<script>
+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('ws', '{{browser_host}}', {{ports[ws][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'WS protocol, no subdomain');
+
+async_test(function(t) {
+ check('ws', '{{domains[www1]}}', {{ports[ws][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'WS protocol, www subdomain #1');
+
+async_test(function(t) {
+ check('ws', '{{domains[www1]}}', {{ports[ws][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'WS protocol, www subdomain #2');
+
+async_test(function(t) {
+ check('ws', '{{domains[www2]}}', {{ports[ws][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'WS protocol, www subdomain #3');
+
+async_test(function(t) {
+ check('ws', '{{domains[élève]}}', {{ports[ws][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'WS protocol, punycode subdomain #1');
+
+async_test(function(t) {
+ check('ws', '{{domains[天気の良い日]}}', {{ports[ws][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'WS protocol, punycode subdomain #2');
+
+async_test(function(t) {
+ check('wss', '{{browser_host}}', {{ports[wss][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'WSS protocol, no subdomain');
+
+async_test(function(t) {
+ check('wss', '{{domains[www1]}}', {{ports[wss][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'WSS protocol, www subdomain #1');
+
+async_test(function(t) {
+ check('wss', '{{domains[www1]}}', {{ports[wss][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'WSS protocol, www subdomain #2');
+
+async_test(function(t) {
+ check('wss', '{{domains[www2]}}', {{ports[wss][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'WSS protocol, www subdomain #3');
+
+async_test(function(t) {
+ check('wss', '{{domains[élève]}}', {{ports[wss][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'WSS protocol, punycode subdomain #1');
+
+async_test(function(t) {
+ check('wss', '{{domains[天気の良い日]}}', {{ports[wss][0]}}, t.step_func(function(result) {
+ assert_true(result);
+
+ t.done();
+ }));
+}, 'WSS protocol, punycode subdomain #2');
+</script>
+</body>
+</html>
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 @@
+<!doctype html>
+<html>
+ <head>
+ <title>WPT Server checker</title>
+ <meta charset="utf-8" />
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <meta name="variant" content="">
+ <meta name="variant" content="?wpt_flags=h2">
+ <meta name="variant" content="?wpt_flags=https">
+ </head>
+</body>
+<body>
+<script>
+
+if (location.search == '?wpt_flags=h2') {
+ test(function() {
+ assert_equals(document.location.port, "{{ports[h2][0]}}");
+ }, "h2 port with wpt_flags=h2")
+} else if (location.search == '?wpt_flags=https') {
+ test(function() {
+ assert_equals(document.location.port, "{{ports[https][0]}}");
+ }, "https port with wpt_flags=https")
+} else {
+ test(function() {
+ assert_equals(document.location.port, "{{ports[http][0]}}");
+ }, "http port without flag")
+}
+
+</script>
+</body>
+</html>