OLD | NEW |
1 <!DOCTYPE html> | 1 // This test code is shared between resource-timing-sizes-cors-preflight.html |
2 <script src="/resources/testharness.js"></script> | 2 // and resource-timing-sizes-cors-preflight-worker.html |
3 <script src="/resources/testharnessreport.js"></script> | 3 |
4 <script src="/resources/get-host-info.js?pipe=sub"></script> | 4 if (typeof document === 'undefined') { |
5 <script src="/misc/resources/run-async-tasks-promise.js"></script> | 5 importScripts('/resources/testharness.js', |
6 <script> | 6 '/resources/get-host-info.js?pipe=sub', |
| 7 '/misc/resources/run-async-tasks-promise.js'); |
| 8 } |
| 9 |
7 // Because apache decrements the Keep-Alive max value on each request, the | 10 // Because apache decrements the Keep-Alive max value on each request, the |
8 // transferSize will vary slightly between requests for the same resource. | 11 // transferSize will vary slightly between requests for the same resource. |
9 const fuzzFactor = 3; // bytes | 12 const fuzzFactor = 3; // bytes |
10 | 13 |
11 const hostInfo = get_host_info(); | 14 const hostInfo = get_host_info(); |
12 const url = new URL('/misc/resources/cors-preflight.php', | 15 const url = new URL('/misc/resources/cors-preflight.php', |
13 hostInfo['HTTP_REMOTE_ORIGIN']).href; | 16 hostInfo['HTTP_REMOTE_ORIGIN']).href; |
14 | 17 |
15 // The header bytes are expected to be > |minHeaderSize| and | 18 // The header bytes are expected to be > |minHeaderSize| and |
16 // < |maxHeaderSize|. If they are outside this range the test will fail. | 19 // < |maxHeaderSize|. If they are outside this range the test will fail. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 promise_test(() => { | 56 promise_test(() => { |
54 var eatBody = response => response.arrayBuffer(); | 57 var eatBody = response => response.arrayBuffer(); |
55 var requirePreflight = {headers: {'X-Require-Preflight': '1'}}; | 58 var requirePreflight = {headers: {'X-Require-Preflight': '1'}}; |
56 return fetch(url) | 59 return fetch(url) |
57 .then(eatBody) | 60 .then(eatBody) |
58 .then(() => fetch(url, requirePreflight)) | 61 .then(() => fetch(url, requirePreflight)) |
59 .then(eatBody) | 62 .then(eatBody) |
60 .then(runAsyncTasks) | 63 .then(runAsyncTasks) |
61 .then(checkResourceSizes); | 64 .then(checkResourceSizes); |
62 }, 'PerformanceResourceTiming sizes Fetch with preflight test'); | 65 }, 'PerformanceResourceTiming sizes Fetch with preflight test'); |
63 </script> | 66 |
| 67 done(); |
OLD | NEW |