OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>ServiceWorkerGlobalScope: registration</title> | 2 <title>ServiceWorkerGlobalScope: registration</title> |
3 <script src='../../resources/testharness.js'></script> | 3 <script src='../../resources/testharness.js'></script> |
4 <script src='../../resources/testharnessreport.js'></script> | 4 <script src='../../resources/testharnessreport.js'></script> |
5 <script src='../resources/test-helpers.js'></script> | 5 <script src='../resources/test-helpers.js'></script> |
6 <script> | 6 <script> |
7 | 7 |
8 promise_test(function(t) { | 8 promise_test(function(t) { |
9 var script = 'resources/registration-attribute-worker.js'; | 9 var script = 'resources/registration-attribute-worker.js'; |
10 var scope = 'resources/scope/registration-attribute'; | 10 var scope = 'resources/scope/registration-attribute'; |
11 | 11 |
12 return service_worker_unregister_and_register(t, script, scope) | 12 return service_worker_unregister_and_register(t, script, scope) |
13 .then(function(registration) { | 13 .then(function(registration) { |
14 return wait_for_state(t, registration.installing, 'activated'); | 14 return wait_for_state(t, registration.installing, 'activated'); |
15 }) | 15 }) |
16 .then(function() { return with_iframe(scope); }) | 16 .then(function() { return with_iframe(scope); }) |
17 .then(function(frame) { | 17 .then(function(frame) { |
18 var eventsSeen = []; | |
falken
2015/01/28 13:47:24
nit: events_seen, even better expected_events_seen
nhiroki
2015/01/28 14:25:05
Done.
| |
19 eventsSeen.push('updatefound'); | |
20 eventsSeen.push('install'); | |
21 eventsSeen.push('statechange(installed)'); | |
22 eventsSeen.push('statechange(activating)'); | |
23 eventsSeen.push('activate'); | |
24 eventsSeen.push('statechange(activated)'); | |
25 eventsSeen.push('fetch'); | |
26 | |
18 assert_equals( | 27 assert_equals( |
19 frame.contentDocument.body.textContent, | 28 frame.contentDocument.body.textContent, |
20 'PASS', | 29 eventsSeen.toString(), |
21 'Service Worker should respond to fetch'); | 30 'Service Worker should respond to fetch'); |
22 frame.remove(); | 31 frame.remove(); |
23 return service_worker_unregister_and_done(t, scope); | 32 return service_worker_unregister_and_done(t, scope); |
24 }); | 33 }); |
25 }, 'Verify registration attribute on ServiceWorkerGlobalScope'); | 34 }, 'Verify registration attribute on ServiceWorkerGlobalScope'); |
26 | 35 |
27 </script> | 36 </script> |
OLD | NEW |