summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/resource-timing/resources/sizes-helper.js
blob: 86336686b32902ec1c123b0f55ff67e9aba43062 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Header size is a fixed constant.
// https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-transfersize
const headerSize = 300;

const cacheBustUrl = url => {
  return url + '&unique=' + Math.random().toString().substring(2);
}

const checkSizeFields = (entry, bodySize, transferSize) => {
  assert_equals(entry.decodedBodySize, bodySize,
                'decodedBodySize');
  assert_equals(entry.encodedBodySize, bodySize,
                'encodedBodySize');
  assert_equals(entry.transferSize, transferSize,
                'transferSize');
}