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

Unified Diff: LayoutTests/http/tests/serviceworker/activation-after-registration.html

Issue 466723002: ServiceWorker: Enable ServiceWorkerRegistration and update layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@updatefound
Patch Set: update comments in service-worker-gc.html 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/activation-after-registration.html
diff --git a/LayoutTests/http/tests/serviceworker/activation-after-registration.html b/LayoutTests/http/tests/serviceworker/activation-after-registration.html
index a1fbe2e28ea5be0ec887aededcc1ff81ddb8c357..e2feb7e6dd9abe47568352093e4b9fc760eeb793 100644
--- a/LayoutTests/http/tests/serviceworker/activation-after-registration.html
+++ b/LayoutTests/http/tests/serviceworker/activation-after-registration.html
@@ -8,16 +8,22 @@
var t = async_test('activation occurs after registration');
t.step(function() {
var scope = 'resources/blank.html';
- service_worker_unregister_and_register(
- t, 'resources/worker-no-op.js', scope).then(t.step_func(onRegister));
+ var registration;
- function onRegister(worker) {
- assert_equals(worker.state, 'parsed', 'worker should be in the "parsed" state upon registration');
- worker.addEventListener('statechange', t.step_func(function(event) {
- if (event.target.state == 'activated')
- service_worker_unregister_and_done(t, scope);
- }));
- }
+ service_worker_unregister_and_register(
+ t, 'resources/worker-no-op.js', scope)
+ .then(t.step_func(function(r) {
+ registration = r;
+ return wait_for_update(t, registration);
+ }))
+ .then(t.step_func(function(worker) {
+ assert_equals(worker.state, 'parsed', 'worker should be in the "parsed" state upon registration');
+ worker.addEventListener('statechange', t.step_func(function(event) {
+ if (event.target.state == 'activated')
+ service_worker_unregister_and_done(t, scope);
+ }));
+ }))
+ .catch(unreached_rejection(t));
});
</script>
</body>

Powered by Google App Engine
This is Rietveld 408576698