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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-cache.html

Issue 2159163002: Set Resource Timing transferSize field in Workers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@resource_timing_sizes_render_process
Patch Set: Rebase Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-cache-worker.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-cache.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-cache.html b/third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-cache.html
index 3e7088b90d6f023dee2857ff396958d333901e4e..f55b9b3a2162edaee633f363e26c9cadad832e6e 100644
--- a/third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-cache.html
+++ b/third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-cache.html
@@ -2,62 +2,4 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/misc/resources/run-async-tasks-promise.js"></script>
-<script>
-// The header bytes are expected to be > |minHeaderSize| and
-// < |maxHeaderSize|. If they are outside this range the test will fail.
-const minHeaderSize = 100;
-const maxHeaderSize = 1024;
-
-// The size of this resource must be > maxHeaderSize for the test to be
-// reliable.
-var url = new URL('/resources/square.png', location.href).href;
-const expectedSize = 18299;
-
-function checkBodySizeFields(entry, expectedSize) {
- assert_equals(entry.decodedBodySize, expectedSize, 'decodedBodySize');
- assert_equals(entry.encodedBodySize, expectedSize, 'encodedBodySize');
-}
-
-function checkResourceSizes() {
- var entries = performance.getEntriesByName(url);
- assert_equals(entries.length, 3, 'Wrong number of entries');
- var seenCount = 0;
- for (var entry of entries) {
- checkBodySizeFields(entry, expectedSize);
- if (seenCount === 0) {
- // 200 response
- assert_between_exclusive(entry.transferSize,
- expectedSize + minHeaderSize,
- expectedSize + maxHeaderSize,
- '200 transferSize');
- } else if (seenCount === 1) {
- // from cache
- assert_equals(entry.transferSize, 0, 'cached transferSize');
- } else if (seenCount === 2) {
- // 304 response
- assert_between_exclusive(entry.transferSize, minHeaderSize,
- maxHeaderSize, '304 transferSize');
- } else {
- assert_unreached('Too many matching entries');
- }
- ++seenCount;
- }
-}
-
-promise_test(() => {
- // Use a different URL every time so that the cache behaviour does not
- // depend on execution order.
- url = url + '?unique=' + Math.random().toString().substring(2);
- var eatBody = response => response.arrayBuffer();
- var mustRevalidate = {headers: {'Cache-Control': 'max-age=0'}};
- return fetch(url)
- .then(eatBody)
- .then(() => fetch(url))
- .then(eatBody)
- .then(() => fetch(url, mustRevalidate))
- .then(eatBody)
- .then(runAsyncTasks)
- .then(checkResourceSizes);
-}, 'PerformanceResourceTiming sizes caching test');
-
-</script>
+<script src="/misc/resources/resource-timing-sizes-cache.js"></script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-cache-worker.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698