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

Side by Side Diff: LayoutTests/http/tests/serviceworker/resources/test-helpers.js

Issue 430993002: [ServiceWorker] CacheStorage tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update test expectations Created 6 years, 3 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
OLDNEW
1 // Adapter for testharness.js-style tests with Service Workers 1 // Adapter for testharness.js-style tests with Service Workers
2 2
3 function service_worker_unregister_and_register(test, url, scope) { 3 function service_worker_unregister_and_register(test, url, scope) {
4 if (!scope || scope.length == 0) 4 if (!scope || scope.length == 0)
5 return Promise.reject(new Error('tests must define a scope')); 5 return Promise.reject(new Error('tests must define a scope'));
6 6
7 var options = { scope: scope }; 7 var options = { scope: scope };
8 return service_worker_unregister(test, scope) 8 return service_worker_unregister(test, scope)
9 .then(function() { 9 .then(function() {
10 return navigator.serviceWorker.register(url, options); 10 return navigator.serviceWorker.register(url, options);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 break; 192 break;
193 case tests[i].NOTRUN: 193 case tests[i].NOTRUN:
194 // Leave NOTRUN alone. It'll get marked as a NOTRUN when the test 194 // Leave NOTRUN alone. It'll get marked as a NOTRUN when the test
195 // terminates. 195 // terminates.
196 break; 196 break;
197 } 197 }
198 } 198 }
199 }; 199 };
200 200
201 function service_worker_test(url, description) { 201 function service_worker_test(url, description) {
202 var scope = window.location.origin + '/service-worker-scope/' + 202 var scope = window.location.origin + '/service-worker-scope' +
203 window.location.pathname; 203 window.location.pathname;
204 204
205 var test = async_test(description); 205 var test = async_test(description);
206 var registration; 206 var registration;
207 service_worker_unregister_and_register(test, url, scope) 207 service_worker_unregister_and_register(test, url, scope)
208 .then(function(r) { 208 .then(function(r) {
209 registration = r; 209 registration = r;
210 return wait_for_update(test, registration); 210 return wait_for_update(test, registration);
211 }) 211 })
212 .then(function(worker) { return fetch_tests_from_worker(worker); }) 212 .then(function(worker) { return fetch_tests_from_worker(worker); })
(...skipping 26 matching lines...) Expand all
239 HTTPS_ORIGIN: 'https://' + ORIGINAL_HOST + ':' + HTTPS_PORT, 239 HTTPS_ORIGIN: 'https://' + ORIGINAL_HOST + ':' + HTTPS_PORT,
240 HTTP_REMOTE_ORIGIN: 'http://' + REMOTE_HOST + ':' + HTTP_PORT, 240 HTTP_REMOTE_ORIGIN: 'http://' + REMOTE_HOST + ':' + HTTP_PORT,
241 HTTPS_REMOTE_ORIGIN: 'https://' + REMOTE_HOST + ':' + HTTPS_PORT, 241 HTTPS_REMOTE_ORIGIN: 'https://' + REMOTE_HOST + ':' + HTTPS_PORT,
242 UNAUTHENTICATED_ORIGIN: 'http://' + UNAUTHENTICATED_HOST + ':' + HTTP_PO RT 242 UNAUTHENTICATED_ORIGIN: 'http://' + UNAUTHENTICATED_HOST + ':' + HTTP_PO RT
243 }; 243 };
244 } 244 }
245 245
246 function base_path() { 246 function base_path() {
247 return location.pathname.replace(/\/[^\/]*$/, '/'); 247 return location.pathname.replace(/\/[^\/]*$/, '/');
248 } 248 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698