blob: f884365aef896b4852ac49841f42f4564b5fed82 [file] [log] [blame]
Yoav Weiss807956f2019-09-11 13:36:571<!doctype html>
2<html>
3<head>
4<script src="/resources/testharness.js"></script>
5<script src="/resources/testharnessreport.js"></script>
6</head>
7<body>
8<img src="resources/status-code.py?status=200">
9<img src="resources/status-code.py?status=307">
10<img src="resources/status-code.py?status=404">
11<img src="resources/status-code.py?status=502">
Nicolás Peña Morenof4bf0342020-05-06 21:07:5812<script src="resources/status-code.py?status=200&script=1"></script>
13<script src="resources/status-code.py?status=307&script=1"></script>
14<script src="resources/status-code.py?status=404&script=1"></script>
15<script src="resources/status-code.py?status=502&script=1"></script>
Yoav Weiss807956f2019-09-11 13:36:5716<script>
17async_test(t => {
Nicolás Peña Morenof4bf0342020-05-06 21:07:5818 window.addEventListener("load", t.step_func_done(() => {
Yoav Weiss807956f2019-09-11 13:36:5719 const images = document.getElementsByTagName("img");
20 for (let img of images) {
Yoav Weissd9a933a2021-01-07 20:31:4821 const entries = performance.getEntriesByName(img.src);
22 assert_greater_than(entries.length, 0, img.src);
23 assert_greater_than(entries[0].duration, 0, img.src);
Yoav Weiss807956f2019-09-11 13:36:5724 }
Nicolás Peña Morenof4bf0342020-05-06 21:07:5825 const scripts = document.getElementsByTagName("script");
Jonathan Leedbf4b1c2024-09-27 22:17:0226 let ignoredScripts = 0;
Nicolás Peña Morenof4bf0342020-05-06 21:07:5827 for (let script of scripts) {
Jonathan Leedbf4b1c2024-09-27 22:17:0228 if (!script.src || script.src.match(/testharness(report)?\.js$/)) {
29 // Ignore this script, which has no src value, and the `testharness*.js`
30 // scripts. `testharness*.js` may be cached from a previous test and
31 // served quickly enough for a coarsened `duration` to be zero exactly.
32 ignoredScripts++;
33 } else {
Yoav Weissd9a933a2021-01-07 20:31:4834 const entries = performance.getEntriesByName(script.src);
35 assert_greater_than(entries.length, 0, script.src);
36 assert_greater_than(entries[0].duration, 0, script.src);
Nicolás Peña Morenof4bf0342020-05-06 21:07:5837 }
38 }
Jonathan Leedbf4b1c2024-09-27 22:17:0239 assert_equals(ignoredScripts, 3);
Yoav Weiss807956f2019-09-11 13:36:5740 }));
41}, "Make sure all status codes are reported");
42</script>