diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 855adc0d2f9..8b351d14d93 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -37486,9 +37486,36 @@ "url": "/dom/lists/DOMTokenList-Iterable.html" } ] + }, + "reftest": { + "http/basic-auth-cache-test.html": [ + { + "path": "http/basic-auth-cache-test.html", + "references": [ + [ + "/http/basic-auth-cache-test-ref.html", + "==" + ] + ], + "url": "/http/basic-auth-cache-test.html" + } + ] } }, - "reftest_nodes": {} + "reftest_nodes": { + "http/reftest-basic-auth-cache-test.html": [ + { + "path": "http/basic-auth-cache-test.html", + "references": [ + [ + "/http/basic-auth-cache-test-ref.html", + "==" + ] + ], + "url": "/http/basic-auth-cache-test.html" + } + ] + } }, "reftest_nodes": { "2dcontext/building-paths/canvas_complexshapes_arcto_001.htm": [ diff --git a/tests/wpt/web-platform-tests/http/basic-auth-cache-test-ref.html b/tests/wpt/web-platform-tests/http/basic-auth-cache-test-ref.html new file mode 100644 index 00000000000..22b0deb4ebb --- /dev/null +++ b/tests/wpt/web-platform-tests/http/basic-auth-cache-test-ref.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/wpt/web-platform-tests/http/basic-auth-cache-test.html b/tests/wpt/web-platform-tests/http/basic-auth-cache-test.html new file mode 100644 index 00000000000..b599c0925ad --- /dev/null +++ b/tests/wpt/web-platform-tests/http/basic-auth-cache-test.html @@ -0,0 +1,15 @@ + + + + +
+
+ + diff --git a/tests/wpt/web-platform-tests/http/resources/image.png b/tests/wpt/web-platform-tests/http/resources/image.png new file mode 100644 index 00000000000..0daa1b519e5 Binary files /dev/null and b/tests/wpt/web-platform-tests/http/resources/image.png differ diff --git a/tests/wpt/web-platform-tests/http/resources/securedimage.py b/tests/wpt/web-platform-tests/http/resources/securedimage.py new file mode 100644 index 00000000000..6f6f0628369 --- /dev/null +++ b/tests/wpt/web-platform-tests/http/resources/securedimage.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 - + +def main(request, response): + image_url = str.replace(request.url, "securedimage.py", "image.png") + + if "authorization" not in request.headers: + response.status = 401 + response.headers.set("WWW-Authenticate", "Basic") + return response + else: + auth = request.headers.get("Authorization") + if auth != "Basic dGVzdHVzZXI6dGVzdHBhc3M=": + response.set_error(403, "Invalid username or password - " + auth) + return response + + response.status = 301 + response.headers.set("Location", image_url)