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

Unified Diff: content/test/data/service_worker/fetch_event.js

Issue 178343011: Support dispatching ServiceWorker FetchEvent and receiving response (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use const for result on failure Created 6 years, 9 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: content/test/data/service_worker/fetch_event.js
diff --git a/content/test/data/service_worker/fetch_event.js b/content/test/data/service_worker/fetch_event.js
new file mode 100644
index 0000000000000000000000000000000000000000..67408ddd80520ada8c0c0b990ea2a9d681354834
--- /dev/null
+++ b/content/test/data/service_worker/fetch_event.js
@@ -0,0 +1,19 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+this.onfetch = function(event) {
+ response = new Response({
+ statusCode: 200,
+ statusText: 'OK',
+ method: 'GET',
+ headers: {
+ 'Content-Language': 'fi',
+ 'Content-Type': 'text/html; charset=UTF-8'
+ }
+ });
+
+ event.respondWith(new Promise(function(r) {
+ setTimeout(function() { r(response); }, 5);
+ }));
+};

Powered by Google App Engine
This is Rietveld 408576698