diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/skip-waiting-installed-worker.js b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/skip-waiting-installed-worker.js index eb63026d5c480..b48d502b13606 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/skip-waiting-installed-worker.js +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/skip-waiting-installed-worker.js @@ -1,19 +1,11 @@ -self.state = 'starting'; - -self.addEventListener('install', function() { - self.state = 'installing'; - }); +var saw_activate_event = false self.addEventListener('activate', function() { - self.state = 'activating'; + saw_activate_event = true; }); 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() .then(function(result) { if (result !== undefined) { @@ -21,9 +13,15 @@ self.addEventListener('message', function(event) { return; } - if (self.state === 'activating') { + if (!saw_activate_event) { + port.postMessage( + 'FAIL: Promise should be resolved after activate event is dispatched'); + return; + } + + if (self.registration.active.state !== 'activating') { port.postMessage( - 'FAIL: Promise should be resolved before worker is activated'); + 'FAITL: Promise should be resolved before ServiceWorker#state is set to activated'); return; } diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/skip-waiting-installed.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/skip-waiting-installed.https-expected.txt deleted file mode 100644 index fdfb89c49cf82..0000000000000 --- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/skip-waiting-installed.https-expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Test skipWaiting when a installed worker is waiting assert_equals: skipWaiting promise should be resolved with undefined expected "PASS" but got "FAIL: Promise should be resolved before worker is activated" -Harness: the test ran to completion. - diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium.skip-waiting-installed.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium.skip-waiting-installed.html deleted file mode 100644 index dcf3cb09f9428..0000000000000 --- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium.skip-waiting-installed.html +++ /dev/null @@ -1,67 +0,0 @@ - - -Service Worker: Skip waiting installed worker - - - - diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/skip-waiting-installed-worker.js b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/skip-waiting-installed-worker.js deleted file mode 100644 index 3ae97a45b19e4..0000000000000 --- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/skip-waiting-installed-worker.js +++ /dev/null @@ -1,36 +0,0 @@ -// 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() - .then(function(result) { - if (result !== undefined) { - port.postMessage('FAIL: Promise should be resolved with undefined'); - return; - } - if (self.state !== 'activating') { - port.postMessage('This assertion passes in current Chromium ' + - '(i.e., self.state is "activating"), ' + - 'but it should fail. See https://crbug.com/725616'); - return; - } - port.postMessage('PASS'); - }) - .catch(function(e) { - port.postMessage('FAIL: unexpected exception: ' + e); - })); - }); diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/mojo-blobs/external/wpt/service-workers/service-worker/skip-waiting-installed.https-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/mojo-blobs/external/wpt/service-workers/service-worker/skip-waiting-installed.https-expected.txt deleted file mode 100644 index fdfb89c49cf82..0000000000000 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/mojo-blobs/external/wpt/service-workers/service-worker/skip-waiting-installed.https-expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Test skipWaiting when a installed worker is waiting assert_equals: skipWaiting promise should be resolved with undefined expected "PASS" but got "FAIL: Promise should be resolved before worker is activated" -Harness: the test ran to completion. - diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/service-worker-script-streaming/external/wpt/service-workers/service-worker/skip-waiting-installed.https-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/service-worker-script-streaming/external/wpt/service-workers/service-worker/skip-waiting-installed.https-expected.txt deleted file mode 100644 index fdfb89c49cf82..0000000000000 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/service-worker-script-streaming/external/wpt/service-workers/service-worker/skip-waiting-installed.https-expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Test skipWaiting when a installed worker is waiting assert_equals: skipWaiting promise should be resolved with undefined expected "PASS" but got "FAIL: Promise should be resolved before worker is activated" -Harness: the test ran to completion. - diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-blobs/external/wpt/service-workers/service-worker/skip-waiting-installed.https-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-blobs/external/wpt/service-workers/service-worker/skip-waiting-installed.https-expected.txt deleted file mode 100644 index fdfb89c49cf82..0000000000000 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/mojo-blobs/external/wpt/service-workers/service-worker/skip-waiting-installed.https-expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Test skipWaiting when a installed worker is waiting assert_equals: skipWaiting promise should be resolved with undefined expected "PASS" but got "FAIL: Promise should be resolved before worker is activated" -Harness: the test ran to completion. - diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/service-worker-script-streaming/external/wpt/service-workers/service-worker/skip-waiting-installed.https-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/service-worker-script-streaming/external/wpt/service-workers/service-worker/skip-waiting-installed.https-expected.txt deleted file mode 100644 index fdfb89c49cf82..0000000000000 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/service-worker-script-streaming/external/wpt/service-workers/service-worker/skip-waiting-installed.https-expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Test skipWaiting when a installed worker is waiting assert_equals: skipWaiting promise should be resolved with undefined expected "PASS" but got "FAIL: Promise should be resolved before worker is activated" -Harness: the test ran to completion. -