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

Side by Side Diff: LayoutTests/http/tests/serviceworker/fetch-event.html

Issue 442183003: FetchEvent should not forcibly reject an unresolved Promise when destructed (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/resources/fetch-event-test-worker.js » ('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/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <script src="resources/test-helpers.js"></script> 4 <script src="resources/test-helpers.js"></script>
5 <body> 5 <body>
6 <script> 6 <script>
7 var worker = 'resources/fetch-event-test-worker.js'; 7 var worker = 'resources/fetch-event-test-worker.js';
8 8
9 (function() { 9 (function() {
10 var t = async_test('Service Worker responds to fetch event with string'); 10 var t = async_test('Service Worker responds to fetch event with string');
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 .then(t.step_func(function(frame) { 114 .then(t.step_func(function(frame) {
115 assert_equals(frame.contentDocument.body.textContent, 115 assert_equals(frame.contentDocument.body.textContent,
116 'Here\'s a simple html file.\n', 116 'Here\'s a simple html file.\n',
117 'Response should come from fallback to native fetch'); 117 'Response should come from fallback to native fetch');
118 return service_worker_unregister_and_done(t, scope); 118 return service_worker_unregister_and_done(t, scope);
119 })) 119 }))
120 .catch(unreached_rejection(t)); 120 .catch(unreached_rejection(t));
121 }()); 121 }());
122 122
123 (function() { 123 (function() {
124 var t = async_test(
125 'Service Worker responds to fetch event with unresolved promise');
126 var scope = 'resources/simple.html?unresolved';
127 service_worker_unregister_and_register(t, worker, scope)
128 .then(t.step_func(function(sw) {
129 return wait_for_state(t, sw, 'activated');
130 }))
131 .then(t.step_func(function() { return with_iframe(scope); }))
132 .then(t.step_func(function(frame) {
133 assert_equals(frame.contentDocument.body.textContent,
134 'Here\'s a simple html file.\n',
135 'Response should come from fallback to native fetch');
136 return service_worker_unregister_and_done(t, scope);
137 }))
138 .catch(unreached_rejection(t));
139 }());
140
141 (function() {
142 var t = async_test('Service Worker fetches other file in fetch event'); 124 var t = async_test('Service Worker fetches other file in fetch event');
143 var scope = 'resources/simple.html?fetch'; 125 var scope = 'resources/simple.html?fetch';
144 service_worker_unregister_and_register(t, worker, scope) 126 service_worker_unregister_and_register(t, worker, scope)
145 .then(t.step_func(function(sw) { 127 .then(t.step_func(function(sw) {
146 return wait_for_state(t, sw, 'activated'); 128 return wait_for_state(t, sw, 'activated');
147 })) 129 }))
148 .then(t.step_func(function() { return with_iframe(scope); })) 130 .then(t.step_func(function() { return with_iframe(scope); }))
149 .then(t.step_func(function(frame) { 131 .then(t.step_func(function(frame) {
150 assert_equals(frame.contentDocument.body.textContent, 132 assert_equals(frame.contentDocument.body.textContent,
151 'Here\'s an other html file.\n', 133 'Here\'s an other html file.\n',
152 'Response should come from fetched other file'); 134 'Response should come from fetched other file');
153 return service_worker_unregister_and_done(t, scope); 135 return service_worker_unregister_and_done(t, scope);
154 })) 136 }))
155 .catch(unreached_rejection(t)); 137 .catch(unreached_rejection(t));
156 }()); 138 }());
157 </script> 139 </script>
158 </body> 140 </body>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/resources/fetch-event-test-worker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698