| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>Push API: permissionState resolves with prompt when no permission is set</title> |
| <link rel="manifest" href="resources/push_manifest.json"> |
| <script src="../resources/permissions-helper.js"></script> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="../serviceworker/resources/test-helpers.js"></script> |
| </head> |
| <body> |
| <script> |
| promise_test(test => { |
| const workerUrl = 'resources/empty_worker.js'; |
| const workerScope = 'resources/scope/' + location.pathname; |
| |
| // If running manually, clear permissions before running this test. |
| return PermissionsHelper.setPermission('push-messaging', 'prompt') |
| .then(() => service_worker_unregister_and_register(test, workerUrl, workerScope)) |
| .then(serviceWorkerRegistration => { |
| return serviceWorkerRegistration.pushManager.permissionState({ userVisibleOnly: true }); |
| }) |
| .then(permissionStatus => { |
| assert_equals(permissionStatus, 'prompt'); |
| return service_worker_unregister_and_done(test, workerScope); |
| }); |
| }, 'Push API: permissionState() resolves with prompt when permission is not set'); |
| </script> |
| </body> |
| </html> |