OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Service Worker: Interfaces</title> | 2 <title>Service Worker: Interfaces</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/interfaces.js"></script> | 5 <script src="resources/interfaces.js"></script> |
6 <script src="resources/test-helpers.js"></script> | 6 <script src="resources/test-helpers.js"></script> |
7 <script> | 7 <script> |
8 | 8 |
9 test(function() { | 9 test(function() { |
10 verifyInterface( | 10 verifyInterface( |
11 'ServiceWorkerContainer', navigator.serviceWorker, | 11 'ServiceWorkerContainer', navigator.serviceWorker, |
12 { | 12 { |
13 register: 'function', | 13 register: 'function', |
14 unregister: 'function' | 14 unregister: 'function' |
15 }); | 15 }); |
16 | 16 }, 'Interfaces and attributes of ServiceWorkerContainer'); |
17 }, 'Interfaces and attributes of ServiceWorkerContainer'); | |
18 | 17 |
19 async_test(function(t) { | 18 async_test(function(t) { |
20 service_worker_unregister_and_register(t, 'resources/empty-worker.js') | 19 var EVENT_HANDLER = 'object'; |
21 .then(t.step_func(function(worker) { | 20 service_worker_unregister_and_register(t, 'resources/empty-worker.js') |
22 var EVENT_HANDLER = 'object'; | 21 .then(function(registration) { |
23 verifyInterface( | 22 verifyInterface( |
24 'ServiceWorker', worker, | 23 'ServiceWorkerRegistration', registration, |
25 { | 24 { |
26 scriptURL: 'string', | 25 scope: 'string', |
27 state: 'string', | 26 unregister: 'function', |
28 | 27 onupdatefound: EVENT_HANDLER |
29 onstatechange: EVENT_HANDLER | 28 }); |
30 }); | 29 return wait_for_update(t, registration); |
31 t.done(); | 30 }) |
32 })); | 31 .then(function(worker) { |
33 }, 'Interfaces and attributes of ServiceWorker'); | 32 verifyInterface( |
| 33 'ServiceWorker', worker, |
| 34 { |
| 35 scriptURL: 'string', |
| 36 state: 'string', |
| 37 onstatechange: EVENT_HANDLER |
| 38 }); |
| 39 t.done(); |
| 40 }) |
| 41 .catch(unreached_rejection(t)); |
| 42 }, 'Interfaces and attributes of ServiceWorker'); |
34 | 43 |
35 service_worker_test( | 44 service_worker_test( |
36 'resources/interfaces-worker.js', | 45 'resources/interfaces-worker.js', |
37 'Interfaces and attributes in ServiceWorkerGlobalScope'); | 46 'Interfaces and attributes in ServiceWorkerGlobalScope'); |
38 | 47 |
39 </script> | 48 </script> |
OLD | NEW |