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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/background_fetch/resources/background-fetched-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 unified diff | Download patch
OLDNEW
(Empty)
1 'use strict';
2
3 importScripts('/resources/testharness.js');
4
5 test(function() {
6 assert_own_property(self, 'BackgroundFetchedEvent');
7
8 // The `tag` and `completedFetches` are required in the BackgroundFetchedEvent Init.
harkness 2017/03/13 12:43:07 nit: same comment re: completedFetches.
Peter Beverloo 2017/03/13 13:23:17 Done.
9 assert_throws(null, () => new BackgroundFetchedEvent('BackgroundFetchedEvent') );
10 assert_throws(null, () => new BackgroundFetchedEvent('BackgroundFetchedEvent', {}));
11 assert_throws(null, () => new BackgroundFetchedEvent('BackgroundFetchedEvent', { tag: 'foo' }));
12 assert_throws(null, () => new BackgroundFetchedEvent('BackgroundFetchedEvent', { tag: 'foo', completedFetches: 'bar' }));
13
14 const completedFetches = [
15 new BackgroundFetchSettledRequest(new Request('non-existing-image.png'), new Response()),
16 new BackgroundFetchSettledRequest(new Request('non-existing-image-2.png'), n ew Response())
17 ];
18
19 const event = new BackgroundFetchedEvent('BackgroundFetchedEvent', {
20 tag: 'my-tag',
21 completedFetches
22 });
23
24 assert_equals(event.type, 'BackgroundFetchedEvent');
25 assert_equals(event.cancelable, false);
26 assert_equals(event.bubbles, false);
27 assert_equals(event.tag, 'my-tag');
28
29 assert_true(Array.isArray(event.completedFetches));
30 assert_array_equals(event.completedFetches, completedFetches);
31
32 assert_inherits(event, 'waitUntil');
33
34 }, 'Verifies that the BackgroundFetchedEvent can be constructed.');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698