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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/onactivate-script-error.html

Issue 2873373004: Remove duplicate service worker test (Closed)
Patch Set: Un-register workers following test completion Created 3 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <script src="resources/test-helpers.js"></script>
5 <script>
6 function wait_for_install(worker) {
7 return new Promise(function(resolve, reject) {
8 worker.addEventListener('statechange', function(event) {
9 if (worker.state == 'installed')
10 resolve();
11 else if (worker.state == 'redundant')
12 reject();
13 });
14 });
15 }
16
17 function wait_for_activate(worker) {
18 return new Promise(function(resolve, reject) {
19 worker.addEventListener('statechange', function(event) {
20 if (worker.state == 'activated')
21 resolve();
22 else if (worker.state == 'redundant')
23 reject();
24 });
25 });
26 }
27
28 function make_test(name, script) {
29 promise_test(function(t) {
30 var scope = script;
31 var registration;
32 return service_worker_unregister_and_register(t, script, scope)
33 .then(function(r) {
34 registration = r;
35 return wait_for_install(registration.installing);
36 })
37 .then(function() {
38 // Activate should succeed regardless of script errors.
39 return wait_for_activate(registration.waiting);
40 });
41 }, name);
42 }
43
44 [
45 {
46 name: 'activate handler throws an error',
47 script: 'resources/onactivate-throw-error-worker.js',
48 },
49 {
50 name: 'activate handler throws an error, error handler does not cancel',
51 script: 'resources/onactivate-throw-error-with-empty-onerror-worker.js',
52 },
53 {
54 name: 'activate handler dispatches an event that throws an error',
55 script: 'resources/onactivate-throw-error-from-nested-event-worker.js',
56 },
57 {
58 name: 'activate handler throws an error that is cancelled',
59 script: 'resources/onactivate-throw-error-then-cancel-worker.js',
60 },
61 {
62 name: 'activate handler throws an error and prevents default',
63 script: 'resources/onactivate-throw-error-then-prevent-default-worker.js',
64 }
65 ].forEach(function(test_case) {
66 make_test(test_case.name, test_case.script);
67 });
68 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698