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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/support/report.py

Issue 2695813009: Import wpt@503f5b5f78ec4e87d144f78609f363f0ed0ea8db (Closed)
Patch Set: Skip some tests Created 3 years, 10 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/content-security-policy/support/report.py
diff --git a/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/support/report.py b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/support/report.py
new file mode 100644
index 0000000000000000000000000000000000000000..193315fa07bdccfa2efa2371cc4ecbd4ead81079
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/support/report.py
@@ -0,0 +1,34 @@
+import time
+import json
+import re
+
+def main(request, response):
+ op = request.GET.first("op");
+ key = request.GET.first("reportID")
+
+ if op == "take":
+ timeout = float(request.GET.first("timeout"))
+ t0 = time.time()
+ while time.time() - t0 < timeout:
+ time.sleep(0.5)
+ value = request.server.stash.take(key=key)
+ if value is not None:
+ return [("Content-Type", "application/json")], value
+
+ return [("Content-Type", "application/json")], json.dumps({'error': 'No such report.' , 'guid' : key})
+
+ if op == "cookies":
+ cval = request.server.stash.take(key=re.sub('^...', 'ccc', key))
+ if cval is None:
+ cval = "\"None\""
+
+ return [("Content-Type", "application/json")], "{ \"reportCookies\" : " + cval + "}"
+
+ if hasattr(request, 'Cookies'):
+ request.server.stash.put(key=re.sub('^...', 'ccc', key), value=request.Cookies)
+
+ report = request.body
+ report.rstrip()
+ request.server.stash.take(key=key)
+ request.server.stash.put(key=key, value=report)
+ return [("Content-Type", "text/plain")], "Recorded report " + report

Powered by Google App Engine
This is Rietveld 408576698