| Index: LayoutTests/http/tests/serviceworker/ready-controlled-document.html
|
| diff --git a/LayoutTests/http/tests/serviceworker/controller-on-load.html b/LayoutTests/http/tests/serviceworker/ready-controlled-document.html
|
| similarity index 57%
|
| copy from LayoutTests/http/tests/serviceworker/controller-on-load.html
|
| copy to LayoutTests/http/tests/serviceworker/ready-controlled-document.html
|
| index 162e30b6b0632e9ed3862207397dc5043d117dfd..05f748e40f34591d1bed9204b2675075894d0077 100644
|
| --- a/LayoutTests/http/tests/serviceworker/controller-on-load.html
|
| +++ b/LayoutTests/http/tests/serviceworker/ready-controlled-document.html
|
| @@ -1,11 +1,11 @@
|
| <!DOCTYPE html>
|
| -<title>Service Worker: Controller on load</title>
|
| +<title>Service Worker: ready in a controlled document</title>
|
| <script src="../resources/testharness.js"></script>
|
| <script src="../resources/testharnessreport.js"></script>
|
| <script src="resources/test-helpers.js"></script>
|
| <body>
|
| <script>
|
| -var t = async_test('controller is set for a controlled document');
|
| +var t = async_test('ready in a controlled document');
|
| t.step(function() {
|
| var url = 'resources/worker-no-op.js';
|
| var scope = 'resources/blank.html';
|
| @@ -18,17 +18,21 @@ t.step(function() {
|
| }));
|
| }
|
|
|
| + var controller;
|
| +
|
| function onActive() {
|
| with_iframe(scope, t.step_func(function(frame) {
|
| var w = frame.contentWindow;
|
| - var controller = w.navigator.serviceWorker.controller;
|
| - assert_true(controller instanceof w.ServiceWorker,
|
| - 'controller should be a ServiceWorker object');
|
| - assert_equals(controller.scope, normalizeURL(scope));
|
| - assert_equals(controller.url, normalizeURL(url));
|
| - service_worker_unregister_and_done(t, scope);
|
| + controller = w.navigator.serviceWorker.controller;
|
| + w.navigator.serviceWorker.ready.then(t.step_func(onReady));
|
| }));
|
| }
|
| +
|
| + function onReady(serviceWorker) {
|
| + assert_equals(serviceWorker, controller,
|
| + 'ready should resolve to the controller of a ' +
|
| + 'controlled document');
|
| + service_worker_unregister_and_done(t, scope);
|
| + }
|
| });
|
| </script>
|
| -</body>
|
|
|