blob: c377345b0a01cf265b682645ac29d6f5b8973d93 [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
<title>This test validates that resource timing implementations have a finite number of entries in their buffer.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
const t = async_test("Default resource timing entries buffer size");
const default_buffer_size = 250;
performance.onresourcetimingbufferfull = t.step_func_done(function() {
assert_equals(performance.getEntriesByType("resource").length, default_buffer_size);
});
window.onload = t.step_func(
function() {
// Scripts appended in JS to ensure setResourceTimingBufferSize is called before.
let counter = performance.getEntriesByType("resource").length;
const documentFragment = document.createDocumentFragment();
while (counter < default_buffer_size) {
const src = "../loading/resources/empty.js?" + counter;
const script = document.createElement('script');
script.type = 'text/javascript';
script.src = src;
documentFragment.appendChild(script);
++counter;
}
document.body.appendChild(documentFragment);
});
</script>
</body>
</html>