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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/background_fetch/resources/background-fetch-fail-event-worker.js

Issue 2744873002: Implement the Request/Response bits of Background Fetch (Closed)
Patch Set: Created 3 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: third_party/WebKit/LayoutTests/http/tests/background_fetch/resources/background-fetch-fail-event-worker.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/background_fetch/resources/background-fetch-fail-event-worker.js b/third_party/WebKit/LayoutTests/http/tests/background_fetch/resources/background-fetch-fail-event-worker.js
new file mode 100644
index 0000000000000000000000000000000000000000..66cb6a4eab5b41fc4fba268b167ed9bf08be395c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/background_fetch/resources/background-fetch-fail-event-worker.js
@@ -0,0 +1,34 @@
+'use strict';
+
+importScripts('/resources/testharness.js');
+
+test(function() {
+ assert_own_property(self, 'BackgroundFetchFailEvent');
+
+ // The `tag` and `failedFetches` are required in the BackgroundFetchFailEventInit.
harkness 2017/03/13 12:43:07 nit: Maybe put that failedFetches needs a particul
Peter Beverloo 2017/03/13 13:23:17 Done.
+ assert_throws(null, () => new BackgroundFetchFailEvent('BackgroundFetchFailEvent'));
+ assert_throws(null, () => new BackgroundFetchFailEvent('BackgroundFetchFailEvent', {}));
+ assert_throws(null, () => new BackgroundFetchFailEvent('BackgroundFetchFailEvent', { tag: 'foo' }));
+ assert_throws(null, () => new BackgroundFetchFailEvent('BackgroundFetchFailEvent', { tag: 'foo', failedFetches: 'bar' }));
+
+ const failedFetches = [
+ new BackgroundFetchSettledRequest(new Request('non-existing-image.png'), new Response()),
+ new BackgroundFetchSettledRequest(new Request('non-existing-image-2.png'), new Response())
+ ];
+
+ const event = new BackgroundFetchFailEvent('BackgroundFetchFailEvent', {
+ tag: 'my-tag',
+ failedFetches
+ });
+
+ assert_equals(event.type, 'BackgroundFetchFailEvent');
+ assert_equals(event.cancelable, false);
+ assert_equals(event.bubbles, false);
+ assert_equals(event.tag, 'my-tag');
+
+ assert_true(Array.isArray(event.failedFetches));
+ assert_array_equals(event.failedFetches, failedFetches);
+
+ assert_inherits(event, 'waitUntil');
+
+}, 'Verifies that the BackgroundFetchFailEvent can be constructed.');

Powered by Google App Engine
This is Rietveld 408576698