2 <title>ServiceWorker: navigator.serviceWorker.active</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script>
9 async_test(function(t) {
10 var step = t.step_func.bind(t);
11 var url = 'resources/empty-worker.js';
12 var scope = 'resources/blank.html';
16 service_worker_unregister(t, scope)
17 .then(step(function() { return with_iframe(scope); }))
18 .then(step(function(f) {
20 return navigator.serviceWorker.register(url, {scope: scope});
22 .then(step(function(r) {
24 return wait_for_update(t, registration);
26 .then(step(function(serviceWorker) {
27 return wait_for_state(t, serviceWorker, 'activating');
29 .then(step(function() {
30 var container = frame.contentWindow.navigator.serviceWorker;
34 'On activating state a document should not have a controller');
36 registration.active.scriptURL,
38 'On activating state a document should have an active worker ');
42 'On activating state a document should not have a waiting worker');
44 registration.installing,
46 'On activating state a document should not have an installing ' +
49 // FIXME: Add a test for a frame created after installation.
50 // Should the existing frame ("frame") block activation?
52 .then(step(function() {
54 return service_worker_unregister_and_done(t, scope);
56 .catch(unreached_rejection(t));