OLD | NEW |
---|---|
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 Loading... | |
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( | |
dominicc (has gone to gerrit)
2014/08/07 04:40:18
I think we want to test this, but I can re-add a n
| |
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> |
OLD | NEW |