OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Push API: permissionState resolves with granted when permission is grante
d</title> | 4 <title>Push API: permissionState resolves with granted when permission is grante
d</title> |
5 <link rel="manifest" href="resources/push_manifest.json"> | 5 <link rel="manifest" href="resources/push_manifest.json"> |
6 <script src="../resources/testharness.js"></script> | 6 <script src="../resources/testharness.js"></script> |
7 <script src="../resources/testharnessreport.js"></script> | 7 <script src="../resources/testharnessreport.js"></script> |
8 <script src="../serviceworker/resources/test-helpers.js"></script> | 8 <script src="../serviceworker/resources/test-helpers.js"></script> |
9 </head> | 9 </head> |
10 <body> | 10 <body> |
11 <script> | 11 <script> |
12 async_test(function(test) { | 12 async_test(function(test) { |
13 var workerUrl = 'resources/empty_worker.js'; | 13 var workerUrl = 'resources/empty_worker.js'; |
14 var workerScope = 'resources/scope/' + location.pathname; | 14 var workerScope = 'resources/scope/' + location.pathname; |
15 service_worker_unregister_and_register(test, workerUrl, workerScope) | 15 service_worker_unregister_and_register(test, workerUrl, workerScope) |
16 .then(function(serviceWorkerRegistration) { | 16 .then(function(serviceWorkerRegistration) { |
17 // If running manually, grant permission when prompted. | 17 // If running manually, grant permission when prompted. |
18 if (window.testRunner) | 18 if (window.testRunner) |
19 testRunner.setPermission('push-messaging', 'granted', location.o
rigin, location.origin); | 19 testRunner.setPermission('push-messaging', 'granted', location.o
rigin, location.origin); |
20 return serviceWorkerRegistration.pushManager.permissionState(); | 20 return serviceWorkerRegistration.pushManager.permissionState({userVi
sibleOnly: true}); |
21 }) | 21 }) |
22 .then(function(permissionStatus) { | 22 .then(function(permissionStatus) { |
23 assert_equals(permissionStatus, 'granted'); | 23 assert_equals(permissionStatus, 'granted'); |
24 return service_worker_unregister_and_done(test, workerScope); | 24 return service_worker_unregister_and_done(test, workerScope); |
25 }) | 25 }) |
26 .catch(unreached_rejection(test)); | 26 .catch(unreached_rejection(test)); |
27 }, 'Push API: permissionState resolves with granted when permission is granted')
; | 27 }, 'Push API: permissionState resolves with granted when permission is granted')
; |
28 </script> | 28 </script> |
29 </body> | 29 </body> |
30 </html> | 30 </html> |
OLD | NEW |