Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/cors/support/cors-tester.py

Issue 2657583002: Import wpt@cf62b859e6b890abc34f8140d185ba91df95c5b6 (Closed)
Patch Set: Modify TestExpectations or download new baselines for tests. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/cors/support/cors-tester.py
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/cors/support/cors-tester.py b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/cors/support/cors-tester.py
new file mode 100644
index 0000000000000000000000000000000000000000..1c27a0d14bde05c1fed0a731650cae8e929d96a2
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/cors/support/cors-tester.py
@@ -0,0 +1,51 @@
+from wptserve.handlers import HTTPException
+import urllib
+
+def main(request, response):
+ if request.method != "GET":
+ raise HTTPException(400, message="Method was not GET")
+
+ if not "id" in request.GET:
+ raise HTTPException(400, message="No id")
+
+ id = request.GET['id']
+
+ if "read" in request.GET:
+ data = request.server.stash.take(id)
+ if data is None:
+ response.set_error(404, "Tried to read data not yet set")
+ return
+ return [("Content-Type", "text/plain")], data
+
+ elif "cleanup" in request.GET:
+ request.server.stash.take(id)
+ return "OK"
+
+ elif "delete-cookie" in request.GET:
+ response.delete_cookie(id)
+ return [("Content-Type", "text/plain")], "OK"
+
+ if "origin" in request.GET:
+ response.headers.set('Access-Control-Allow-Origin', request.GET['origin'])
+ response.headers.set('Access-Control-Allow-Credentials', 'true')
+
+ cors = request.headers.get("origin", "no")
+
+ cookie = request.cookies.first(id, "no")
+
+ line = 'cors = ' + cors + ' | cookie = ' + cookie.value;
+
+ data = request.server.stash.take(id)
+ if data is not None:
+ line = data + "\n" + line
+
+ request.server.stash.put(id, line)
+
+ if "redirect" in request.GET:
+ response.status = 302
+ response.headers.set('Location', request.GET['redirect'])
+ else:
+ return """WEBVTT
+
+00:00:00.000 --> 00:00:10.000
+Test"""

Powered by Google App Engine
This is Rietveld 408576698