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

Side by Side Diff: LayoutTests/http/tests/serviceworker/controller-on-load.html

Issue 466723002: ServiceWorker: Enable ServiceWorkerRegistration and update layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@updatefound
Patch Set: rebase Created 6 years, 4 months 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Service Worker: Controller on load</title> 2 <title>Service Worker: Controller on load</title>
3 <script src="../resources/testharness.js"></script> 3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script> 5 <script src="resources/test-helpers.js"></script>
6 <body> 6 <body>
7 <script> 7 <script>
8 var t = async_test('controller is set for a controlled document'); 8 var t = async_test('controller is set for a controlled document');
9 t.step(function() { 9 t.step(function() {
10 var url = 'resources/worker-no-op.js'; 10 var url = 'resources/worker-no-op.js';
11 var scope = 'resources/blank.html'; 11 var scope = 'resources/blank.html';
12 service_worker_unregister_and_register(t, url, scope).then(t.step_func(onReg ister)); 12 service_worker_unregister_and_register(t, url, scope)
13 13 .then(t.step_func(function(registration) {
14 function onRegister(worker) { 14 return wait_for_update(t, registration);
15 worker.addEventListener('statechange', t.step_func(function(event) { 15 }))
16 if (event.target.state == 'activated') 16 .then(t.step_func(function(worker) {
17 onActive(); 17 return wait_for_state(t, worker, 'activated');
18 })); 18 }))
19 } 19 .then(t.step_func(function() {
20 20 return with_iframe(scope)
21 function onActive() { 21 }))
22 with_iframe(scope, t.step_func(function(frame) { 22 .then(t.step_func(function(frame) {
23 var w = frame.contentWindow; 23 var w = frame.contentWindow;
24 var controller = w.navigator.serviceWorker.controller; 24 var controller = w.navigator.serviceWorker.controller;
25 assert_true(controller instanceof w.ServiceWorker, 25 assert_true(controller instanceof w.ServiceWorker,
26 'controller should be a ServiceWorker object'); 26 'controller should be a ServiceWorker object');
27 assert_equals(controller.scriptURL, normalizeURL(url)); 27 assert_equals(controller.scriptURL, normalizeURL(url));
28 service_worker_unregister_and_done(t, scope); 28 service_worker_unregister_and_done(t, scope);
29 })); 29 }))
30 } 30 .catch(unreached_rejection(t));
31 }); 31 });
32 </script> 32 </script>
33 </body> 33 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698