<html>
<head>
<script src="resources/sw-test-pre.js"></script>
</head>
<body>
<script>
navigator.serviceWorker.addEventListener("message", function(event) {
    if (event.data)
        log("PASS: service worker received activate event and resolved the extend lifetime promise");
    else
        log("FAIL: service worker did not receive activate event or did not resolve the extend lifetime promise");

    finishSWTest();
});

navigator.serviceWorker.register("resources/basic-activate-event-worker.js", { }).then(function(registration) {
     waitForState(registration.installing, "activated").then(function() {
         registration.active.postMessage("CheckResolvedExtendLifetimePromise");
     });
}, function() {
    log("FAIL: Failed to register the service worker");
    finishSWTest();
});
</script>
</body>
</html>
