Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 'use strict'; | |
| 2 | |
| 3 importScripts('/resources/testharness.js'); | |
| 4 | |
| 5 test(function() { | |
| 6 assert_own_property(self, 'BackgroundFetchClickEvent'); | |
| 7 | |
| 8 // The `tag` and `state` are required in the BackgroundFetchClickEventInit. | |
| 9 assert_throws(null, () => new BackgroundFetchClickEvent('BackgroundFetchClickE vent')); | |
| 10 assert_throws(null, () => new BackgroundFetchClickEvent('BackgroundFetchClickE vent', {})); | |
| 11 assert_throws(null, () => new BackgroundFetchClickEvent('BackgroundFetchClickE vent', { tag: 'foo' })); | |
| 12 assert_throws(null, () => new BackgroundFetchClickEvent('BackgroundFetchClickE vent', { tag: 'foo', state: 'foo' })); | |
| 13 | |
| 14 // The `state` must be one of { pending, succeeded, failed }. This should not throw. | |
| 15 for (let state of ['pending', 'succeeded', 'failed']) | |
| 16 new BackgroundFetchClickEvent('BackgroundFetchClickEvent', { tag: 'foo', sta te }); | |
|
harkness
2017/03/09 19:41:15
Are there tag formats that we won't allow?
Peter Beverloo
2017/03/10 00:42:50
No, it follows the semantics of a DOMString.
| |
| 17 | |
| 18 const event = new BackgroundFetchClickEvent('BackgroundFetchClickEvent', { | |
| 19 tag: 'my-tag', | |
| 20 state: 'succeeded' | |
| 21 }); | |
| 22 | |
| 23 assert_equals(event.type, 'BackgroundFetchClickEvent'); | |
|
harkness
2017/03/09 19:41:15
Why not check these in the for loop above for each
Peter Beverloo
2017/03/10 00:42:50
Logically line 15/16 are testing that the allowed
| |
| 24 assert_equals(event.cancelable, false); | |
| 25 assert_equals(event.bubbles, false); | |
| 26 assert_equals(event.tag, 'my-tag'); | |
| 27 assert_equals(event.state, 'succeeded'); | |
| 28 | |
| 29 assert_inherits(event, 'waitUntil'); | |
| 30 | |
| 31 }, 'Verifies that the BackgroundFetchClickEvent can be constructed.'); | |
| OLD | NEW |