From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:47:29 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- .../tests/content-dpr/resources/background.png | Bin 0 -> 86 bytes .../tests/content-dpr/resources/background.svg | 8 +++++++ .../tests/content-dpr/resources/dpr.py | 26 +++++++++++++++++++++ .../tests/content-dpr/resources/square.png | Bin 0 -> 18299 bytes 4 files changed, 34 insertions(+) create mode 100644 testing/web-platform/tests/content-dpr/resources/background.png create mode 100644 testing/web-platform/tests/content-dpr/resources/background.svg create mode 100644 testing/web-platform/tests/content-dpr/resources/dpr.py create mode 100644 testing/web-platform/tests/content-dpr/resources/square.png (limited to 'testing/web-platform/tests/content-dpr/resources') diff --git a/testing/web-platform/tests/content-dpr/resources/background.png b/testing/web-platform/tests/content-dpr/resources/background.png new file mode 100644 index 0000000000..6db6c6b1b9 Binary files /dev/null and b/testing/web-platform/tests/content-dpr/resources/background.png differ diff --git a/testing/web-platform/tests/content-dpr/resources/background.svg b/testing/web-platform/tests/content-dpr/resources/background.svg new file mode 100644 index 0000000000..b2c544ed2d --- /dev/null +++ b/testing/web-platform/tests/content-dpr/resources/background.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/testing/web-platform/tests/content-dpr/resources/dpr.py b/testing/web-platform/tests/content-dpr/resources/dpr.py new file mode 100644 index 0000000000..969ac2458d --- /dev/null +++ b/testing/web-platform/tests/content-dpr/resources/dpr.py @@ -0,0 +1,26 @@ +from wptserve.utils import isomorphic_decode + +def main(request, response): + """ + Simple handler that sets a response header based on which client hint + request headers were received. + """ + + response.headers.append(b"Access-Control-Allow-Origin", b"*") + values = request.GET + name = values.first(b'name') + type = values.first(b'mimeType') + dpr = values.first(b'dpr') + double = None + if b'double' in values: + double = values.first(b'double') + image_path = request.doc_root + u"/".join(request.url_parts[2].split(u"/")[:-1]) + u"/" + isomorphic_decode(name) + f = open(image_path, "rb") + buff = f.read() + f.close() + response.headers.set(b"Content-Type", type) + response.headers.set(b"Content-DPR", dpr) + if double: + response.headers.append(b"Content-DPR", double) + response.headers.set(b"Content-Length", len(buff)) + response.content = buff diff --git a/testing/web-platform/tests/content-dpr/resources/square.png b/testing/web-platform/tests/content-dpr/resources/square.png new file mode 100644 index 0000000000..01c9666a8d Binary files /dev/null and b/testing/web-platform/tests/content-dpr/resources/square.png differ -- cgit v1.2.3