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

Side by Side Diff: LayoutTests/http/tests/fetch/resources/thorough-util.js

Issue 1283163003: [Fetch][WIP] Support blob:, about:, and data: URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Cleanup. Created 5 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/fetch/script-tests/fetch.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 var SCOPE = BASE_ORIGIN + 1 var SCOPE = BASE_ORIGIN +
2 '/fetch/resources/thorough-iframe.html?' + TEST_OPTIONS; 2 '/fetch/resources/thorough-iframe.html?' + TEST_OPTIONS;
3 var IFRAME_ORIGIN = BASE_ORIGIN; 3 var IFRAME_ORIGIN = BASE_ORIGIN;
4 var BASE_URL = BASE_ORIGIN + 4 var BASE_URL = BASE_ORIGIN +
5 '/serviceworker/resources/fetch-access-control.php?'; 5 '/serviceworker/resources/fetch-access-control.php?';
6 var OTHER_BASE_URL = OTHER_ORIGIN + 6 var OTHER_BASE_URL = OTHER_ORIGIN +
7 '/serviceworker/resources/fetch-access-control.php?'; 7 '/serviceworker/resources/fetch-access-control.php?';
8 var REDIRECT_URL = BASE_ORIGIN + 8 var REDIRECT_URL = BASE_ORIGIN +
9 '/serviceworker/resources/redirect.php?Redirect='; 9 '/serviceworker/resources/redirect.php?Redirect=';
10 var OTHER_REDIRECT_URL = OTHER_ORIGIN + 10 var OTHER_REDIRECT_URL = OTHER_ORIGIN +
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 var fetchIgnored = checkFetchResult.bind(this, 'ignored'); 68 var fetchIgnored = checkFetchResult.bind(this, 'ignored');
69 var fetchResolved = checkFetchResult.bind(this, 'resolved'); 69 var fetchResolved = checkFetchResult.bind(this, 'resolved');
70 var fetchRejected = checkFetchResult.bind(this, 'rejected'); 70 var fetchRejected = checkFetchResult.bind(this, 'rejected');
71 var fetchError = checkFetchResult.bind(this, 'error'); 71 var fetchError = checkFetchResult.bind(this, 'error');
72 var hasBody = checkFetchResponseBody.bind(this, true); 72 var hasBody = checkFetchResponseBody.bind(this, true);
73 var noBody = checkFetchResponseBody.bind(this, false); 73 var noBody = checkFetchResponseBody.bind(this, false);
74 var hasContentLength = 74 var hasContentLength =
75 checkFetchResponseHeader.bind(this, 'content-length', true); 75 checkFetchResponseHeader.bind(this, 'content-length', true);
76 var noContentLength = 76 var noContentLength =
77 checkFetchResponseHeader.bind(this, 'content-length', false); 77 checkFetchResponseHeader.bind(this, 'content-length', false);
78 var hasContentType =
79 checkFetchResponseHeader.bind(this, 'content-type', true);
80 var noContentType =
81 checkFetchResponseHeader.bind(this, 'content-type', false);
78 var hasServerHeader = 82 var hasServerHeader =
79 checkFetchResponseHeader.bind(this, 'x-serviceworker-serverheader', true); 83 checkFetchResponseHeader.bind(this, 'x-serviceworker-serverheader', true);
80 var noServerHeader = 84 var noServerHeader =
81 checkFetchResponseHeader.bind(this, 'x-serviceworker-serverheader', false); 85 checkFetchResponseHeader.bind(this, 'x-serviceworker-serverheader', false);
82 var typeBasic = checkFetchResponseType.bind(this, 'basic'); 86 var typeBasic = checkFetchResponseType.bind(this, 'basic');
83 var typeCors = checkFetchResponseType.bind(this, 'cors'); 87 var typeCors = checkFetchResponseType.bind(this, 'cors');
84 var typeOpaque = checkFetchResponseType.bind(this, 'opaque'); 88 var typeOpaque = checkFetchResponseType.bind(this, 'opaque');
85 89
86 // Functions to check the result of JSONP which is evaluated in 90 // Functions to check the result of JSONP which is evaluated in
87 // thorough-iframe.html by appending <script> element. 91 // thorough-iframe.html by appending <script> element.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 300 }
297 301
298 function headersToArray(headers) { 302 function headersToArray(headers) {
299 var ret = []; 303 var ret = [];
300 304
301 // Workaround for Firefox. iterable is not implemented yet. 305 // Workaround for Firefox. iterable is not implemented yet.
302 // This is used only by checkFetchResponseHeader, and 306 // This is used only by checkFetchResponseHeader, and
303 // checkFetchResponseHeader is used only for the header names listed below. 307 // checkFetchResponseHeader is used only for the header names listed below.
304 // FIXME: Replace it with the original code below when Firefox supports 308 // FIXME: Replace it with the original code below when Firefox supports
305 // iterable. 309 // iterable.
306 ['content-length', 'x-serviceworker-serverheader'].forEach(function(name) { 310 ['content-length', 'content-type', 'x-serviceworker-serverheader'].forEach(
311 function(name) {
307 for (var value of headers.getAll(name)) 312 for (var value of headers.getAll(name))
308 ret.push([name, value]); 313 ret.push([name, value]);
309 }); 314 });
310 315
311 // Original code: 316 // Original code:
312 // for (var header of headers) { 317 // for (var header of headers) {
313 // ret.push(header); 318 // ret.push(header);
314 // } 319 // }
315 320
316 return ret; 321 return ret;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 402
398 function executeTests(test_targets) { 403 function executeTests(test_targets) {
399 for (var i = 0; i < test_targets.length; ++i) { 404 for (var i = 0; i < test_targets.length; ++i) {
400 promise_test( 405 promise_test(
401 function(counter, t) { 406 function(counter, t) {
402 return executeTest(test_targets[counter]); 407 return executeTest(test_targets[counter]);
403 }.bind(this, i), 408 }.bind(this, i),
404 "executeTest-" + i); 409 "executeTest-" + i);
405 } 410 }
406 } 411 }
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/fetch/script-tests/fetch.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698