summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/resource-timing/resources/header-delay.py
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/resource-timing/resources/header-delay.py')
-rw-r--r--testing/web-platform/tests/resource-timing/resources/header-delay.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/testing/web-platform/tests/resource-timing/resources/header-delay.py b/testing/web-platform/tests/resource-timing/resources/header-delay.py
new file mode 100644
index 0000000000..631f7855f8
--- /dev/null
+++ b/testing/web-platform/tests/resource-timing/resources/header-delay.py
@@ -0,0 +1,29 @@
+from time import sleep
+
+def main(request, response):
+ delay = int(request.GET.first(b"delay")) / 1000
+
+ # TODO: make this exported from ResponseWriter
+ handler = response.writer._handler
+ if b"with100" in request.GET:
+ sleep(delay)
+ handler.send_response(100)
+ handler.end_headers()
+
+ if b"with103" in request.GET:
+ sleep(delay)
+ handler.send_response(103)
+ handler.send_header("Link", "<resources/empty.js>;rel=preload;as=script")
+ handler.end_headers()
+
+ sleep(delay)
+
+ handler.send_response(200)
+
+ if b"tao" in request.GET:
+ handler.send_header("timing-allow-origin", "*")
+
+ handler.send_header("content-type", "text/plain")
+ handler.send_header("access-control-allow-origin", "*")
+ handler.end_headers()
+ handler.wfile.write(bytes("Hello World", "utf8"))