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": 350, | 20 "hitCount": 50, |
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": 1000, | 28 "hitCount": 300, |
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, |
92 "startTime": 0, | 93 "startTime": 0, |
93 "endTime": 1.000 | 94 "endTime": 1.000 |
94 } | 95 } |
95 }; | 96 }; |
96 var view = new WebInspector.CPUProfileView(profileAndExpectations); | 97 var view = new WebInspector.CPUProfileView(profileAndExpectations); |
97 view.viewSelectComboBox.setSelectedIndex(1); | 98 view.viewSelectComboBox.setSelectedIndex(1); |
98 view._changeView(); | 99 view._changeView(); |
99 var tree = view.profileDataGridTree; | 100 var tree = view.profileDataGridTree; |
100 if (!tree) | 101 if (!tree) |
101 InspectorTest.addResult("no tree"); | 102 InspectorTest.addResult("no tree"); |
102 var node = tree.children[0]; | 103 var node = tree.children[0]; |
103 if (!node) | 104 if (!node) |
104 InspectorTest.addResult("no node"); | 105 InspectorTest.addResult("no node"); |
105 while (node) { | 106 while (node) { |
106 InspectorTest.addResult(node.callUID + ": " + node.functionName + " " +
node.selfTime + " " + node.totalTime + " " + node.element().textContent); | 107 InspectorTest.addResult(node.callUID + ": " + node.functionName + " " +
node.selfTime + " " + node.totalTime + " " + node.element().textContent); |
107 node = node.traverseNextNode(true, null, true); | 108 node = node.traverseNextNode(true, null, true); |
108 } | 109 } |
109 InspectorTest.completeProfilerTest(); | 110 InspectorTest.completeProfilerTest(); |
110 } | 111 } |
111 | 112 |
112 </script> | 113 </script> |
113 </head> | 114 </head> |
114 <body onload="runTest()"> | 115 <body onload="runTest()"> |
115 <p> | 116 <p> |
116 Tests bottom-up view self and total time calculation in CPU profiler. | 117 Tests bottom-up view self and total time calculation in CPU profiler. |
117 </p> | 118 </p> |
118 </body> | 119 </body> |
119 </html> | 120 </html> |
OLD | NEW |