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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/onactivate-script-error.https.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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/onactivate-script-error.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="/resources/testharness.js"></script> 2 <script src="/resources/testharness.js"></script>
3 <script src="resources/testharness-helpers.js"></script> 3 <script src="resources/testharness-helpers.js"></script>
4 <script src="/resources/testharnessreport.js"></script> 4 <script src="/resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.sub.js"></script> 5 <script src="resources/test-helpers.sub.js"></script>
6 <script> 6 <script>
7 function wait_for_install(worker) { 7 function wait_for_install(worker) {
8 return new Promise(function(resolve, reject) { 8 return new Promise(function(resolve, reject) {
9 worker.addEventListener('statechange', function(event) { 9 worker.addEventListener('statechange', function(event) {
10 if (worker.state == 'installed') 10 if (worker.state == 'installed')
(...skipping 15 matching lines...) Expand all
26 }); 26 });
27 } 27 }
28 28
29 function make_test(name, script) { 29 function make_test(name, script) {
30 promise_test(function(t) { 30 promise_test(function(t) {
31 var scope = script; 31 var scope = script;
32 var registration; 32 var registration;
33 return service_worker_unregister_and_register(t, script, scope) 33 return service_worker_unregister_and_register(t, script, scope)
34 .then(function(r) { 34 .then(function(r) {
35 registration = r; 35 registration = r;
36
37 t.add_cleanup(function() {
38 r.unregister();
39 });
40
36 return wait_for_install(registration.installing); 41 return wait_for_install(registration.installing);
37 }) 42 })
38 .then(function() { 43 .then(function() {
39 // Activate should succeed regardless of script errors. 44 // Activate should succeed regardless of script errors.
40 if (registration.active && registration.active.state == 'activated') {
41 return Promise.resolve();
42 } else if (registration.active) {
43 return wait_for_activate(registration.active);
44 }
45
46 return wait_for_activate(registration.waiting); 45 return wait_for_activate(registration.waiting);
47 }); 46 });
48 }, name); 47 }, name);
49 } 48 }
50 49
51 [ 50 [
52 { 51 {
53 name: 'activate handler throws an error', 52 name: 'activate handler throws an error',
54 script: 'resources/onactivate-throw-error-worker.js', 53 script: 'resources/onactivate-throw-error-worker.js',
55 }, 54 },
(...skipping 10 matching lines...) Expand all
66 script: 'resources/onactivate-throw-error-then-cancel-worker.js', 65 script: 'resources/onactivate-throw-error-then-cancel-worker.js',
67 }, 66 },
68 { 67 {
69 name: 'activate handler throws an error and prevents default', 68 name: 'activate handler throws an error and prevents default',
70 script: 'resources/onactivate-throw-error-then-prevent-default-worker.js', 69 script: 'resources/onactivate-throw-error-then-prevent-default-worker.js',
71 } 70 }
72 ].forEach(function(test_case) { 71 ].forEach(function(test_case) {
73 make_test(test_case.name, test_case.script); 72 make_test(test_case.name, test_case.script);
74 }); 73 });
75 </script> 74 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/onactivate-script-error.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698