OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
4 <script src="profiler-test.js"></script> | 4 <script src="profiler-test.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 function test() | 7 function test() |
8 { | 8 { |
9 var profileAndExpectations = { | 9 var profileAndExpectations = { |
10 "title": "profile1", | 10 "title": "profile1", |
11 "target": function() { | 11 "target": function() { |
12 return WebInspector.targetManager.targets()[0]; | 12 return WebInspector.targetManager.targets()[0]; |
13 }, | 13 }, |
14 "_profile": { | 14 "_profile": { |
15 "head": { | 15 "head": { |
16 "functionName": "(root)", | 16 "functionName": "(root)", |
17 "scriptId": "0", | 17 "scriptId": "0", |
18 "url": "a.js", | 18 "url": "a.js", |
19 "lineNumber": 0, | 19 "lineNumber": 0, |
20 "hitCount": 50, | 20 "hitCount": 350, |
21 "callUID": 1000, | 21 "callUID": 1000, |
22 "children": [ | 22 "children": [ |
23 { | 23 { |
24 "functionName": "(idle)", | 24 "functionName": "(idle)", |
25 "scriptId": "0", | 25 "scriptId": "0", |
26 "url": "a.js", | 26 "url": "a.js", |
27 "lineNumber": 1, | 27 "lineNumber": 1, |
28 "hitCount": 300, | 28 "hitCount": 1000, |
29 "callUID": 2, | 29 "callUID": 2, |
30 "children": [] | 30 "children": [] |
31 }, | 31 }, |
32 { | 32 { |
33 "functionName": "A", | 33 "functionName": "A", |
34 "scriptId": "0", | 34 "scriptId": "0", |
35 "url": "a.js", | 35 "url": "a.js", |
36 "lineNumber": 4642, | 36 "lineNumber": 4642, |
37 "hitCount": 250, | 37 "hitCount": 250, |
38 "callUID": 1001, | 38 "callUID": 1001, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 "hitCount": 30, | 82 "hitCount": 30, |
83 "callUID": 3000, | 83 "callUID": 3000, |
84 "children": [] | 84 "children": [] |
85 } | 85 } |
86 ] | 86 ] |
87 } | 87 } |
88 ] | 88 ] |
89 } | 89 } |
90 ] | 90 ] |
91 }, | 91 }, |
92 "idleTime": 0.300, | |
93 "startTime": 0, | 92 "startTime": 0, |
94 "endTime": 1.000 | 93 "endTime": 1.000 |
95 } | 94 } |
96 }; | 95 }; |
97 var view = new WebInspector.CPUProfileView(profileAndExpectations); | 96 var view = new WebInspector.CPUProfileView(profileAndExpectations); |
98 view.viewSelectComboBox.setSelectedIndex(1); | 97 view.viewSelectComboBox.setSelectedIndex(1); |
99 view._changeView(); | 98 view._changeView(); |
100 var tree = view.profileDataGridTree; | 99 var tree = view.profileDataGridTree; |
101 if (!tree) | 100 if (!tree) |
102 InspectorTest.addResult("no tree"); | 101 InspectorTest.addResult("no tree"); |
103 var node = tree.children[0]; | 102 var node = tree.children[0]; |
104 if (!node) | 103 if (!node) |
105 InspectorTest.addResult("no node"); | 104 InspectorTest.addResult("no node"); |
106 while (node) { | 105 while (node) { |
107 InspectorTest.addResult(node.callUID + ": " + node.functionName + " " +
node.selfTime + " " + node.totalTime + " " + node.element().textContent); | 106 InspectorTest.addResult(node.callUID + ": " + node.functionName + " " +
node.selfTime + " " + node.totalTime + " " + node.element().textContent); |
108 node = node.traverseNextNode(true, null, true); | 107 node = node.traverseNextNode(true, null, true); |
109 } | 108 } |
110 InspectorTest.completeProfilerTest(); | 109 InspectorTest.completeProfilerTest(); |
111 } | 110 } |
112 | 111 |
113 </script> | 112 </script> |
114 </head> | 113 </head> |
115 <body onload="runTest()"> | 114 <body onload="runTest()"> |
116 <p> | 115 <p> |
117 Tests bottom-up view self and total time calculation in CPU profiler. | 116 Tests bottom-up view self and total time calculation in CPU profiler. |
118 </p> | 117 </p> |
119 </body> | 118 </body> |
120 </html> | 119 </html> |
OLD | NEW |