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

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

Issue 116273003: Stop recording CPU profiles when Profiler agent is disabled (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Comments addressed 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/cpu-profiler/enable-disable-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/inspector-protocol/cpu-profiler/enable-disable.html
diff --git a/LayoutTests/inspector-protocol/cpu-profiler/enable-disable.html b/LayoutTests/inspector-protocol/cpu-profiler/enable-disable.html
new file mode 100644
index 0000000000000000000000000000000000000000..b450308176f073c3bbc695367da287920e47e8ba
--- /dev/null
+++ b/LayoutTests/inspector-protocol/cpu-profiler/enable-disable.html
@@ -0,0 +1,89 @@
+<html>
+<head>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+function test()
+{
+ InspectorTest.sendCommand("Profiler.start", {}, didFailToStartWhenDisabled);
+ disallowConsoleProfiles();
+
+ function disallowConsoleProfiles()
+ {
+ InspectorTest.eventHandler["Profiler.consoleProfile"] = function(messageObject)
+ {
+ InspectorTest.log("FAIL: console profile started " + JSON.stringify(messageObject, null, 4));
+ }
+ InspectorTest.eventHandler["Profiler.addProfileHeader"] = function(messageObject)
+ {
+ InspectorTest.log("FAIL: unexpected profile received " + JSON.stringify(messageObject, null, 4));
+ }
+ }
+ function allowConsoleProfiles()
+ {
+ InspectorTest.eventHandler["Profiler.consoleProfile"] = function(messageObject)
+ {
+ InspectorTest.log("PASS: console initiated profile started");
+ }
+ InspectorTest.eventHandler["Profiler.addProfileHeader"] = function(messageObject)
+ {
+ InspectorTest.log("PASS: console initiated profile received");
+ }
+ }
+ function didFailToStartWhenDisabled(messageObject)
+ {
+ if (!InspectorTest.expectedError("didFailToStartWhenDisabled", messageObject))
+ return;
+ allowConsoleProfiles();
+ InspectorTest.sendCommand("Profiler.enable", {});
+ InspectorTest.sendCommand("Profiler.start", {}, didStartFrontendProfile);
+ }
+ function didStartFrontendProfile(messageObject)
+ {
+ if (!InspectorTest.expectedSuccess("didStartFrontendProfile", messageObject))
+ return;
+ InspectorTest.sendCommand("Runtime.evaluate", {expression: "console.profile('p1');"}, didStartConsoleProfile);
+ }
+
+ function didStartConsoleProfile(messageObject)
+ {
+ if (!InspectorTest.expectedSuccess("didStartConsoleProfile", messageObject))
+ return;
+ InspectorTest.sendCommand("Profiler.disable", {}, didDisableProfiler);
+ }
+
+ function didDisableProfiler(messageObject)
+ {
+ if (!InspectorTest.expectedSuccess("didDisableProfiler", messageObject))
+ return;
+ InspectorTest.sendCommand("Profiler.enable", {});
+ InspectorTest.sendCommand("Profiler.stop", {}, didStopFrontendProfile);
+ }
+
+ function didStopFrontendProfile(messageObject)
+ {
+ if (!InspectorTest.expectedError("no front-end initiated profiles found", messageObject))
+ return;
+ disallowConsoleProfiles();
+ InspectorTest.sendCommand("Runtime.evaluate", {expression: "console.profileEnd();"}, didStopConsoleProfile);
+ }
+
+ function didStopConsoleProfile(messageObject)
+ {
+ if (!InspectorTest.expectedSuccess("didStopConsoleProfile", messageObject))
+ return;
+ InspectorTest.completeTest();
+ }
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>
+Test that profiling can only be started when Profiler was enabled and that
+Profiler.disable command will stop recording all profiles.
+</body>
+</html>
« 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