Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / styles / updates-throttled.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/elements-test.js"></script>
5 <script>
6
7 function test()
8 {
9     var UPDATE_COUNT = 5;
10     var rebuildCount = 0;
11     WebInspector.showPanel("elements");
12
13     InspectorTest.selectNodeAndWaitForStyles("inspected", selectCallback);
14     function selectCallback()
15     {
16         InspectorTest.addSniffer(WebInspector.StylesSidebarPane.prototype, "_innerRebuildUpdate", sniffRebuild, true);
17         var stylesPane = WebInspector.panels.elements.sidebarPanes.styles;
18         for (var i = 0; i < UPDATE_COUNT; ++i)
19             stylesPane.update(stylesPane.node, true);
20
21         InspectorTest.runAfterPendingDispatches(completeCallback);
22     }
23
24     function completeCallback()
25     {
26         if (rebuildCount >= UPDATE_COUNT)
27             InspectorTest.addResult("ERROR: got " + rebuildCount + " rebuilds for " + UPDATE_COUNT + " consecutive updates");
28         else
29             InspectorTest.addResult("OK: rebuilds throttled");
30         InspectorTest.completeTest();
31     }
32
33     function sniffRebuild()
34     {
35         ++rebuildCount;
36     }
37 }
38
39 </script>
40 </head>
41
42 <body onload="runTest()">
43 <p>
44 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>.
45 </p>
46
47 <div id="inspected"></div>
48
49 </body>
50 </html>