Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / elements / styles-4 / styles-live-locations-leak.html
blob30ab9f066a1b5d7c9e93b85b533d5b25a3a037fe
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 src="../styles/styles-test.js"></script>
6 <style>
7 #first {
8 color: blue;
11 #second {
12 line-height: 1em;
13 border: 1px solid black;
16 #third {
17 margin: 1px 1px 0 0;
18 padding: 10px;
19 background-color: blue;
20 border: 1px solid black;
22 </style>
23 <script>
24 function test()
26 var initialLiveLocationsCount;
27 InspectorTest.runTestSuite([
28 function selectInitialNode(next)
30 InspectorTest.selectNodeAndWaitForStylesWithComputed("first", next);
33 function saveInitialLiveLocationsCount(next)
35 initialLiveLocationsCount = countLiveLocations();
36 next();
39 function rebuildStylesSidebarPaneMultipleTimes(next)
41 var elementsToSelect = ["second", "third", "second", "first", "third", "first"];
42 function loopThroughElements()
44 if (!elementsToSelect.length) {
45 next();
46 return;
48 InspectorTest.selectNodeAndWaitForStylesWithComputed(elementsToSelect.shift(), loopThroughElements);
50 loopThroughElements();
53 function compareLiveLocationsCount(next)
55 var liveLocationsCount = countLiveLocations();
56 if (liveLocationsCount !== initialLiveLocationsCount)
57 InspectorTest.addResult(String.sprintf("ERROR: LiveLocations count is growing! Expected: %d found: %d", initialLiveLocationsCount, liveLocationsCount));
58 else
59 InspectorTest.addResult("SUCCESS: LiveLocations count do not grow.");
60 next();
62 ]);
64 function countLiveLocations()
66 var locationsCount = 0;
67 var targetInfos = WebInspector.cssWorkspaceBinding._modelToTargetInfo.valuesArray();
68 for (var targetInfo of targetInfos) {
69 var headerInfos = targetInfo._headerInfoById.valuesArray();
70 for (var headerInfo of headerInfos)
71 locationsCount += headerInfo._locations.size;
73 return locationsCount;
77 </script>
79 </head>
81 <body onload="runTest()">
83 <p>
84 Tests that styles sidebar pane does not leak any LiveLocations.
85 </p>
86 <div id="first">First element to select</div>
87 <div id="second">Second element to select</div>
88 <div id="third">Second element to select</div>
89 </body>
90 </html>