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

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/mint-new-worker.py

Issue 2415873002: Import w3c tests for the service workers (Closed)
Patch Set: Rebase Created 4 years, 2 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/imported/wpt/service-workers/service-worker/resources/mint-new-worker.py
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/mint-new-worker.py b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/mint-new-worker.py
new file mode 100644
index 0000000000000000000000000000000000000000..cbe70304d89c3835663d6ab9782a44482134af7c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/mint-new-worker.py
@@ -0,0 +1,25 @@
+import time
+
+body = '''
+onactivate = (e) => e.waitUntil(clients.claim());
+var resolve_wait_until;
+var wait_until = new Promise(resolve => {
+ resolve_wait_until = resolve;
+ });
+onmessage = (e) => {
+ if (e.data == 'wait')
+ e.waitUntil(wait_until);
+ if (e.data == 'go')
+ resolve_wait_until();
+ };'''
+
+def main(request, response):
+ headers = [('Cache-Control', 'no-cache, must-revalidate'),
+ ('Pragma', 'no-cache'),
+ ('Content-Type', 'application/javascript')]
+
+ skipWaiting = ''
+ if 'skip-waiting' in request.GET:
+ skipWaiting = 'skipWaiting();'
+
+ return headers, '/* %s %s */ %s %s' % (time.time(), time.clock(), skipWaiting, body)

Powered by Google App Engine
This is Rietveld 408576698