gecko/layout/base/tests/test_mozPaintCount.html

48 lines
1.3 KiB
HTML
Raw Normal View History

<!DOCTYPE HTML>
<html>
<head>
<title>Tests for mozPaintCount</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="doFlicker()">
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
var startPaintCount = window.mozPaintCount;
ok(true, "Got to initial paint count: " + startPaintCount);
var color = 0;
function doFlicker() {
ok(true, "Iteration " + color + ", paint count: " + window.mozPaintCount);
if (window.mozPaintCount - startPaintCount > 20) {
ok(true, "Got enough paints");
SimpleTest.finish();
return;
}
color = (color + 1) % 256;
document.body.style.backgroundColor = "rgb(" + color + "," + color + "," + color + ")";
setTimeout(doFlicker, 0);
}
</script>
</pre>
<div style="height:4000px"></div>
<a id="first" href="http://www.mozilla.org/">first<br>link</a>
<a id="second" href="http://www.mozilla.org/">second link</a>
<a id="third" href="http://www.mozilla.org/">third<br>link</a>
<div style="height:4000px"></div>
</body>
</html>