blob: 316164795c7666e513622f6df2b1a13e4ab7ca47 [file] [log] [blame] [edit]
<!-- webkit-test-runner [ useEphemeralSession=true ] -->
<html>
<head>
<script src="resources/push-api-test-pre.js"></script>
<script src="resources/subscribe-tests.js"></script>
</head>
<body>
<script>
// Even if the UIProcess has granted permissions for notifications for a regular session,
// they should not apply to this ephemeral session.
if (window.testRunner)
testRunner.grantWebNotificationPermission(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');
await testDocumentSubscribeWithUserGesture(registration, 'NotAllowedError');
await testDocumentGetSubscription(registration, false);
await testServiceWorkerGetSubscription(registration, false);
} catch (e) {
log(`FAIL: unexpected exception ${e}`);
} finally {
await registration.unregister();
finishPushAPITest();
}
});
</script>
</body>
</html>