blob: ed00aa5fee7b80e0bde392581f862d31af87d257 [file]
<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, 'prompt');
await testDocumentPermissionState(registration, 'prompt');
await testServiceWorkerSubscribe(registration, 'NotAllowedError');
await testDocumentSubscribeWithoutUserGesture(registration, 'NotAllowedError', 'Push notification prompting can only be done from a user gesture.');
await testDocumentSubscribeWithUserGesture(registration, 'NotAllowedError');
} catch (e) {
log(`FAIL: unexpected exception ${e}`);
} finally {
await registration.unregister();
finishPushAPITest();
}
});
</script>
</body>
</html>