aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/wpt/metadata/MANIFEST.json29
-rw-r--r--tests/wpt/web-platform-tests/http/basic-auth-cache-test-ref.html6
-rw-r--r--tests/wpt/web-platform-tests/http/basic-auth-cache-test.html15
-rw-r--r--tests/wpt/web-platform-tests/http/resources/image.pngbin0 -> 11171 bytes
-rw-r--r--tests/wpt/web-platform-tests/http/resources/securedimage.py17
5 files changed, 66 insertions, 1 deletions
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 @@
+<!doctype html>
+<meta charset="utf-8">
+<html>
+ <img src="resources/image.png">
+ <img src="resources/image.png">
+</html>
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 @@
+<!doctype html>
+<meta charset="utf-8">
+<link rel="match" href="basic-auth-cache-test-ref.html">
+<html>
+ <div id="auth"> </div>
+ <div id="noauth"> </div>
+ <script type="text/javascript">
+ var authImg = '<img src="http://testuser:testpass@' + window.location.host + '/http/resources/securedimage.py">';
+ document.getElementById('auth').innerHTML = authImg;
+ setTimeout(function() {
+ var noAuthImg = '<img src="http://' + window.location.host + '/http/resources/securedimage.py">';
+ document.getElementById('noauth').innerHTML = noAuthImg;
+ }, 100);
+ </script>
+</html>
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
--- /dev/null
+++ b/tests/wpt/web-platform-tests/http/resources/image.png
Binary files 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)