| Index: third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-redirect.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-redirect.html b/third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-redirect.html
|
| index 729ee3223f034a82c66699182047dd4c81d29ddc..b094b4b30cf1b99063a2e72ea850eda15b0f8252 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-redirect.html
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-redirect.html
|
| @@ -3,97 +3,4 @@
|
| <script src="/resources/testharnessreport.js"></script>
|
| <script src="/resources/get-host-info.js?pipe=sub"></script>
|
| <script src="/misc/resources/run-async-tasks-promise.js"></script>
|
| -<script>
|
| -const baseUrl =
|
| - new URL('/security/resources/cors-hello.php', location.href).href;
|
| -const expectedSize = 73;
|
| -
|
| -// Because apache decrements the Keep-Alive max value on each request, the
|
| -// transferSize will vary slightly between requests for the same resource.
|
| -const fuzzFactor = 3; // bytes
|
| -
|
| -const minHeaderSize = 100;
|
| -
|
| -const hostInfo = get_host_info();
|
| -
|
| -var directUrl, sameOriginRedirect, crossOriginRedirect, mixedRedirect;
|
| -var complexRedirect;
|
| -
|
| -function checkBodySizeFields(entry) {
|
| - assert_equals(entry.decodedBodySize, expectedSize, 'decodedBodySize');
|
| - assert_equals(entry.encodedBodySize, expectedSize, 'encodedBodySize');
|
| -}
|
| -
|
| -function checkResourceSizes() {
|
| - var entries = performance.getEntriesByType('resource');
|
| - var lowerBound, upperBound, withRedirectLowerBound;
|
| - var seenCount = 0;
|
| - for (var entry of entries) {
|
| - switch (entry.name) {
|
| - case directUrl:
|
| - checkBodySizeFields(entry);
|
| - assert_greater_than(entry.transferSize, expectedSize,
|
| - 'transferSize');
|
| - lowerBound = entry.transferSize - fuzzFactor;
|
| - upperBound = entry.transferSize + fuzzFactor;
|
| - withRedirectLowerBound = entry.transferSize + minHeaderSize;
|
| - ++seenCount;
|
| - break;
|
| -
|
| - case sameOriginRedirect:
|
| - checkBodySizeFields(entry);
|
| - assert_greater_than(entry.transferSize, withRedirectLowerBound,
|
| - 'transferSize');
|
| - ++seenCount;
|
| - break;
|
| -
|
| - case crossOriginRedirect:
|
| - case mixedRedirect:
|
| - case complexRedirect:
|
| - checkBodySizeFields(entry);
|
| - assert_between_exclusive(entry.transferSize, lowerBound, upperBound,
|
| - 'transferSize');
|
| - ++seenCount;
|
| - break;
|
| -
|
| - default:
|
| - break;
|
| - }
|
| - }
|
| - assert_equals(seenCount, 5, 'seenCount');
|
| -}
|
| -
|
| -function redirectUrl(redirectSourceOrigin, allowOrigin, targetUrl) {
|
| - return redirectSourceOrigin +
|
| - '/resources/redirect.php?cors_allow_origin=' +
|
| - encodeURIComponent(allowOrigin) +
|
| - '&url=' + encodeURIComponent(targetUrl);
|
| -}
|
| -
|
| -promise_test(() => {
|
| - // Use a different URL every time so that the cache behaviour does not
|
| - // depend on execution order.
|
| - directUrl = baseUrl + '?unique=' + Math.random().toString().substring(2) +
|
| - '&cors=*';
|
| - sameOriginRedirect = redirectUrl(hostInfo.HTTP_ORIGIN, '*', directUrl);
|
| - crossOriginRedirect = redirectUrl(hostInfo.HTTP_REMOTE_ORIGIN,
|
| - hostInfo.HTTP_ORIGIN, directUrl);
|
| - mixedRedirect = redirectUrl(hostInfo.HTTP_REMOTE_ORIGIN,
|
| - hostInfo.HTTP_ORIGIN, sameOriginRedirect);
|
| - complexRedirect = redirectUrl(hostInfo.HTTP_ORIGIN,
|
| - hostInfo.HTTP_REMOTE_ORIGIN, mixedRedirect);
|
| - var eatBody = response => response.arrayBuffer();
|
| - return fetch(directUrl)
|
| - .then(eatBody)
|
| - .then(() => fetch(sameOriginRedirect))
|
| - .then(eatBody)
|
| - .then(() => fetch(crossOriginRedirect))
|
| - .then(eatBody)
|
| - .then(() => fetch(mixedRedirect))
|
| - .then(eatBody)
|
| - .then(() => fetch(complexRedirect))
|
| - .then(eatBody)
|
| - .then(runAsyncTasks)
|
| - .then(checkResourceSizes);
|
| -}, 'PerformanceResourceTiming sizes Fetch with redirect test');
|
| -</script>
|
| +<script src="/misc/resources/resource-timing-sizes-redirect.js"></script>
|
|
|