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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/clear-site-data/support/get-resource-to-cache.py

Issue 2913553004: Add the 'cache' datatype to the clear-site-data WPT (Closed)
Patch Set: Rebase, syntax, cache busting. Created 3 years, 5 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/clear-site-data/support/get-resource-to-cache.py
diff --git a/third_party/WebKit/LayoutTests/external/wpt/clear-site-data/support/get-resource-to-cache.py b/third_party/WebKit/LayoutTests/external/wpt/clear-site-data/support/get-resource-to-cache.py
new file mode 100644
index 0000000000000000000000000000000000000000..ff4254b75197cbd02c870ebc49e1c4bf874e0851
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/clear-site-data/support/get-resource-to-cache.py
@@ -0,0 +1,14 @@
+# A support server that returns a resource to be cached for one year.
+#
+# However, if the request contains the "Cache-Control: only-if-cached;" header,
+# the server returns status code 500, since such a request should never have
+# reached it.
+def main(request, response):
+ if ("Cache-Control" in request._headers and
+ request._headers["Cache-Control"] == "only-if-cached"):
+ response.status = 500 # Internal server error.
+ return
+
+ return ([("Content-Type", "text/plain"),
+ ("Cache-Control", "max-age=31536000")],
+ "Resource to be cached for 365 days.")

Powered by Google App Engine
This is Rietveld 408576698