OLD | NEW |
1 var SCOPE = BASE_ORIGIN + | 1 var SCOPE = BASE_ORIGIN + |
2 '/fetch/resources/fetch-access-control-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 + |
11 '/serviceworker/resources/redirect.php?Redirect='; | 11 '/serviceworker/resources/redirect.php?Redirect='; |
12 var REDIRECT_LOOP_URL = BASE_ORIGIN + | 12 var REDIRECT_LOOP_URL = BASE_ORIGIN + |
13 '/fetch/resources/redirect-loop.php?Redirect='; | 13 '/fetch/resources/redirect-loop.php?Redirect='; |
14 var OTHER_REDIRECT_LOOP_URL = OTHER_ORIGIN + | 14 var OTHER_REDIRECT_LOOP_URL = OTHER_ORIGIN + |
15 '/fetch/resources/redirect-loop.php?Redirect='; | 15 '/fetch/resources/redirect-loop.php?Redirect='; |
16 var IFRAME_URL = SCOPE; | 16 var IFRAME_URL = SCOPE; |
17 var WORKER_URL = BASE_ORIGIN + | 17 var WORKER_URL = BASE_ORIGIN + |
18 '/fetch/resources/fetch-access-control-worker.js?' + | 18 '/fetch/resources/thorough-worker.js?' + |
19 TEST_OPTIONS; | 19 TEST_OPTIONS; |
20 | 20 |
21 function onlyOnServiceWorkerProxiedTest(checkFuncs) { | 21 function onlyOnServiceWorkerProxiedTest(checkFuncs) { |
22 return []; | 22 return []; |
23 } | 23 } |
24 | 24 |
25 // Functions to check the result from the ServiceWorker. | 25 // Functions to check the result from the ServiceWorker. |
26 var checkFetchResult = function(expected, url, data) { | 26 var checkFetchResult = function(expected, url, data) { |
27 assert_equals(data.fetchResult, expected, url + ' should be ' + expected); | 27 assert_equals(data.fetchResult, expected, url + ' should be ' + expected); |
28 }; | 28 }; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 checkFetchResponseHeader.bind(this, 'content-length', false); | 77 checkFetchResponseHeader.bind(this, 'content-length', false); |
78 var hasServerHeader = | 78 var hasServerHeader = |
79 checkFetchResponseHeader.bind(this, 'x-serviceworker-serverheader', true); | 79 checkFetchResponseHeader.bind(this, 'x-serviceworker-serverheader', true); |
80 var noServerHeader = | 80 var noServerHeader = |
81 checkFetchResponseHeader.bind(this, 'x-serviceworker-serverheader', false); | 81 checkFetchResponseHeader.bind(this, 'x-serviceworker-serverheader', false); |
82 var typeBasic = checkFetchResponseType.bind(this, 'basic'); | 82 var typeBasic = checkFetchResponseType.bind(this, 'basic'); |
83 var typeCors = checkFetchResponseType.bind(this, 'cors'); | 83 var typeCors = checkFetchResponseType.bind(this, 'cors'); |
84 var typeOpaque = checkFetchResponseType.bind(this, 'opaque'); | 84 var typeOpaque = checkFetchResponseType.bind(this, 'opaque'); |
85 | 85 |
86 // Functions to check the result of JSONP which is evaluated in | 86 // Functions to check the result of JSONP which is evaluated in |
87 // fetch-access-control-iframe.html by appending <script> element. | 87 // thorough-iframe.html by appending <script> element. |
88 var checkJsonpResult = function(expected, url, data) { | 88 var checkJsonpResult = function(expected, url, data) { |
89 assert_equals(data.jsonpResult, | 89 assert_equals(data.jsonpResult, |
90 expected, | 90 expected, |
91 url + ' jsonpResult should match'); | 91 url + ' jsonpResult should match'); |
92 }; | 92 }; |
93 var checkJsonpHeader = function(name, value, url, data) { | 93 var checkJsonpHeader = function(name, value, url, data) { |
94 assert_equals(data.jsonpResult, | 94 assert_equals(data.jsonpResult, |
95 'success', | 95 'success', |
96 url + ' jsonpResult must be success'); | 96 url + ' jsonpResult must be success'); |
97 assert_equals(data.headers[name], | 97 assert_equals(data.headers[name], |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // Start tests. | 194 // Start tests. |
195 loadNext(); | 195 loadNext(); |
196 }) | 196 }) |
197 .catch(unreached_rejection(test)); | 197 .catch(unreached_rejection(test)); |
198 | 198 |
199 var readyFromWorkerReceived = undefined; | 199 var readyFromWorkerReceived = undefined; |
200 var resultFromWorkerReceived = undefined; | 200 var resultFromWorkerReceived = undefined; |
201 var resultFromIframeReceived = undefined; | 201 var resultFromIframeReceived = undefined; |
202 | 202 |
203 function onMessage(e) { | 203 function onMessage(e) { |
204 // The message is sent from fetch-access-control-iframe.html in report() | 204 // The message is sent from thorough-iframe.html in report() |
205 // which is called by appending <script> element which source code is | 205 // which is called by appending <script> element which source code is |
206 // generated by fetch-access-control.php. | 206 // generated by fetch-access-control.php. |
207 if (test_targets[counter][2]) { | 207 if (test_targets[counter][2]) { |
208 test_targets[counter][2].forEach(function(checkFunc) { | 208 test_targets[counter][2].forEach(function(checkFunc) { |
209 checkFunc.call(this, test_targets[counter][0], e.data); | 209 checkFunc.call(this, test_targets[counter][0], e.data); |
210 }); | 210 }); |
211 } | 211 } |
212 resultFromIframeReceived(); | 212 resultFromIframeReceived(); |
213 } | 213 } |
214 | 214 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 | 397 |
398 function executeTests(test_targets) { | 398 function executeTests(test_targets) { |
399 for (var i = 0; i < test_targets.length; ++i) { | 399 for (var i = 0; i < test_targets.length; ++i) { |
400 sequential_promise_test( | 400 sequential_promise_test( |
401 function(counter, t) { | 401 function(counter, t) { |
402 return executeTest(test_targets[counter]); | 402 return executeTest(test_targets[counter]); |
403 }.bind(this, i), | 403 }.bind(this, i), |
404 "executeTest-" + i); | 404 "executeTest-" + i); |
405 } | 405 } |
406 } | 406 } |
OLD | NEW |