| OLD | NEW |
| 1 'use strict'; | 1 'use strict'; |
| 2 | 2 |
| 3 importScripts('/resources/testharness.js'); | 3 importScripts('/resources/testharness.js'); |
| 4 | 4 |
| 5 test(function() { | 5 test(function() { |
| 6 assert_own_property(self, 'BackgroundFetchedEvent'); | 6 assert_own_property(self, 'BackgroundFetchedEvent'); |
| 7 | 7 |
| 8 // The `tag` and `completedFetches` are required options in the | 8 // The `tag` and `fetches` are required options in the |
| 9 // BackgroundFetchedEventInit. The latter must be a sequence of | 9 // BackgroundFetchedEventInit. The latter must be a sequence of |
| 10 // BackgroundFetchSettledRequest instances. | 10 // BackgroundFetchSettledFetch instances. |
| 11 assert_throws(null, () => new BackgroundFetchedEvent('BackgroundFetchedEvent')
); | 11 assert_throws(null, () => new BackgroundFetchedEvent('BackgroundFetchedEvent')
); |
| 12 assert_throws(null, () => new BackgroundFetchedEvent('BackgroundFetchedEvent',
{})); | 12 assert_throws(null, () => new BackgroundFetchedEvent('BackgroundFetchedEvent',
{})); |
| 13 assert_throws(null, () => new BackgroundFetchedEvent('BackgroundFetchedEvent',
{ tag: 'foo' })); | 13 assert_throws(null, () => new BackgroundFetchedEvent('BackgroundFetchedEvent',
{ tag: 'foo' })); |
| 14 assert_throws(null, () => new BackgroundFetchedEvent('BackgroundFetchedEvent',
{ tag: 'foo', completedFetches: 'bar' })); | 14 assert_throws(null, () => new BackgroundFetchedEvent('BackgroundFetchedEvent',
{ tag: 'foo', fetches: 'bar' })); |
| 15 | 15 |
| 16 const completedFetches = [ | 16 const fetches = [ |
| 17 new BackgroundFetchSettledRequest(new Request('non-existing-image.png'), new
Response()), | 17 new BackgroundFetchSettledFetch(new Request('non-existing-image.png'), new R
esponse()), |
| 18 new BackgroundFetchSettledRequest(new Request('non-existing-image-2.png'), n
ew Response()) | 18 new BackgroundFetchSettledFetch(new Request('non-existing-image-2.png'), new
Response()) |
| 19 ]; | 19 ]; |
| 20 | 20 |
| 21 const event = new BackgroundFetchedEvent('BackgroundFetchedEvent', { | 21 const event = new BackgroundFetchedEvent('BackgroundFetchedEvent', { |
| 22 tag: 'my-tag', | 22 tag: 'my-tag', |
| 23 completedFetches | 23 fetches |
| 24 }); | 24 }); |
| 25 | 25 |
| 26 assert_equals(event.type, 'BackgroundFetchedEvent'); | 26 assert_equals(event.type, 'BackgroundFetchedEvent'); |
| 27 assert_equals(event.cancelable, false); | 27 assert_equals(event.cancelable, false); |
| 28 assert_equals(event.bubbles, false); | 28 assert_equals(event.bubbles, false); |
| 29 assert_equals(event.tag, 'my-tag'); | 29 assert_equals(event.tag, 'my-tag'); |
| 30 | 30 |
| 31 assert_true(Array.isArray(event.completedFetches)); | 31 assert_true(Array.isArray(event.fetches)); |
| 32 assert_array_equals(event.completedFetches, completedFetches); | 32 assert_array_equals(event.fetches, fetches); |
| 33 | 33 |
| 34 assert_inherits(event, 'updateUI'); |
| 34 assert_inherits(event, 'waitUntil'); | 35 assert_inherits(event, 'waitUntil'); |
| 35 | 36 |
| 36 }, 'Verifies that the BackgroundFetchedEvent can be constructed.'); | 37 }, 'Verifies that the BackgroundFetchedEvent can be constructed.'); |
| OLD | NEW |