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

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/clear-site-data/support/echo-clear-site-data.py

Issue 2572333003: Import wpt@4970d7334aaf8977c5b617075aa48be1b6e482c7 (Closed)
Patch Set: Update TestExpectations Created 4 years 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/imported/wpt/clear-site-data/support/echo-clear-site-data.py
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/clear-site-data/support/echo-clear-site-data.py b/third_party/WebKit/LayoutTests/imported/wpt/clear-site-data/support/echo-clear-site-data.py
new file mode 100644
index 0000000000000000000000000000000000000000..e8ec8d55327c28339c7466fcf613ff784359f2e1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/clear-site-data/support/echo-clear-site-data.py
@@ -0,0 +1,40 @@
+import json
+
+RESPONSE = """
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Clear-Site-Data</title>
+ <script src="test_utils.js"></script>
+ </head>
+ <body>
+ <script>
+ /**
+ * A map between a datatype name and whether it is empty.
+ * @property Object.<string, boolean>
+ */
+ var report = {};
+
+ Promise.all(TestUtils.DATATYPES.map(function(datatype) {
+ return datatype.isEmpty().then(function(isEmpty) {
+ report[datatype.name] = isEmpty;
+ });
+ })).then(function() {
+ window.top.postMessage(report, "*");
+ });
+ </script>
+ </body>
+</html>
+"""
+
+# A support server that receives a list of datatypes in the GET query
+# and returns a Clear-Site-Data header with those datatypes. The content
+# of the response is a html site using postMessage to report the status
+# of the datatypes, so that if used in an iframe, it can inform the
+# embedder whether the data deletion succeeded.
+def main(request, response):
+ types = [key for key in request.GET.keys()]
+ header = json.dumps({ "types": types })
+ return ([("Clear-Site-Data", header),
+ ("Content-Type", "text/html")],
+ RESPONSE)

Powered by Google App Engine
This is Rietveld 408576698