Index: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/skip-waiting-using-registration.https.html |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/skip-waiting-using-registration.https.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/skip-waiting-using-registration.https.html |
index 68deae7b01155363f0dd13caf7fe40be59110c74..a9c398a260676d976f0aac0ca495aa1a6c94e631 100644 |
--- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/skip-waiting-using-registration.https.html |
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/skip-waiting-using-registration.https.html |
@@ -1,10 +1,10 @@ |
<!DOCTYPE html> |
<title>Service Worker: Skip waiting using registration</title> |
<script src="/resources/testharness.js"></script> |
-<script src="resources/testharness-helpers.js"></script> |
<script src="/resources/testharnessreport.js"></script> |
<script src="resources/test-helpers.sub.js"></script> |
<script> |
+'use strict'; |
promise_test(function(t) { |
var scope = 'resources/blank.html?skip-waiting-using-registration'; |
@@ -13,19 +13,22 @@ promise_test(function(t) { |
var frame, frame_sw, sw_registration, oncontrollerchanged; |
var saw_controllerchanged = new Promise(function(resolve) { |
oncontrollerchanged = function(e) { |
- assert_equals(e.type, 'controllerchange', |
- 'Event name should be "controllerchange"'); |
- assert_true( |
- e.target instanceof frame.contentWindow.ServiceWorkerContainer, |
- 'Event target should be a ServiceWorkerContainer'); |
- assert_equals(e.target.controller.state, 'activating', |
- 'Controller state should be activating'); |
- assert_equals( |
- frame_sw.controller.scriptURL, normalizeURL(url2), |
- 'Controller scriptURL should change to the second one'); |
- resolve(); |
- }; |
- }); |
+ resolve(e); |
+ }; |
+ }) |
+ .then(function(e) { |
+ assert_equals(e.type, 'controllerchange', |
+ 'Event name should be "controllerchange"'); |
+ assert_true( |
+ e.target instanceof frame.contentWindow.ServiceWorkerContainer, |
+ 'Event target should be a ServiceWorkerContainer'); |
+ assert_equals(e.target.controller.state, 'activating', |
+ 'Controller state should be activating'); |
+ assert_equals( |
+ frame_sw.controller.scriptURL, normalizeURL(url2), |
+ 'Controller scriptURL should change to the second one'); |
+ }); |
+ |
return service_worker_unregister_and_register(t, url1, scope) |
.then(function(registration) { |
return wait_for_state(t, registration.installing, 'activated'); |
@@ -34,6 +37,9 @@ promise_test(function(t) { |
return with_iframe(scope); |
}) |
.then(function(f) { |
+ t.add_cleanup(function() { |
+ f.remove(); |
+ }); |
frame = f; |
frame_sw = f.contentWindow.navigator.serviceWorker; |
assert_equals( |
@@ -44,8 +50,7 @@ promise_test(function(t) { |
}) |
.then(function(registration) { |
sw_registration = registration; |
- add_completion_callback(function() { |
- frame.remove(); |
+ t.add_cleanup(function() { |
registration.unregister(); |
}); |
return saw_controllerchanged; |