Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: LayoutTests/http/tests/serviceworker/skip-waiting.html

Issue 765323002: ServiceWorker: Add support for .skipWaiting and controllerchange event(3/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Service Worker: Skip waiting</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script>
6 <script>
7
8 promise_test(function(t) {
9 var scope = 'resources/blank.html';
10 var url1 = 'resources/empty.js';
11 var url2 = 'resources/skip-waiting-worker.js';
12 var frame, frame_sw, oncontrollerchanged, worker;
falken 2014/12/01 07:48:28 |worker| is unused
xiang 2014/12/03 00:07:25 Done.
13 var controllerchanged = new Promise(function(resolve) {
14 oncontrollerchanged = function() {
15 assert_equals(
16 frame_sw.controller.scriptURL, normalizeURL(url2),
17 'Controller scriptURL should change to the second one');
18 resolve();
19 };
20 });
21 return service_worker_unregister_and_register(t, url1, scope)
22 .then(function(registration) {
23 return wait_for_update(t, registration);
24 })
25 .then(function(sw) {
26 return wait_for_state(t, sw, 'activated');
27 })
28 .then(function() {
29 return with_iframe(scope);
30 })
31 .then(function(f) {
32 frame = f;
33 frame_sw = f.contentWindow.navigator.serviceWorker;
34 assert_equals(
35 frame_sw.controller.scriptURL, normalizeURL(url1),
36 'Document controller scriptURL should equal to the first one');
37 frame_sw.oncontrollerchange = t.step_func(oncontrollerchanged);
38 return navigator.serviceWorker.register(url2, {scope : scope});
39 })
40 .then(function(registration) {
41 return Promise.all([controllerchanged,
42 fetch_tests_from_worker(registration.installing)]) ;
43 })
44 .then(function() {
45 frame.remove();
46 return service_worker_unregister_and_done(t, scope);
47 })
48 }, 'Test skipWaiting while a client is using the registration');
49
50 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698