Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / serviceworker / skip-waiting-using-registration.html
blobdbc550bd705c7397bd865cd5fe68025a4e0b7b42
1 <!DOCTYPE html>
2 <title>Service Worker: Skip waiting 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 url1 = 'resources/empty.js';
12 var url2 = 'resources/skip-waiting-worker.js';
13 var frame, frame_sw, sw_registration, oncontrollerchanged;
14 var saw_controllerchanged = new Promise(function(resolve) {
15 oncontrollerchanged = function(e) {
16 assert_equals(e.type, 'controllerchange',
17 'Event name should be "controllerchange"');
18 assert_true(
19 e.target instanceof frame.contentWindow.ServiceWorkerContainer,
20 'Event target should be a ServiceWorkerContainer');
21 assert_equals(e.target.controller.state, 'activating',
22 'Controller state should be activating');
23 assert_equals(
24 frame_sw.controller.scriptURL, normalizeURL(url2),
25 'Controller scriptURL should change to the second one');
26 resolve();
28 });
29 return service_worker_unregister_and_register(t, url1, scope)
30 .then(function(registration) {
31 return wait_for_state(t, registration.installing, 'activated');
33 .then(function() {
34 return with_iframe(scope);
36 .then(function(f) {
37 frame = f;
38 frame_sw = f.contentWindow.navigator.serviceWorker;
39 assert_equals(
40 frame_sw.controller.scriptURL, normalizeURL(url1),
41 'Document controller scriptURL should equal to the first one');
42 frame_sw.oncontrollerchange = t.step_func(oncontrollerchanged);
43 return navigator.serviceWorker.register(url2, {scope: scope});
45 .then(function(registration) {
46 sw_registration = registration;
47 add_completion_callback(function() {
48 registration.unregister();
49 });
50 return saw_controllerchanged;
52 .then(function() {
53 frame.remove();
54 assert_not_equals(sw_registration.active, null,
55 'Registration active worker should not be null');
56 fetch_tests_from_worker(sw_registration.active);
57 });
58 }, 'Test skipWaiting while a client is using the registration');
60 </script>