summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/http/tests/misc/webtiming-buffer-full-no-event.html
blob: 1a077412834c491b7bf178a76a9eebd71ee887dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<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) {
    parameter = event;
    shouldBe('parameter.__proto__', 'Event.prototype');
    bufferFullCount++;
}

shouldBe('Performance.prototype.__proto__', 'EventTarget.prototype');

performance.webkitSetResourceTimingBufferSize(2);
shouldBeNull('performance.onwebkitresourcetimingbufferfull');
performance.addEventListener('webkitresourcetimingbufferfull', onBufferFull);
shouldBeNull('performance.onwebkitresourcetimingbufferfull');
</script>
</head>
<body>
<script>
function test() {
    // Make sure the onBufferFull callback was called exactly 1 time.
    shouldBe('bufferFullCount', '1');
    performance.removeEventListener('webkitresourcetimingbufferfull', onBufferFull);
    finishJSTest();
}

window.onload = test;
</script>
<script src="resources/empty-script.js"></script>
</body>
</html>