blob: 71a380cf2264a1d079e799555e3f93fd8df1c9b1 [file] [log] [blame]
<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.grantWebNotificationPermission(window.origin);
navigator.serviceWorker.register("resources/subscribe-worker.js", { }).then(async (registration) => {
try {
await waitForState(registration.installing, "activated");
await testServiceWorkerPermissionState(registration, 'granted');
await testDocumentPermissionState(registration, 'granted');
await testServiceWorkerSubscribe(registration);
await testDocumentSubscribeWithoutUserGesture(registration);
await testDocumentSubscribeWithUserGesture(registration);
} catch (e) {
log(`FAIL: unexpected exception ${e}`);
} finally {
await registration.unregister();
finishPushAPITest();
}
});
</script>
</body>
</html>