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

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/skip-waiting-installed-worker.js

Issue 2415873002: Import w3c tests for the service workers (Closed)
Patch Set: Rebase Created 4 years, 2 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: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/skip-waiting-installed-worker.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/skip-waiting-installed-worker.js b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/skip-waiting-installed-worker.js
similarity index 59%
copy from third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/skip-waiting-installed-worker.js
copy to third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/skip-waiting-installed-worker.js
index 56b97a718034a4000a7a3b9519f452b97abbd999..bf582c770744391bfd38bec0da2e7701427c466a 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/skip-waiting-installed-worker.js
+++ b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/skip-waiting-installed-worker.js
@@ -1,35 +1,24 @@
-// TODO(nhiroki): stop using global states because service workers can be killed
-// at any point (http://crbug.com/558244).
self.state = 'starting';
self.addEventListener('install', function() {
self.state = 'installing';
});
-self.addEventListener('activate', function() {
- self.state = 'activating';
- });
-
self.addEventListener('message', function(event) {
var port = event.data.port;
if (self.state !== 'installing') {
port.postMessage('FAIL: Worker should be waiting in installed state');
return;
}
- event.waitUntil(self.skipWaiting()
+ self.skipWaiting()
.then(function(result) {
if (result !== undefined) {
port.postMessage('FAIL: Promise should be resolved with undefined');
return;
}
- if (self.state !== 'activating') {
- port.postMessage(
- 'FAIL: Promise should be resolved after worker activated');
- return;
- }
port.postMessage('PASS');
})
.catch(function(e) {
port.postMessage('FAIL: unexpected exception: ' + e);
- }));
+ });
});

Powered by Google App Engine
This is Rietveld 408576698