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

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

Issue 600393004: [ServiceWorker] Set FetchRequestMode and handle wasFetchedViaServiceWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: delete fetch-cors-xhr-expected.txt Created 6 years, 2 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
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
249
250 function test_login(test, origin, username, password) {
251 return new Promise(function(resolve, reject) {
252 with_iframe(
253 origin + base_path() +
254 'resources/fetch-access-control-login.html')
255 .then(test.step_func(function(frame) {
256 var channel = new MessageChannel();
257 channel.port1.onmessage = test.step_func(function() {
258 unload_iframe(frame);
259 resolve();
260 });
261 frame.contentWindow.postMessage(
262 {username: username, password: password},
263 [channel.port2], origin);
264 }));
265 });
266 }
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/serviceworker/resources/fetch-request-xhr-worker.js ('k') | Source/core/fetch/FetchRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698