Bug 1404708 - Fix XHR tests to load correct resources, r=jdm draft
authorJames Graham <james@hoppipolla.co.uk>
Tue, 24 Oct 2017 18:48:44 +0100
changeset 685569 dbad07fba09f612512cab00a9e08e120dd95e2f4
parent 685491 7abce615f68e6afdcff10738bf3abed10250bd2b
child 737189 f8c6e39e83654a0ba45c438a1524ea4904e730fc
push id85976
push userbmo:james@hoppipolla.co.uk
push dateTue, 24 Oct 2017 21:11:39 +0000
reviewersjdm
bugs1404708
milestone58.0a1
Bug 1404708 - Fix XHR tests to load correct resources, r=jdm MozReview-Commit-ID: 3JtC20N4b5H
testing/web-platform/meta/XMLHttpRequest/send-authentication-cors-basic-setrequestheader.htm.ini
testing/web-platform/tests/XMLHttpRequest/resources/auth2/corsenabled.py
testing/web-platform/tests/XMLHttpRequest/resources/auth7/corsenabled.py
testing/web-platform/tests/XMLHttpRequest/resources/auth8/corsenabled-no-authorize.py
deleted file mode 100644
--- a/testing/web-platform/meta/XMLHttpRequest/send-authentication-cors-basic-setrequestheader.htm.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[send-authentication-cors-basic-setrequestheader.htm]
-  type: testharness
-  [XMLHttpRequest: send() - "Basic" authenticated CORS request using setRequestHeader() (expects to succeed)]
-    expected: FAIL
-
--- a/testing/web-platform/tests/XMLHttpRequest/resources/auth2/corsenabled.py
+++ b/testing/web-platform/tests/XMLHttpRequest/resources/auth2/corsenabled.py
@@ -1,14 +1,17 @@
 import imp
 import os
 
+here = os.path.dirname(__file__)
+
+
 def main(request, response):
     response.headers.set('Access-Control-Allow-Origin', request.headers.get("origin"));
     response.headers.set('Access-Control-Allow-Credentials', 'true');
     response.headers.set('Access-Control-Allow-Methods', 'GET');
     response.headers.set('Access-Control-Allow-Headers', 'authorization, x-user, x-pass');
     response.headers.set('Access-Control-Expose-Headers', 'x-challenge, xhr-user, ses-user');
-    auth = imp.load_source("", os.path.abspath("XMLHttpRequest/resources/authentication.py"))
+    auth = imp.load_source("", os.path.abspath(os.path.join(here, os.pardir, "authentication.py")))
     if request.method == "OPTIONS":
         return ""
     else:
         return auth.main(request, response)
--- a/testing/web-platform/tests/XMLHttpRequest/resources/auth7/corsenabled.py
+++ b/testing/web-platform/tests/XMLHttpRequest/resources/auth7/corsenabled.py
@@ -1,20 +1,21 @@
 import imp
 import os
 
+here = os.path.dirname(__file__)
+
 def main(request, response):
     response.headers.set('Access-Control-Allow-Origin', request.headers.get("origin"));
     response.headers.set('Access-Control-Allow-Credentials', 'true');
     response.headers.set('Access-Control-Allow-Methods', 'GET');
     response.headers.set('Access-Control-Allow-Headers', 'authorization, x-user, x-pass');
     response.headers.set('Access-Control-Expose-Headers', 'x-challenge, xhr-user, ses-user');
-    auth = imp.load_source("", os.path.join(os.path.abspath(os.curdir),
-                                            "XMLHttpRequest",
-                                            "resources",
+    auth = imp.load_source("", os.path.join(__file__,
+                                            os.pardir,
                                             "authentication.py"))
     if request.method == "OPTIONS":
         return ""
     else:
         return auth.main(request, response)
 
 
 
--- a/testing/web-platform/tests/XMLHttpRequest/resources/auth8/corsenabled-no-authorize.py
+++ b/testing/web-platform/tests/XMLHttpRequest/resources/auth8/corsenabled-no-authorize.py
@@ -1,20 +1,22 @@
 import imp
 import os
 
+here = os.path.dirname(__file__)
+
+
 def main(request, response):
     response.headers.set('Access-Control-Allow-Origin', request.headers.get("origin"));
     response.headers.set('Access-Control-Allow-Credentials', 'true');
     response.headers.set('Access-Control-Allow-Methods', 'GET');
     response.headers.set('Access-Control-Allow-Headers', 'x-user, x-pass');
     response.headers.set('Access-Control-Expose-Headers', 'x-challenge, xhr-user, ses-user');
-    auth = imp.load_source("", os.path.join(os.path.abspath(os.curdir),
-                                            "XMLHttpRequest",
-                                            "resources",
+    auth = imp.load_source("", os.path.join(here,
+                                            os.pardir,
                                             "authentication.py"))
     if request.method == "OPTIONS":
         return ""
     else:
         return auth.main(request, response)