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

Unified Diff: LayoutTests/http/tests/serviceworker/resources/fetch-event-async-respond-with-worker.js

Issue 723063002: Service Worker: Add a test for calling respondWith() asynchronously. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: actualyl upload Created 6 years, 1 month 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: LayoutTests/http/tests/serviceworker/resources/fetch-event-async-respond-with-worker.js
diff --git a/LayoutTests/http/tests/serviceworker/resources/fetch-event-async-respond-with-worker.js b/LayoutTests/http/tests/serviceworker/resources/fetch-event-async-respond-with-worker.js
new file mode 100644
index 0000000000000000000000000000000000000000..7f66d20dfc2dff0af01dfa07f823c660b7a1ec1b
--- /dev/null
+++ b/LayoutTests/http/tests/serviceworker/resources/fetch-event-async-respond-with-worker.js
@@ -0,0 +1,19 @@
+var result;
+
+self.addEventListener('message', function(event) {
+ event.data.port.postMessage(result);
+ });
+
+self.addEventListener('fetch', function(event) {
+ setTimeout(function() {
+ try {
+ event.respondWith(new Response());
+ result = 'FAIL: did not throw';
+ } catch (error) {
+ if (error.name == 'InvalidStateError')
+ result = 'PASS';
+ else
+ result = 'FAIL: Unexpected exception: ' + error;
+ }
+ }, 0);
+ });

Powered by Google App Engine
This is Rietveld 408576698