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

Unified Diff: LayoutTests/http/tests/serviceworker/controller-on-reload.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-reload.html
diff --git a/LayoutTests/http/tests/serviceworker/controller-on-reload.html b/LayoutTests/http/tests/serviceworker/controller-on-reload.html
index a91ea6db3df036309907a966ad9cbb91450d86cd..068a3b64f523da9702f3641edf6ea526eadf7dd1 100644
--- a/LayoutTests/http/tests/serviceworker/controller-on-reload.html
+++ b/LayoutTests/http/tests/serviceworker/controller-on-reload.html
@@ -20,21 +20,6 @@ t.step(function() {
function onIframeLoad(frame) {
var w = frame.contentWindow;
-
- function onActive(event) {
- assert_equals(w.navigator.serviceWorker.controller, null,
- 'controller should be null until the document is reloaded');
- reloaded = true;
- w.location.reload();
- }
-
- function onRegister(worker) {
- worker.addEventListener('statechange', t.step_func(function(event) {
- if (event.target.state == 'activated')
- onActive();
- }));
- }
-
if (reloaded) {
assert_true(w.navigator.serviceWorker.controller instanceof w.ServiceWorker,
'controller should be a ServiceWorker object upon reload');
@@ -42,12 +27,21 @@ t.step(function() {
return;
}
- w.navigator.serviceWorker.register(
- 'worker-no-op.js', {scope: 'blank.html'}
- ).then(
- t.step_func(onRegister),
- unreached_rejection(t, 'Registration should succeed, but failed')
- );
+ w.navigator.serviceWorker.register('worker-no-op.js',
+ {scope: 'blank.html'})
+ .then(function(registration) {
+ return wait_for_update(t, registration);
+ })
+ .then(function(worker) {
+ return wait_for_state(t, worker, 'activated');
+ })
+ .then(function() {
+ assert_equals(w.navigator.serviceWorker.controller, null,
+ 'controller should be null until the document is reloaded');
+ reloaded = true;
+ w.location.reload();
+ })
+ .catch(unreached_rejection(t));
}
});
</script>
« no previous file with comments | « LayoutTests/http/tests/serviceworker/controller-on-load.html ('k') | LayoutTests/http/tests/serviceworker/fetch.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698