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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/oninstall-script-error.html

Issue 2734783002: Fix oninstall-script tests for service worker (Closed)
Patch Set: address comment Created 3 years, 9 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/http/tests/serviceworker/oninstall-script-error.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/oninstall-script-error.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/oninstall-script-error.html
deleted file mode 100644
index bd5a0610aaf603013f9bec02662ecdc076e7b4b9..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/oninstall-script-error.html
+++ /dev/null
@@ -1,66 +0,0 @@
-<!DOCTYPE html>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.js"></script>
-<script>
-function wait_for_install_event(worker) {
- return new Promise(function(resolve) {
- worker.addEventListener('statechange', function(event) {
- if (worker.state == 'installed')
- resolve(true);
- else if (worker.state == 'redundant')
- resolve(false);
- });
- });
-}
-
-function make_test(name, script, expect_install) {
- promise_test(function(t) {
- var scope = script;
- return service_worker_unregister_and_register(t, script, scope)
- .then(function(registration) {
- return wait_for_install_event(registration.installing);
- })
- .then(function(did_install) {
- assert_equals(did_install, expect_install,
- 'The worker was installed');
- })
- }, name);
-}
-
-[
- {
- name: 'install handler throws an error',
- script: 'resources/oninstall-throw-error-worker.js',
- expect_install: false
- },
- {
- name: 'install handler throws an error, error handler does not cancel',
- script: 'resources/oninstall-throw-error-with-empty-onerror-worker.js',
- expect_install: false
- },
- {
- name: 'install handler dispatches an event that throws an error',
- script: 'resources/oninstall-throw-error-from-nested-event-worker.js',
- expect_install: true
- },
-
- // The following two cases test what happens when the ServiceWorkerGlobalScope
- // 'error' event handler cancels the resulting error event. Since the
- // original 'install' event handler threw, the installation should still
- // be stopped in this case. See:
- // https://github.com/slightlyoff/ServiceWorker/issues/778
- {
- name: 'install handler throws an error that is cancelled',
- script: 'resources/oninstall-throw-error-then-cancel-worker.js',
- expect_install: false
- },
- {
- name: 'install handler throws an error and prevents default',
- script: 'resources/oninstall-throw-error-then-prevent-default-worker.js',
- expect_install: false
- }
-].forEach(function(test_case) {
- make_test(test_case.name, test_case.script, test_case.expect_install);
- });
-</script>

Powered by Google App Engine
This is Rietveld 408576698