3 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"heap-snapshot-test.js"></script>
9 var instanceCount
= 200;
10 function createHeapSnapshot()
12 return InspectorTest
.createHeapSnapshot(instanceCount
, 100);
15 InspectorTest
.runHeapSnapshotTestSuite([
16 function testSearch(next
)
18 InspectorTest
.takeAndOpenSnapshot(createHeapSnapshot
, step1
);
22 InspectorTest
.switchToView("Summary", step1
);
26 function addNodeSelectSniffer(constructorName
, nodeId
, onSuccess
)
28 InspectorTest
.addSniffer(view
, "_selectRevealedNode", checkNodeIsSelected
.bind(view
, constructorName
, nodeId
, onSuccess
));
33 view
= InspectorTest
.currentProfileView();
34 InspectorTest
.addSniffer(view
, "_selectRevealedNode", step2
);
35 view
.performSearch({query
: "@1", caseSensitive
: false});
38 function step2(callback
, node
)
41 InspectorTest
.addResult("FAIL: hidden node @1 was found");
44 InspectorTest
.addResult("PASS: hidden node @1 was not found.")
45 view
= InspectorTest
.currentProfileView();
46 addNodeSelectSniffer("A", "101", step3
);
47 view
.performSearch({query
:"@101", caseSensitive
: false});
52 view
.performSearch({query
: "@a", caseSensitive
: false});
53 if (view
._searchResults
.length
!== 0) {
54 InspectorTest
.addResult("FAIL: node @a found");
57 InspectorTest
.addResult("PASS: node @a was not found");
58 InspectorTest
.addSniffer(view
, "_selectRevealedNode", step5
);
59 view
.performSearch({query
: "@999", caseSensitive
: false}, step5
);
65 InspectorTest
.addResult("FAIL: found node @999");
68 InspectorTest
.addResult("PASS: node @999 was not found");
69 addNodeSelectSniffer("B", "100", step6
);
70 view
.performSearch({query
: "@100", caseSensitive
: false});
75 addNodeSelectSniffer("B", "400", step7
);
76 view
.performSearch({query
: "@400", caseSensitive
: false});
81 addNodeSelectSniffer("A", "401", next
);
82 view
.performSearch({query
: "@401", caseSensitive
: false});
85 function checkNodeIsSelected(constructorName
, nodeId
, onSuccess
, node
)
88 InspectorTest
.addResult("FAIL: node @" + nodeId
+ " not found");
91 if (constructorName
!== node
.parent
._name
) {
92 InspectorTest
.addResult("FAIL: constructor name doesn't match. " + constructorName
+ " !== " + node
.parent
._name
);
95 if (nodeId
!= node
.snapshotNodeId
) {
96 InspectorTest
.addResult("FAIL: snapshot node id doesn't match. " + nodeId
+ " !== " + node
.snapshotNodeId
);
99 InspectorTest
.addResult("PASS: found node @" + nodeId
+ " with class '" + constructorName
+ "'");
108 <body onload=
"runTest()">
110 Tests search in Summary view of detailed heap snapshots.