OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
4 <script src="../../http/tests/inspector/debugger-test.js"></script> | |
5 <script src="resources/timeline-data.js"></script> | |
6 <script> | |
7 function test() | |
8 { | |
9 var cpuProfile = { | |
10 startTime: 10, | |
11 endTime: 20, | |
12 head: { | |
13 functionName: "(root)", | |
14 hitCount: 0, | |
15 children: [ | |
16 { | |
17 functionName: "foo1", | |
18 hitCount: 100, | |
19 positionTicks: [{line:1, ticks:10}, {line:2, ticks:20}, {lin
e:3, ticks:30}, {line:4, ticks:40}], | |
20 children: [] | |
21 }, | |
22 { | |
23 functionName: "foo2", | |
24 hitCount: 200, | |
25 positionTicks: [{line:100, ticks:1}, {line:102, ticks:190}], | |
26 children: [] | |
27 }, | |
28 { | |
29 functionName: "null", | |
30 hitCount: 0, | |
31 positionTicks: [], | |
32 children: [ | |
33 { | |
34 functionName: "bar", | |
35 hitCount: 300, | |
36 positionTicks: [{line:55, ticks:22}], | |
37 children: [] | |
38 }, | |
39 { | |
40 functionName: "baz", | |
41 hitCount: 400, | |
42 // no positionTicks for the node. | |
43 children: [] | |
44 } | |
45 ] | |
46 } | |
47 ] | |
48 } | |
49 }; | |
50 | |
51 InspectorTest.addSniffer(WebInspector.CodeMirrorTextEditor.prototype, "setGu
tterDecoration", decorationAdded, true); | |
52 InspectorTest.showScriptSource("timeline-data.js", frameRevealed); | |
53 | |
54 function decorationAdded(line, type, element) | |
55 { | |
56 InspectorTest.addResult(`${line} ${type} ${element.textContent} ${elemen
t.style.backgroundColor}`); | |
57 } | |
58 | |
59 function setUrls(url, node) | |
60 { | |
61 node.url = url; | |
62 node.children.forEach(setUrls.bind(null, url)); | |
63 } | |
64 | |
65 function frameRevealed(frame) | |
66 { | |
67 var url = frame.uiSourceCode().url(); | |
68 InspectorTest.addResult(InspectorTest.formatters.formatAsURL(url)); | |
69 setUrls(url, cpuProfile.head); | |
70 var lineProfile = new WebInspector.LineLevelProfile.instance(); | |
71 lineProfile.appendCPUProfile(new WebInspector.CPUProfileDataModel(cpuPro
file)); | |
72 setTimeout(() => InspectorTest.completeTest(), 0); | |
73 } | |
74 } | |
75 | |
76 </script> | |
77 </head> | |
78 <body onload="runTest()"> | |
79 Tests that a line-level CPU profile is shown in the text editor. | |
80 </body> | |
81 </html> | |
OLD | NEW |