Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title>register() is rejected when the service worker is not active yet</title> | |
| 5 <link rel="manifest" href="resources/push_manifest.json"> | |
| 6 <script src="../resources/testharness.js"></script> | |
| 7 <script src="../resources/testharnessreport.js"></script> | |
| 8 <script src="../serviceworker/resources/test-helpers.js"></script> | |
| 9 </head> | |
| 10 <body> | |
| 11 <script> | |
| 12 async_test(function(test) { | |
| 13 assert_true(!!window.testRunner, 'This test requires the TestRunner.'); | |
| 14 var workerUrl = 'resources/empty_worker.js'; | |
| 15 var workerScope = 'resources/scope/' + location.pathname; | |
| 16 var swRegistration; | |
| 17 service_worker_unregister_and_register(test, workerUrl, workerScope) | |
| 18 .then(function(serviceWorkerRegistration) { | |
| 19 swRegistration = serviceWorkerRegistration; | |
| 20 assert_true(!!swRegistration.installing, 'The worker should be insta lling'); | |
|
Peter Beverloo
2014/12/10 00:18:18
assert_not_equals(swRegistration.installing, null)
Michael van Ouwerkerk
2014/12/10 15:13:06
Done.
| |
| 21 assert_equals(swRegistration.active, null, 'The worker should not be active yet'); | |
| 22 testRunner.setPushMessagingPermission(location.origin, true); | |
| 23 return swRegistration.pushManager.register(); | |
| 24 }) | |
| 25 .then(function(pushRegistration) { | |
| 26 assert_unreached('register() must not succeed without an active serv ice worker'); | |
| 27 }, function(e) { | |
| 28 assert_equals(e.name, 'AbortError'); | |
| 29 assert_equals(e.message, 'Registration failed - no Service Worker'); | |
| 30 return service_worker_unregister_and_done(test, workerScope); | |
| 31 }) | |
| 32 .catch(unreached_rejection(test)); | |
| 33 }, 'register() is rejected when the service worker is not active yet'); | |
| 34 </script> | |
| 35 </body> | |
| 36 </html> | |
| OLD | NEW |