OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 InspectorTest.log("Tests that console.profile/profileEnd will record CPU profile
when inspector front-end is connected."); | 5 let {session, contextGroup, Protocol} = InspectorTest.start("Tests that console.
profile/profileEnd will record CPU profile when inspector front-end is connected
."); |
6 | 6 |
7 InspectorTest.addScript(` | 7 contextGroup.addScript(` |
8 function collectProfiles() | 8 function collectProfiles() |
9 { | 9 { |
10 console.profile("outer"); | 10 console.profile("outer"); |
11 console.profile(42); | 11 console.profile(42); |
12 console.profileEnd("outer"); | 12 console.profileEnd("outer"); |
13 console.profileEnd(42); | 13 console.profileEnd(42); |
14 }`); | 14 }`); |
15 | 15 |
16 InspectorTest.fail = function(message) | 16 InspectorTest.fail = function(message) |
17 { | 17 { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 if (!findFunctionInProfile(profile.nodes, "collectProfiles")) | 50 if (!findFunctionInProfile(profile.nodes, "collectProfiles")) |
51 return InspectorTest.fail("collectProfiles function not found in the profile
: " + JSON.stringify(profile, null, 4)); | 51 return InspectorTest.fail("collectProfiles function not found in the profile
: " + JSON.stringify(profile, null, 4)); |
52 InspectorTest.log("SUCCESS: found 'collectProfiles' function in the profile"); | 52 InspectorTest.log("SUCCESS: found 'collectProfiles' function in the profile"); |
53 InspectorTest.completeTest(); | 53 InspectorTest.completeTest(); |
54 } | 54 } |
55 | 55 |
56 function findFunctionInProfile(nodes, functionName) | 56 function findFunctionInProfile(nodes, functionName) |
57 { | 57 { |
58 return nodes.some(n => n.callFrame.functionName === functionName); | 58 return nodes.some(n => n.callFrame.functionName === functionName); |
59 } | 59 } |
OLD | NEW |