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

Unified Diff: LayoutTests/http/tests/serviceworker/resources/frame-for-getregistrations.html

Issue 1210883002: Service Worker: Fix getRegistrations.html layout test. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase. Created 5 years, 6 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
« no previous file with comments | « LayoutTests/http/tests/serviceworker/getregistrations.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/serviceworker/resources/frame-for-getregistrations.html
diff --git a/LayoutTests/http/tests/serviceworker/resources/frame-for-getregistrations.html b/LayoutTests/http/tests/serviceworker/resources/frame-for-getregistrations.html
index 511bd972090cc01e0bed798a2b2e6ac65b37ebc2..474004ff0a959c95372fe0ca29941ebad0bad092 100644
--- a/LayoutTests/http/tests/serviceworker/resources/frame-for-getregistrations.html
+++ b/LayoutTests/http/tests/serviceworker/resources/frame-for-getregistrations.html
@@ -4,16 +4,27 @@
var scope = 'scope-for-getregistrations';
var script = 'empty-worker.js';
var registration;
-
-navigator.serviceWorker.register(script, { scope: scope })
- .then(function(r) { registration = r; });
+var port;
self.onmessage = function(e) {
- if (e.data == 'unregister') {
- registration.unregister()
- .then(function() {
- e.ports[0].postMessage('unregistered');
- });
+ if (e.data == 'register') {
+ port = e.ports[0];
+ port.onmessage = function(e) {
+ if (e.data == 'unregister') {
+ registration.unregister()
+ .then(function() {
+ port.postMessage('unregistered');
+ });
+ }
+ };
}
+
+ // Frame registers a registration scoped
+ // http://localhost:8000/serviceworker/resources/scope-for-getregistrations
+ navigator.serviceWorker.register(script, { scope: scope })
+ .then(function(r) {
+ registration = r;
+ e.ports[0].postMessage('registered');
+ });
};
</script>
« no previous file with comments | « LayoutTests/http/tests/serviceworker/getregistrations.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698