testing/web-platform/mozilla/tests/service-workers/service-worker/register-wait-forever-in-install-worker.https.html
author James Graham <james@hoppipolla.co.uk>
Thu, 25 Jun 2015 16:10:50 -0700
changeset 250330 a03152790896f9304cf6b79e48de91cc0388cc64
permissions -rw-r--r--
Bug 1120505 - Add Blink service-worker tests to local wpt tests, rs=Ms2ger

<!DOCTYPE html>
<title>Service Worker: Register wait-forever-in-install-worker</title>
<script src="/resources/testharness.js"></script>
<script src="resources/testharness-helpers.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helpers.sub.js"></script>
<script>

promise_test(function(t) {
    var bad_script = 'resources/wait-forever-in-install-worker.js';
    var good_script = 'resources/empty-worker.js';
    var scope = 'resources/wait-forever-in-install-worker';
    return navigator.serviceWorker.register(bad_script, {scope: scope})
      .then(function(registration) {
          assert_equals(registration.installing.scriptURL,
                        normalizeURL(bad_script));
          return navigator.serviceWorker.register(good_script, {scope: scope});
        })
      .then(function(registration) {
          assert_equals(registration.installing.scriptURL,
                        normalizeURL(good_script));
          return wait_for_state(t, registration.installing, 'activated');
        })
      .then(function() {
          return service_worker_unregister_and_done(t, scope);
        })
  }, 'register worker that calls waitUntil with a promise that never ' +
     'resolves in oninstall');

</script>