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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/serviceworker/controller-on-load.html
diff --git a/LayoutTests/http/tests/serviceworker/controller-on-load.html b/LayoutTests/http/tests/serviceworker/controller-on-load.html
index 50fc06116224d781aa0cffdd8be806af3fedef9d..e86c814f82651f597d6808b1ba489b7ce768c7c6 100644
--- a/LayoutTests/http/tests/serviceworker/controller-on-load.html
+++ b/LayoutTests/http/tests/serviceworker/controller-on-load.html
@@ -9,25 +9,25 @@ var t = async_test('controller is set for a controlled document');
t.step(function() {
var url = 'resources/worker-no-op.js';
var scope = 'resources/blank.html';
- service_worker_unregister_and_register(t, url, scope).then(t.step_func(onRegister));
-
- function onRegister(worker) {
- worker.addEventListener('statechange', t.step_func(function(event) {
- if (event.target.state == 'activated')
- onActive();
- }));
- }
-
- 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.scriptURL, normalizeURL(url));
- service_worker_unregister_and_done(t, scope);
- }));
- }
-});
+ service_worker_unregister_and_register(t, url, scope)
+ .then(t.step_func(function(registration) {
+ return wait_for_update(t, registration);
+ }))
+ .then(t.step_func(function(worker) {
+ return wait_for_state(t, worker, 'activated');
+ }))
+ .then(t.step_func(function() {
+ return with_iframe(scope)
+ }))
+ .then(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.scriptURL, normalizeURL(url));
+ service_worker_unregister_and_done(t, scope);
+ }))
+ .catch(unreached_rejection(t));
+ });
</script>
</body>

Powered by Google App Engine
This is Rietveld 408576698