OLD | NEW |
---|---|
(Empty) | |
1 'use strict'; | |
2 | |
3 importScripts('/resources/testharness.js'); | |
4 | |
5 test(function() { | |
6 assert_own_property(self, 'BackgroundFetchFailEvent'); | |
7 | |
8 // The `tag` and `failedFetches` are required in the BackgroundFetchFailEventI nit. | |
harkness
2017/03/13 12:43:07
nit: Maybe put that failedFetches needs a particul
Peter Beverloo
2017/03/13 13:23:17
Done.
| |
9 assert_throws(null, () => new BackgroundFetchFailEvent('BackgroundFetchFailEve nt')); | |
10 assert_throws(null, () => new BackgroundFetchFailEvent('BackgroundFetchFailEve nt', {})); | |
11 assert_throws(null, () => new BackgroundFetchFailEvent('BackgroundFetchFailEve nt', { tag: 'foo' })); | |
12 assert_throws(null, () => new BackgroundFetchFailEvent('BackgroundFetchFailEve nt', { tag: 'foo', failedFetches: 'bar' })); | |
13 | |
14 const failedFetches = [ | |
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 BackgroundFetchFailEvent('BackgroundFetchFailEvent', { | |
20 tag: 'my-tag', | |
21 failedFetches | |
22 }); | |
23 | |
24 assert_equals(event.type, 'BackgroundFetchFailEvent'); | |
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.failedFetches)); | |
30 assert_array_equals(event.failedFetches, failedFetches); | |
31 | |
32 assert_inherits(event, 'waitUntil'); | |
33 | |
34 }, 'Verifies that the BackgroundFetchFailEvent can be constructed.'); | |
OLD | NEW |