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

Side by Side Diff: LayoutTests/inspector-protocol/cpu-profiler/enable-disable.html

Issue 101323012: Revert of Stop recording CPU profiles when Profiler agent is disabled (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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/enable-disable-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 if (window.testRunner) {
6 testRunner.dumpAsText();
7 testRunner.waitUntilDone();
8 }
9
10 function test()
11 {
12 InspectorTest.sendCommand("Profiler.start", {}, didFailToStartWhenDisabled);
13 disallowConsoleProfiles();
14
15 function disallowConsoleProfiles()
16 {
17 InspectorTest.eventHandler["Profiler.consoleProfile"] = function(message Object)
18 {
19 InspectorTest.log("FAIL: console profile started " + JSON.stringify( messageObject, null, 4));
20 }
21 InspectorTest.eventHandler["Profiler.addProfileHeader"] = function(messa geObject)
22 {
23 InspectorTest.log("FAIL: unexpected profile received " + JSON.string ify(messageObject, null, 4));
24 }
25 }
26 function allowConsoleProfiles()
27 {
28 InspectorTest.eventHandler["Profiler.consoleProfile"] = function(message Object)
29 {
30 InspectorTest.log("PASS: console initiated profile started");
31 }
32 InspectorTest.eventHandler["Profiler.addProfileHeader"] = function(messa geObject)
33 {
34 InspectorTest.log("PASS: console initiated profile received");
35 }
36 }
37 function didFailToStartWhenDisabled(messageObject)
38 {
39 if (!InspectorTest.expectedError("didFailToStartWhenDisabled", messageOb ject))
40 return;
41 allowConsoleProfiles();
42 InspectorTest.sendCommand("Profiler.enable", {});
43 InspectorTest.sendCommand("Profiler.start", {}, didStartFrontendProfile) ;
44 }
45 function didStartFrontendProfile(messageObject)
46 {
47 if (!InspectorTest.expectedSuccess("didStartFrontendProfile", messageObj ect))
48 return;
49 InspectorTest.sendCommand("Runtime.evaluate", {expression: "console.prof ile('p1');"}, didStartConsoleProfile);
50 }
51
52 function didStartConsoleProfile(messageObject)
53 {
54 if (!InspectorTest.expectedSuccess("didStartConsoleProfile", messageObje ct))
55 return;
56 InspectorTest.sendCommand("Profiler.disable", {}, didDisableProfiler);
57 }
58
59 function didDisableProfiler(messageObject)
60 {
61 if (!InspectorTest.expectedSuccess("didDisableProfiler", messageObject))
62 return;
63 InspectorTest.sendCommand("Profiler.enable", {});
64 InspectorTest.sendCommand("Profiler.stop", {}, didStopFrontendProfile);
65 }
66
67 function didStopFrontendProfile(messageObject)
68 {
69 if (!InspectorTest.expectedError("no front-end initiated profiles found" , messageObject))
70 return;
71 disallowConsoleProfiles();
72 InspectorTest.sendCommand("Runtime.evaluate", {expression: "console.prof ileEnd();"}, didStopConsoleProfile);
73 }
74
75 function didStopConsoleProfile(messageObject)
76 {
77 if (!InspectorTest.expectedSuccess("didStopConsoleProfile", messageObjec t))
78 return;
79 InspectorTest.completeTest();
80 }
81 }
82 </script>
83 </head>
84 <body onload="runTest()">
85 <p>
86 Test that profiling can only be started when Profiler was enabled and that
87 Profiler.disable command will stop recording all profiles.
88 </body>
89 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/cpu-profiler/enable-disable-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698