blob: a36a8dd4f8f8acfcd40f88f2939919740b1fd0d5 [file] [log] [blame]
<html>
<head>
<link rel="help" href="https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html#extensions-performance-interface">
<script src="/js-test-resources/js-test.js"></script>
<script>
description("This test checks that Performance inherits EventTarget and that addEventListener() works for resourcetimingbufferfull events.");
window.jsTestIsAsync = true;
var bufferFullCount = 0;
var parameter;
function onBufferFull(event) {
shouldBeNull('performance.onresourcetimingbufferfull');
parameter = event;
shouldBe('parameter.__proto__', 'Event.prototype');
bufferFullCount++;
}
shouldBe('Performance.prototype.__proto__', 'EventTarget.prototype');
performance.addEventListener('resourcetimingbufferfull', onBufferFull);
shouldBeNull('performance.onresourcetimingbufferfull');
performance.setResourceTimingBufferSize(2);
</script>
</head>
<body>
<script>
function test() {
// Make sure the onBufferFull callback was called exactly 1 time.
shouldBe('bufferFullCount', '1');
performance.removeEventListener('resourcetimingbufferfull', onBufferFull);
finishJSTest();
}
window.onload = test;
</script>
<script src="resources/empty-script.js"></script>
</body>
</html>