OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <title>ServiceWorker: navigator.serviceWorker.waiting</title> | |
3 <script src="../resources/testharness.js"></script> | |
4 <script src="../resources/testharnessreport.js"></script> | |
5 <script src="resources/test-helpers.js"></script> | |
6 <body> | |
7 <script> | |
8 var t = async_test('waiting is set'); | |
9 t.step(function() { | |
10 var url = 'resources/worker-no-op.js'; | |
11 var scope = 'resources/blank.html'; | |
12 var frame; | |
13 | |
14 navigator.serviceWorker.unregister(scope) | |
15 .then(function() { return with_iframe(scope); }, | |
jsbell
2014/06/10 17:59:32
Style nit: In other tests, we don't seem to start
jsbell
2014/06/10 17:59:33
Needs t.step_func() wrapper (testharness.js is upd
dominicc (has gone to gerrit)
2014/06/10 21:27:18
Yeah, I wrote it the style guide way, and then dec
jsbell
2014/06/10 22:36:23
Sounds good. It's not my personal preference for n
| |
16 unreached_rejection(t, 'Unregister should not fail')) | |
17 .then(function(f) { | |
jsbell
2014/06/10 17:59:32
Needs t.step_func() wrapper
dominicc (has gone to gerrit)
2014/06/10 21:27:18
The only thing that does for me is fail the test i
jsbell
2014/06/10 22:36:23
Correct. However, from my experience trying to deb
| |
18 frame = f; | |
19 return navigator.serviceWorker.register(url, {scope: scope}); | |
20 }) | |
21 .then(function(serviceWorker) { | |
jsbell
2014/06/10 17:59:32
Needs t.step_func() wrapper
| |
22 // FIXME: Replace this with .ready when that supports the in-waiting | |
23 // Service Worker. | |
24 return new Promise(function(resolve, reject) { | |
jsbell
2014/06/10 17:59:32
Needs t.step_func() wrapper
| |
25 serviceWorker.onstatechange = function() { | |
jsbell
2014/06/10 17:59:32
Needs t.step_func() wrapper
| |
26 if (serviceWorker.state == 'installed') { | |
27 resolve(); | |
28 } | |
29 }; | |
30 }); | |
31 }, unreached_rejection(t, 'Registration should not fail')) | |
32 .then(t.step_func(function() { | |
33 var container = frame.contentWindow.navigator.serviceWorker; | |
34 assert_equals(container.controller, null); | |
35 assert_equals(container.waiting.url, normalizeURL(url)); | |
36 | |
37 // FIXME: Add a test for a frame created after installation. | |
38 // Should the existing frame ("frame") block activation? | |
39 })) | |
40 .then(function() { | |
jsbell
2014/06/10 17:59:32
Needs t.step_func() wrapper
| |
41 frame.remove(); | |
42 return service_worker_unregister_and_done(t, scope); | |
43 }); | |
44 }); | |
45 </script> | |
OLD | NEW |