blob: 0ca4bf29f24bf113e87b4f944457a5f3d1c78deb [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="../../http/tests/inspector/elements-test.js"></script>
<script>
function test()
{
var UPDATE_COUNT = 5;
var rebuildCount = 0;
WebInspector.showPanel("elements");
InspectorTest.selectNodeAndWaitForStyles("inspected", selectCallback);
function selectCallback()
{
InspectorTest.addSniffer(WebInspector.StylesSidebarPane.prototype, "_innerRebuildUpdate", sniffRebuild, true);
var stylesPane = WebInspector.panels.elements.sidebarPanes.styles;
for (var i = 0; i < UPDATE_COUNT; ++i)
stylesPane.update(stylesPane.node, true);
InspectorTest.runAfterPendingDispatches(completeCallback);
}
function completeCallback()
{
if (rebuildCount >= UPDATE_COUNT)
InspectorTest.addResult("ERROR: got " + rebuildCount + " rebuilds for " + UPDATE_COUNT + " consecutive updates");
else
InspectorTest.addResult("OK: rebuilds throttled");
InspectorTest.completeTest();
}
function sniffRebuild()
{
++rebuildCount;
}
}
</script>
</head>
<body onload="runTest()">
<p>
Tests that Styles sidebar DOM rebuilds are throttled during consecutive updates. <a href="https://bugs.webkit.org/show_bug.cgi?id=78086">Bug 78086</a>.
</p>
<div id="inspected"></div>
</body>
</html>