Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / styles / updates-during-dom-traversal.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 updateCount = 0;
10     var keydownCount = 5;
11     WebInspector.showPanel("elements");
12
13     InspectorTest.selectNodeAndWaitForStyles("inspected", selectCallback);
14     function selectCallback()
15     {
16         InspectorTest.addSniffer(WebInspector.StylesSidebarPane.prototype, "_innerRebuildUpdate", sniffUpdate, true);
17         var element = WebInspector.panels.elements.treeOutline.element;
18         for (var i = 0; i < keydownCount; ++i)
19             element.dispatchEvent(InspectorTest.createKeyEvent("Up"));
20
21         InspectorTest.runAfterPendingDispatches(completeCallback);
22     }
23
24     function completeCallback()
25     {
26         if (updateCount >= keydownCount)
27             InspectorTest.addResult("ERROR: got " + updateCount + " updates for " + keydownCount + " consecutive keydowns");
28         else
29             InspectorTest.addResult("OK: updates throttled");
30         InspectorTest.completeTest();
31     }
32
33     function sniffUpdate()
34     {
35         ++updateCount;
36     }
37 }
38
39 </script>
40 </head>
41
42 <body onload="runTest()">
43 <p>
44 Tests that style updates are throttled during DOM traversal. <a href="https://bugs.webkit.org/show_bug.cgi?id=77643">Bug 77643</a>.
45 </p>
46
47 <div></div>
48 <div></div>
49 <div></div>
50 <div></div>
51 <div></div>
52 <div id="inspected"></div>
53
54 </body>
55 </html>