| <html> |
| <head> |
| <script src="resources/push-api-test-pre.js"></script> |
| <script src="resources/subscribe-tests.js"></script> |
| </head> |
| <body> |
| <script> |
| if (window.testRunner) |
| testRunner.denyWebNotificationPermission(window.origin); |
| |
| navigator.serviceWorker.register("resources/subscribe-worker.js", { }).then(async (registration) => { |
| try { |
| await waitForState(registration.installing, "activated"); |
| await testServiceWorkerPermissionState(registration, 'denied'); |
| await testDocumentPermissionState(registration, 'denied'); |
| await testServiceWorkerSubscribe(registration, 'NotAllowedError'); |
| await testDocumentSubscribeWithoutUserGesture(registration, 'NotAllowedError', 'User denied push permission'); |
| await testDocumentSubscribeWithUserGesture(registration, 'NotAllowedError'); |
| } catch (e) { |
| log(`FAIL: unexpected exception ${e}`); |
| } finally { |
| await registration.unregister(); |
| finishPushAPITest(); |
| } |
| }); |
| </script> |
| </body> |
| </html> |