diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/resource-timing/interim-response-times.h2.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/resource-timing/interim-response-times.h2.html')
-rw-r--r-- | testing/web-platform/tests/resource-timing/interim-response-times.h2.html | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/testing/web-platform/tests/resource-timing/interim-response-times.h2.html b/testing/web-platform/tests/resource-timing/interim-response-times.h2.html new file mode 100644 index 0000000000..4b1ca93ff7 --- /dev/null +++ b/testing/web-platform/tests/resource-timing/interim-response-times.h2.html @@ -0,0 +1,74 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8" /> +<meta name="timeout" content="long"> +<title>Resource Timing: PerformanceResourceTiming interim resource times</title> +<link rel="author" title="Google" href="http://www.google.com/" /> +<script src="/common/utils.js"></script> +<script src="/common/get-host-info.sub.js"></script> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> + const {REMOTE_HOST} = get_host_info(); + function interim_response_time_test({origin, with100, with103}) { + promise_test(async t => { + const delay = 500; + const url = new URL('/resource-timing/resources/header-delay.h2.py', + origin == "same-origin" ? + location.href : + `${location.protocol}//${REMOTE_HOST}:${location.port}`); + url.searchParams.set("delay", delay); + if (origin === "cross-origin-with-TAO") + url.searchParams.set("tao", "*"); + if (with100) + url.searchParams.set("with100", "true"); + if (with103) + url.searchParams.set("with103", "true"); + const response = await fetch(url.toString(), {mode: "cors"}); + assert_equals(response.status, 200) + await response.text(); + const [entry] = performance.getEntriesByName(url.toString()); + if (origin === "cross-origin") { + assert_equals(entry.firstInterimResponseStart, 0); + return; + } + let total_delay = entry.requestStart; + if (with100) { + total_delay += delay; + assert_greater_than(entry.firstInterimResponseStart, + total_delay, + "firstInterimResponseStart > 100 response"); + } + + if (with103) { + total_delay += delay; + if (with100) { + assert_less_than_equal(entry.firstInterimResponseStart, + total_delay, "firstInterimResponseStart > 100 response"); + } else { + assert_greater_than(entry.firstInterimResponseStart, + delay, "firstInterimResponseStart > 100 response"); + } + } + + total_delay += delay; + if (!with100 && !with103) + assert_equals(entry.firstInterimResponseStart, 0); + + assert_greater_than(entry.responseStart, total_delay, + "responseStart"); + }, `Fetch from ${origin} ${with103 ? "with" : "without"} early hints, ${ + with100 ? "with" : "without"} 100 response`); + } + + for (const with103 of [true, false]) { + for (const with100 of [true, false]) { + for (origin of ['same-origin', 'cross-origin', 'cross-origin-with-TAO']) { + interim_response_time_test({with100, with103, origin}); + } + } + } +</script> +</body> +</html> |