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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/misc/resource-timing-sizes-content-encoding.html

Issue 2045183002: [DO NOT SUBMIT] [OBSOLETE] Add layout tests for ResourceTiming sizes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move PHP files to /misc/resources and factor out and rename runLoop(). 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="/resources/testharness.js"></script>
3 <script src="/resources/testharnessreport.js"></script>
4 <script src="/resources/get-host-info.js?pipe=sub"></script>
5 <script src="/misc/resources/run-async-tasks-promise.js"></script>
6 <script>
7 const url = '/misc/resources/gzip-content-encoding.php';
8 const uncompressedSize = 1250;
9
10 var seenCount = 0;
11
12 function checkResourceSizes() {
13 var entries = performance.getEntriesByType('resource');
14 var absoluteUrl = new URL(url, location.href).href;
15 for (var entry of entries) {
16 if (entry.name === absoluteUrl) {
17 assert_between_exclusive(entry.encodedBodySize, 0, uncompressedSize,
18 'encodedBodySize');
19 assert_equals(entry.decodedBodySize, uncompressedSize);
20 ++seenCount;
21 }
22 }
23 assert_equals(seenCount, 2, 'seenCount');
24 }
25
26 promise_test(() => {
27 // Fetch twice to ensure at least one fetch comes from the cache.
28 var eatBody = response => response.arrayBuffer();
29 return fetch(url)
30 .then(eatBody)
31 .then(() => fetch(url))
32 .then(eatBody)
33 .then(runAsyncTasks)
34 .then(checkResourceSizes);
35 }, 'PerformanceResourceTiming sizes compressed content test');
36 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698