Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / serviceworker / activation-after-registration.html
1 <!DOCTYPE html>
2 <title>Service Worker: Activation occurs after registration</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script>
6 <body>
7 <script>
8 var t = async_test('activation occurs after registration');
9 t.step(function() {
10     var scope = 'resources/blank.html';
11     var registration;
12
13     service_worker_unregister_and_register(
14         t, 'resources/empty-worker.js', scope)
15       .then(function(r) {
16           registration = r;
17           return wait_for_update(t, registration);
18         })
19       .then(function(worker) {
20           assert_equals(
21               worker.state,
22               'installing',
23               'worker should be in the "installing" state upon registration');
24           return wait_for_state(t, worker, 'activated');
25         })
26       .then(function() {
27           service_worker_unregister_and_done(t, scope);
28         })
29       .catch(unreached_rejection(t));
30 });
31 </script>
32 </body>