Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: LayoutTests/inspector-protocol/cpu-profiler/console-profile.html

Issue 15816002: Remove console.profiles from window.console API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/cpu-profiler/console-profile-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource s/protocol-test.js"></script>
4 <script>
5 function collectProfiles()
6 {
7 console.profile("outer");
8 console.profile("inner");
9 console.profileEnd("outer");
10 console.profileEnd("inner");
11 }
12
13 function test()
14 {
15 InspectorTest.fail = function(message)
16 {
17 InspectorTest.log("FAIL: " + message);
18 InspectorTest.completeTest();
19 }
20
21 InspectorTest.sendCommand("Profiler.enable", {});
22 InspectorTest.sendCommand("Runtime.evaluate", { expression: "collectProfiles ()"}, didCollectProfiles);
23
24 InspectorTest.eventHandler["Profiler.addProfileHeader"] = function(messageOb ject)
25 {
26 InspectorTest.log("FAIL: unexpected header = " + JSON.stringify(messageO bject, null, 4));
27 }
28
29 function didCollectProfiles(messageObject)
30 {
31 InspectorTest.sendCommand("Profiler.getProfileHeaders", {}, didReceivePr ofileHeaders);
32 }
33
34 function didReceiveProfileHeaders(messageObject)
35 {
36 var headers = messageObject["result"]["headers"];
37 if (!headers || headers.length !== 2)
38 return InspectorTest.fail("Cannot retrive headers: " + JSON.stringif y(messageObject, null, 4));
39 for (var i = 0; i < headers.length; i++) {
40 if (headers[i].title === "inner") {
41 InspectorTest.sendCommand("Profiler.getCPUProfile", { uid: heade rs[i].uid }, didGetProfile);
42 return;
43 }
44 }
45 InspectorTest.fail("Cannot find 'inner' profile header");
46 }
47
48 function didGetProfile(messageObject)
49 {
50 InspectorTest.log("SUCCESS: retrieved 'inner' profile");
51 var root = messageObject.result.profile.head;
52 if (!findFunctionInProfile(root, "collectProfiles"))
53 return InspectorTest.fail("collectProfiles function not found in the profile: " + JSON.stringify(messageObject, null, 4));
54 InspectorTest.log("SUCCESS: found 'collectProfiles' function in the prof ile");
55 InspectorTest.sendCommand("Profiler.clearProfiles", {});
56 InspectorTest.completeTest();
57 }
58
59 function findFunctionInProfile(node, functionName)
60 {
61 if (node.functionName === functionName)
62 return true;
63 var children = node.children;
64 for (var i = 0; i < children.length; ++i)
65 if (findFunctionInProfile(children[i], functionName))
66 return true;
67 return false;
68 }
69 }
70 </script>
71 </head>
72 <body onload="runTest()">
73 <p>
74 Tests that console.profile/profileEnd will record CPU profile when inspector fro nt-end is connected.<br>
75 </p>
76 </body>
77 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/cpu-profiler/console-profile-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698