From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../fetch/api/credentials/authentication-basic.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 testing/web-platform/tests/fetch/api/credentials/authentication-basic.js (limited to 'testing/web-platform/tests/fetch/api/credentials/authentication-basic.js') diff --git a/testing/web-platform/tests/fetch/api/credentials/authentication-basic.js b/testing/web-platform/tests/fetch/api/credentials/authentication-basic.js new file mode 100644 index 000000000..ce93e9d7b --- /dev/null +++ b/testing/web-platform/tests/fetch/api/credentials/authentication-basic.js @@ -0,0 +1,21 @@ +if (this.document === undefined) { + importScripts("/resources/testharness.js"); + importScripts("../resources/utils.js"); +} + +function basicAuth(desc, user, pass, mode, status) { + promise_test(function(test) { + var headers = { "Authorization": "Basic " + btoa(user + ":" + pass)}; + var requestInit = {"credentials": mode, "headers": headers}; + return fetch(RESOURCES_DIR + "authentication.py?realm=test", requestInit).then(function(resp) { + assert_equals(resp.status, status, "HTTP status is " + status); + assert_equals(resp.type , "basic", "Response's type is basic"); + }); + }, desc); +} + +basicAuth("User-added Authorization header with include mode", "user", "password", "include", 200); +basicAuth("User-added Authorization header with same-origin mode", "user", "password", "same-origin", 200); +basicAuth("User-added Authorization header with omit mode", "user", "password", "omit", 200); + +done(); -- cgit v1.2.3