OLD | NEW |
| (Empty) |
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-test.js"></script> | |
6 <style> | |
7 #first { | |
8 color: blue; | |
9 } | |
10 | |
11 #second { | |
12 line-height: 1em; | |
13 border: 1px solid black; | |
14 } | |
15 | |
16 #third { | |
17 margin: 1px 1px 0 0; | |
18 padding: 10px; | |
19 background-color: blue; | |
20 border: 1px solid black; | |
21 } | |
22 </style> | |
23 <script> | |
24 function test() | |
25 { | |
26 var initialLiveLocationsCount; | |
27 InspectorTest.runTestSuite([ | |
28 function selectInitialNode(next) | |
29 { | |
30 InspectorTest.selectNodeAndWaitForStylesWithComputed("first", next); | |
31 }, | |
32 | |
33 function saveInitialLiveLocationsCount(next) | |
34 { | |
35 initialLiveLocationsCount = countLiveLocations(); | |
36 next(); | |
37 }, | |
38 | |
39 function rebuildStylesSidebarPaneMultipleTimes(next) | |
40 { | |
41 var elementsToSelect = ["second", "third", "second", "first", "third
", "first"]; | |
42 function loopThroughElements() | |
43 { | |
44 if (!elementsToSelect.length) { | |
45 next(); | |
46 return; | |
47 } | |
48 InspectorTest.selectNodeAndWaitForStylesWithComputed(elementsToS
elect.shift(), loopThroughElements); | |
49 } | |
50 loopThroughElements(); | |
51 }, | |
52 | |
53 function compareLiveLocationsCount(next) | |
54 { | |
55 var liveLocationsCount = countLiveLocations(); | |
56 if (liveLocationsCount !== initialLiveLocationsCount) | |
57 InspectorTest.addResult(String.sprintf("ERROR: LiveLocations cou
nt is growing! Expected: %d found: %d", initialLiveLocationsCount, liveLocations
Count)); | |
58 else | |
59 InspectorTest.addResult("SUCCESS: LiveLocations count do not gro
w."); | |
60 next(); | |
61 } | |
62 ]); | |
63 | |
64 function countLiveLocations() | |
65 { | |
66 var locationsCount = 0; | |
67 var targetInfos = WebInspector.cssWorkspaceBinding._modelToTargetInfo.va
luesArray(); | |
68 for (var targetInfo of targetInfos) { | |
69 var headerInfos = targetInfo._headerInfoById.valuesArray(); | |
70 for (var headerInfo of headerInfos) | |
71 locationsCount += headerInfo._locations.size; | |
72 } | |
73 return locationsCount; | |
74 } | |
75 } | |
76 | |
77 </script> | |
78 | |
79 </head> | |
80 | |
81 <body onload="runTest()"> | |
82 | |
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> | |
OLD | NEW |