OLD | NEW |
1 <!DOCTYPE html> | 1 // This test code is shared between resource-timing-sizes-cache.html and |
2 <script src="/resources/testharness.js"></script> | 2 // resource-timing-sizes-cache-worker.html |
3 <script src="/resources/testharnessreport.js"></script> | 3 |
4 <script src="/misc/resources/run-async-tasks-promise.js"></script> | 4 if (typeof document === 'undefined') { |
5 <script> | 5 importScripts('/resources/testharness.js', |
| 6 '/misc/resources/run-async-tasks-promise.js'); |
| 7 } |
| 8 |
6 // The header bytes are expected to be > |minHeaderSize| and | 9 // The header bytes are expected to be > |minHeaderSize| and |
7 // < |maxHeaderSize|. If they are outside this range the test will fail. | 10 // < |maxHeaderSize|. If they are outside this range the test will fail. |
8 const minHeaderSize = 100; | 11 const minHeaderSize = 100; |
9 const maxHeaderSize = 1024; | 12 const maxHeaderSize = 1024; |
10 | 13 |
11 // The size of this resource must be > maxHeaderSize for the test to be | 14 // The size of this resource must be > maxHeaderSize for the test to be |
12 // reliable. | 15 // reliable. |
13 var url = new URL('/resources/square.png', location.href).href; | 16 var url = new URL('/resources/square.png', location.href).href; |
14 const expectedSize = 18299; | 17 const expectedSize = 18299; |
15 | 18 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return fetch(url) | 56 return fetch(url) |
54 .then(eatBody) | 57 .then(eatBody) |
55 .then(() => fetch(url)) | 58 .then(() => fetch(url)) |
56 .then(eatBody) | 59 .then(eatBody) |
57 .then(() => fetch(url, mustRevalidate)) | 60 .then(() => fetch(url, mustRevalidate)) |
58 .then(eatBody) | 61 .then(eatBody) |
59 .then(runAsyncTasks) | 62 .then(runAsyncTasks) |
60 .then(checkResourceSizes); | 63 .then(checkResourceSizes); |
61 }, 'PerformanceResourceTiming sizes caching test'); | 64 }, 'PerformanceResourceTiming sizes caching test'); |
62 | 65 |
63 </script> | 66 done(); |
OLD | NEW |