summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/service-workers/service-worker/activation-after-registration.https.html
blob: 29f97e3e3f4c0cda2321776cbf48fed92d1c90a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!DOCTYPE html>
<title>Service Worker: Activation occurs after registration</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helpers.sub.js"></script>
<body>
<script>
promise_test(function(t) {
    var scope = 'resources/blank.html';
    var registration;

    return service_worker_unregister_and_register(
        t, 'resources/empty-worker.js', scope)
      .then(function(r) {
          t.add_cleanup(function() {
              return service_worker_unregister(t, scope);
            });

          registration = r;
          assert_equals(
              r.installing.state,
              'installing',
              'worker should be in the "installing" state upon registration');
          return wait_for_state(t, r.installing, 'activated');
        });
}, 'activation occurs after registration');
</script>
</body>