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 pageFunction() { | 7 function pageFunction() { |
8 console.profile("p1"); | 8 console.profile("p1"); |
9 console.profileEnd("p1"); | 9 console.profileEnd("p1"); |
10 console.profile("p1"); | 10 console.profile("p1"); |
11 console.profileEnd("p1"); | 11 console.profileEnd("p1"); |
12 console.profile("p2"); | 12 console.profile("p2"); |
13 console.profileEnd("p2"); | 13 console.profileEnd("p2"); |
14 } | 14 } |
15 | 15 |
16 function test() | 16 function test() |
17 { | 17 { |
18 InspectorTest.startProfilerTest(function() { | 18 InspectorTest.startProfilerTest(function() { |
19 function viewLoaded(view) { | 19 function viewLoaded() { |
20 var profiles = WebInspector.panels.profiles; | 20 var profiles = WebInspector.panels.profiles; |
21 var type = WebInspector.ProfileTypeRegistry.instance.cpuProfileType; | 21 var type = WebInspector.ProfileTypeRegistry.instance.cpuProfileType; |
22 while (type.getProfiles().length !== 0) | 22 while (type.getProfiles().length !== 0) |
23 type.removeProfile(type.getProfiles()[0]); | 23 type.removeProfile(type.getProfiles()[0]); |
24 InspectorTest.addResult("Profile groups after removal:"); | 24 InspectorTest.addResult("Profile groups after removal:"); |
25 for (var key in profiles._profileGroups) | 25 for (var key in profiles._profileGroups) |
26 InspectorTest.addResult(key + ": " + profiles._profileGroups[key
].length); | 26 InspectorTest.addResult(key + ": " + profiles._profileGroups[key
].length); |
27 var section = profiles._typeIdToSidebarSection[type.id]; | 27 var section = profiles._typeIdToSidebarSection[type.id]; |
28 InspectorTest.assertEquals(0, section.children.length, "All children
has been removed"); | 28 InspectorTest.assertEquals(0, section.children.length, "All children
has been removed"); |
29 InspectorTest.completeProfilerTest(); | 29 InspectorTest.completeProfilerTest(); |
30 } | 30 } |
31 WebInspector.inspectorView.showPanel("profiles"); | 31 WebInspector.inspectorView.showPanel("profiles"); |
32 InspectorTest.evaluateInConsole("pageFunction()", function() {}); | 32 InspectorTest.evaluateInConsole("pageFunction()", function() {}); |
33 InspectorTest.showProfileWhenAdded("p2"); | 33 InspectorTest.showProfileWhenAdded("p2"); |
34 InspectorTest.waitUntilProfileViewIsShown("p2", viewLoaded); | 34 InspectorTest.waitUntilProfileViewIsShown("p2", setTimeout.bind(null, vi
ewLoaded, 0)); |
35 }); | 35 }); |
36 } | 36 } |
37 | 37 |
38 </script> | 38 </script> |
39 </head> | 39 </head> |
40 <body onload="runTest()"> | 40 <body onload="runTest()"> |
41 <p> | 41 <p> |
42 Tests that CPU profile removal from a group works. | 42 Tests that CPU profile removal from a group works. |
43 | 43 |
44 <a href="https://bugs.webkit.org/show_bug.cgi?id=110466">Bug 110466</a> | 44 <a href="https://bugs.webkit.org/show_bug.cgi?id=110466">Bug 110466</a> |
45 </p> | 45 </p> |
46 </body> | 46 </body> |
47 </html> | 47 </html> |
OLD | NEW |