blob: 778ed5640b147d796deee94019b0ba7a897f3417 [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="../../http/tests/inspector/timeline-test.js"></script>
<script>
function display()
{
if (window.testRunner)
testRunner.display();
}
function updateSubframeAndDisplay()
{
frames[0].document.body.children[0].style.backgroundColor = "green";
if (window.testRunner)
testRunner.displayInvalidatedRegion();
}
function test()
{
step1();
function step1()
{
InspectorTest.evaluateWithTimeline("display()", step2);
}
function step2(records)
{
for (var i = 0; i < records.length; ++i) {
var record = records[i];
if (record.type === WebInspector.TimelineModel.RecordType.Paint) {
InspectorTest.printTimelineRecordProperties(record);
break;
}
}
InspectorTest.evaluateWithTimeline("updateSubframeAndDisplay()", step3);
}
function step3(records)
{
var paintRecord;
for (var i = 0; i < records.length; ++i) {
var record = records[i];
if (record.type === WebInspector.TimelineModel.RecordType.Paint && record.children && record.children.length) {
paintRecord = record;
break;
}
}
InspectorTest.assertTrue(paintRecord, "Paint record with subframe paint not found");
var topQuad = paintRecord.data.clip;
var subframePaint = paintRecord.children[0];
var subframeQuad = subframePaint.data.clip;
InspectorTest.assertEquals(8, topQuad.length);
InspectorTest.assertEquals(8, subframeQuad.length);
InspectorTest.assertGreaterOrEqual(subframeQuad[0], topQuad[0]);
InspectorTest.assertGreaterOrEqual(subframeQuad[1], topQuad[1]);
InspectorTest.assertGreaterOrEqual(topQuad[2], subframeQuad[2]);
InspectorTest.assertGreaterOrEqual(subframeQuad[3], topQuad[3]);
InspectorTest.assertGreaterOrEqual(topQuad[4], subframeQuad[4]);
InspectorTest.assertGreaterOrEqual(topQuad[5], subframeQuad[5]);
InspectorTest.assertGreaterOrEqual(subframeQuad[6], topQuad[6]);
InspectorTest.assertGreaterOrEqual(topQuad[7], subframeQuad[7]);
InspectorTest.completeTest();
}
}
</script>
</head>
<body onload="runTest()">
<p>
Tests the Timeline API instrumentation of a paint event
</p>
<iframe src="resources/timeline-iframe-paint.html" style="position: absolute; left: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe>
</body>
</html>