OLD | NEW |
1 importScripts('../../resources/test-helpers.js'); | 1 importScripts('../../resources/test-helpers.sub.js'); |
2 importScripts('../../resources/worker-testharness.js'); | 2 importScripts('../../resources/worker-testharness.js'); |
3 | 3 |
4 // TODO(nhiroki): stop using global states because service workers can be killed | |
5 // at any point. Instead, we could post a message to the page on each event via | |
6 // Client object (http://crbug.com/558244). | |
7 var events_seen = []; | 4 var events_seen = []; |
8 | 5 |
9 // TODO(nhiroki): Move these assertions to registration-attribute.html because | |
10 // an assertion failure on the worker is not shown on the result page and | |
11 // handled as timeout. See registration-attribute-newer-worker.js for example. | |
12 | |
13 assert_equals( | 6 assert_equals( |
14 self.registration.scope, | 7 self.registration.scope, |
15 normalizeURL('scope/registration-attribute'), | 8 normalizeURL('scope/registration-attribute'), |
16 'On worker script evaluation, registration attribute should be set'); | 9 'On worker script evaluation, registration attribute should be set'); |
17 assert_equals( | 10 assert_equals( |
18 self.registration.installing, | 11 self.registration.installing, |
19 null, | 12 null, |
20 'On worker script evaluation, installing worker should be null'); | 13 'On worker script evaluation, installing worker should be null'); |
21 assert_equals( | 14 assert_equals( |
22 self.registration.waiting, | 15 self.registration.waiting, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 normalizeURL('registration-attribute-worker.js'), | 123 normalizeURL('registration-attribute-worker.js'), |
131 'On fetch event, active worker should be set'); | 124 'On fetch event, active worker should be set'); |
132 | 125 |
133 assert_equals( | 126 assert_equals( |
134 self.registration.active.state, | 127 self.registration.active.state, |
135 'activated', | 128 'activated', |
136 'On fetch event, worker should be in the activated state'); | 129 'On fetch event, worker should be in the activated state'); |
137 | 130 |
138 e.respondWith(new Response(events_seen)); | 131 e.respondWith(new Response(events_seen)); |
139 }); | 132 }); |
OLD | NEW |