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 "nodes": [ | 15 "nodes": [ |
16 { | 16 { |
17 "id": 0, | 17 "id": 0, |
18 "callFrame": | 18 "callFrame": |
19 { | 19 { |
20 "functionName": "(root)", | 20 "functionName": "(root)", |
21 "scriptId": "0", | 21 "scriptId": "0", |
22 "url": "a.js", | 22 "url": "a.js", |
23 "lineNumber": 0 | 23 "lineNumber": 0 |
24 }, | 24 }, |
25 "hitCount": 350, | 25 "hitCount": 350 |
26 "children": [1, 2, 5] | |
27 }, | 26 }, |
28 { | 27 { |
29 "id": 1, | 28 "id": 1, |
30 "callFrame": | 29 "callFrame": |
31 { | 30 { |
32 "functionName": "(idle)", | 31 "functionName": "(idle)", |
33 "scriptId": "0", | 32 "scriptId": "0", |
34 "url": "a.js", | 33 "url": "a.js", |
35 "lineNumber": 1 | 34 "lineNumber": 1 |
36 }, | 35 }, |
37 "hitCount": 1000, | 36 "hitCount": 1000, |
38 "children": [] | 37 "parent": 0 |
39 }, | 38 }, |
40 { | 39 { |
41 "id": 2, | 40 "id": 2, |
42 "callFrame": | 41 "callFrame": |
43 { | 42 { |
44 "functionName": "A", | 43 "functionName": "A", |
45 "scriptId": "0", | 44 "scriptId": "0", |
46 "url": "a.js", | 45 "url": "a.js", |
47 "lineNumber": 4642 | 46 "lineNumber": 4642 |
48 }, | 47 }, |
49 "hitCount": 250, | 48 "hitCount": 250, |
50 "children": [3] | 49 "parent": 0 |
51 }, | 50 }, |
52 { | 51 { |
53 "id": 3, | 52 "id": 3, |
54 "callFrame": | 53 "callFrame": |
55 { | 54 { |
56 "functionName": "C", | 55 "functionName": "C", |
57 "scriptId": "0", | 56 "scriptId": "0", |
58 "url": "a.js", | 57 "url": "a.js", |
59 "lineNumber": 525 | 58 "lineNumber": 525 |
60 }, | 59 }, |
61 "hitCount": 100, | 60 "hitCount": 100, |
62 "children": [4] | 61 "parent": 2 |
63 }, | 62 }, |
64 { | 63 { |
65 "id": 4, | 64 "id": 4, |
66 "callFrame": | 65 "callFrame": |
67 { | 66 { |
68 "functionName": "D", | 67 "functionName": "D", |
69 "scriptId": "0", | 68 "scriptId": "0", |
70 "url": "a.js", | 69 "url": "a.js", |
71 "lineNumber": 425 | 70 "lineNumber": 425 |
72 }, | 71 }, |
73 "hitCount": 20, | 72 "hitCount": 20, |
74 "children": [] | 73 "parent": 3 |
75 }, | 74 }, |
76 { | 75 { |
77 "id": 5, | 76 "id": 5, |
78 "callFrame": | 77 "callFrame": |
79 { | 78 { |
80 "functionName": "B", | 79 "functionName": "B", |
81 "scriptId": "0", | 80 "scriptId": "0", |
82 "url": "a.js", | 81 "url": "a.js", |
83 "lineNumber": 4662 | 82 "lineNumber": 4662 |
84 }, | 83 }, |
85 "hitCount": 150, | 84 "hitCount": 150, |
86 "children": [6] | 85 "parent": 0 |
87 }, | 86 }, |
88 { | 87 { |
89 "id": 6, | 88 "id": 6, |
90 "callFrame": | 89 "callFrame": |
91 { | 90 { |
92 "functionName": "C", | 91 "functionName": "C", |
93 "scriptId": "0", | 92 "scriptId": "0", |
94 "url": "a.js", | 93 "url": "a.js", |
95 "lineNumber": 525 | 94 "lineNumber": 525 |
96 }, | 95 }, |
97 "hitCount": 100, | 96 "hitCount": 100, |
98 "children": [7] | 97 "parent": 5 |
99 }, | 98 }, |
100 { | 99 { |
101 "id": 7, | 100 "id": 7, |
102 "callFrame": | 101 "callFrame": |
103 { | 102 { |
104 "functionName": "D", | 103 "functionName": "D", |
105 "scriptId": "0", | 104 "scriptId": "0", |
106 "url": "a.js", | 105 "url": "a.js", |
107 "lineNumber": 425 | 106 "lineNumber": 425 |
108 }, | 107 }, |
109 "hitCount": 30, | 108 "hitCount": 30, |
110 "children": [] | 109 "parent": 6 |
111 } | 110 } |
112 ], | 111 ], |
113 "startTime": 0, | 112 "startTime": 0, |
114 "endTime": 1e6 | 113 "endTime": 1e6 |
115 } | 114 } |
116 }; | 115 }; |
117 var view = new WebInspector.CPUProfileView(profileAndExpectations); | 116 var view = new WebInspector.CPUProfileView(profileAndExpectations); |
118 view.viewSelectComboBox.setSelectedIndex(1); | 117 view.viewSelectComboBox.setSelectedIndex(1); |
119 view._changeView(); | 118 view._changeView(); |
120 var tree = view.profileDataGridTree; | 119 var tree = view.profileDataGridTree; |
(...skipping 10 matching lines...) Expand all Loading... |
131 } | 130 } |
132 | 131 |
133 </script> | 132 </script> |
134 </head> | 133 </head> |
135 <body onload="runTest()"> | 134 <body onload="runTest()"> |
136 <p> | 135 <p> |
137 Tests bottom-up view self and total time calculation in CPU profiler. | 136 Tests bottom-up view self and total time calculation in CPU profiler. |
138 </p> | 137 </p> |
139 </body> | 138 </body> |
140 </html> | 139 </html> |
OLD | NEW |