OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <title>register() is rejected when permission has been denied</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 var workerUrl = 'resources/empty_worker.js'; | |
14 var workerScope = 'resources/scope/' + location.pathname; | |
15 var swRegistration; | |
16 service_worker_unregister_and_register(test, workerUrl, workerScope) | |
17 .then(function(serviceWorkerRegistration) { | |
18 swRegistration = serviceWorkerRegistration; | |
19 return wait_for_state(test, swRegistration.installing, 'activated'); | |
20 }) | |
21 .then(function() { | |
22 // If running manually, deny permission when prompted. | |
23 if (self.testRunner) | |
24 testRunner.setPushMessagingPermission(location.origin, false); | |
25 return swRegistration.pushManager.register(); | |
26 }) | |
27 .then(function(pushRegistration) { | |
28 assert_unreached('Registration must not succeed after permission is
denied.'); | |
29 }, function(e) { | |
30 assert_equals(e.name, 'AbortError'); | |
31 assert_equals(e.message, 'Registration failed - permission denied'); | |
32 return service_worker_unregister_and_done(test, workerScope); | |
33 }) | |
34 .catch(unreached_rejection(test)); | |
35 }, 'register() is rejected when permission has been denied'); | |
36 </script> | |
37 </body> | |
38 </html> | |
OLD | NEW |