Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / serviceworker / chromium / force-refresh-ready.html
blobf825b9b590db35872f6aea8e3bcd8cf7376a25d9
1 <!DOCTYPE html>
2 <!-- This test should not be upstreamed due to shift-reload behavior
3 is not defined by spec. -->
4 <title>Service Worker: force-refresh ready test</title>
5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharness-helpers.js"></script>
7 <script src="../../resources/testharnessreport.js"></script>
8 <script src="../resources/test-helpers.js"></script>
9 <body>
10 <script>
12 promise_test(function(t) {
13 var scope = '../resources/blank.html';
14 var script_url = '../resources/empty-worker.js';
15 var frame;
16 return service_worker_unregister_and_register(t, script_url, scope)
17 .then(function(registration) {
18 return wait_for_state(t, registration.installing, 'activated');
20 .then(function() {
21 return with_iframe(scope);
23 .then(function(f) {
24 frame = f;
25 return new Promise(function(resolve) {
26 frame.onload = t.step_func(function() {
27 frame.contentWindow.navigator.serviceWorker.ready
28 .then(function() {
29 resolve();
30 });
31 });
32 frame.contentWindow.internals.forceReload(true);
33 });
35 .then(function() {
36 frame.remove();
37 return service_worker_unregister_and_done(t, scope);
38 });
39 }, 'Test ready promise for force-refreshed frame');
41 </script>
42 </body>