Index: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/controller-on-reload.https.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/controller-on-reload.html b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/controller-on-reload.https.html |
similarity index 61% |
copy from third_party/WebKit/LayoutTests/http/tests/serviceworker/controller-on-reload.html |
copy to third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/controller-on-reload.https.html |
index 3af4f3a37d0c6ed295e3787d059cb1ce3168db59..4490c707963bd9371b997bdbfd0819c6fccc9b78 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/controller-on-reload.html |
+++ b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/controller-on-reload.https.html |
@@ -1,13 +1,15 @@ |
<!DOCTYPE html> |
<title>Service Worker: Controller on reload</title> |
-<script src="../resources/testharness.js"></script> |
-<script src="../resources/testharnessreport.js"></script> |
-<script src="resources/test-helpers.js"></script> |
+<script src="/resources/testharness.js"></script> |
+<script src="/resources/testharnessreport.js"></script> |
+<script src="resources/test-helpers.sub.js"></script> |
<body> |
<script> |
promise_test(function(t) { |
var scope = 'resources/blank.html'; |
var frame; |
+ var registration; |
+ var controller; |
return service_worker_unregister(t, scope) |
.then(function() { |
return with_iframe(scope); |
@@ -17,7 +19,8 @@ promise_test(function(t) { |
return frame.contentWindow.navigator.serviceWorker.register( |
'resources/empty-worker.js', {scope: scope}); |
}) |
- .then(function(registration) { |
+ .then(function(swr) { |
+ registration = swr; |
return wait_for_state(t, registration.installing, 'activated'); |
}) |
.then(function() { |
@@ -32,9 +35,17 @@ promise_test(function(t) { |
}) |
.then(function() { |
var w = frame.contentWindow; |
- assert_true( |
- w.navigator.serviceWorker.controller instanceof w.ServiceWorker, |
- 'controller should be a ServiceWorker object upon reload'); |
+ controller = w.navigator.serviceWorker.controller; |
+ assert_true(controller instanceof w.ServiceWorker, |
+ 'controller should be a ServiceWorker object upon reload'); |
+ |
+ // objects from separate windows should not be equal |
+ assert_not_equals(controller, registration.active); |
+ |
+ return w.navigator.serviceWorker.getRegistration(); |
+ }) |
+ .then(function(frameRegistration) { |
+ assert_equals(frameRegistration.active, controller); |
frame.remove(); |
service_worker_unregister_and_done(t, scope); |
}); |