Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / serviceworker / skip-waiting-without-using-registration.html
blobeb0419fe7bc619c6be7c74c2120763a74898c559
1 <!DOCTYPE html>
2 <title>Service Worker: Skip waiting without using registration</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharness-helpers.js"></script>
5 <script src="../resources/testharnessreport.js"></script>
6 <script src="resources/test-helpers.js"></script>
7 <script>
9 promise_test(function(t) {
10 var scope = 'resources/blank.html';
11 var url = 'resources/skip-waiting-worker.js';
12 var frame, frame_sw, sw_registration;
14 return service_worker_unregister(t, scope)
15 .then(function() {
16 return with_iframe(scope);
18 .then(function(f) {
19 frame = f;
20 frame_sw = f.contentWindow.navigator.serviceWorker;
21 assert_equals(frame_sw.controller, null,
22 'Document controller should be null');
23 return navigator.serviceWorker.register(url, {scope: scope});
25 .then(function(registration) {
26 sw_registration = registration;
27 add_completion_callback(function() {
28 registration.unregister();
29 });
30 return wait_for_state(t, registration.installing, 'activated');
32 .then(function() {
33 assert_equals(frame_sw.controller, null,
34 'Document controller should still be null');
35 assert_not_equals(sw_registration.active, null,
36 'Registration active worker should not be null');
37 fetch_tests_from_worker(sw_registration.active);
38 frame.remove();
39 });
40 }, 'Test skipWaiting while a client is not being controlled');
42 </script>