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

Unified Diff: test/inspector/cpu-profiler/record-cpu-profile.js

Issue 2369753004: [inspector] added inspector test runner [part 5] (Closed)
Patch Set: addressed comments Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: test/inspector/cpu-profiler/record-cpu-profile.js
diff --git a/test/inspector/cpu-profiler/record-cpu-profile.js b/test/inspector/cpu-profiler/record-cpu-profile.js
new file mode 100644
index 0000000000000000000000000000000000000000..4bbdafc06e633dd328b4fb00ee2ede5e098c6490
--- /dev/null
+++ b/test/inspector/cpu-profiler/record-cpu-profile.js
@@ -0,0 +1,48 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+print("Test that profiler is able to record a profile. Also it tests that profiler returns an error when it unable to find the profile.");
+
+InspectorTest.sendCommand("Profiler.enable", {});
+InspectorTest.sendCommand("Profiler.start", {}, didStartFrontendProfile);
+function didStartFrontendProfile(messageObject)
+{
+ if (!InspectorTest.expectedSuccess("startFrontendProfile", messageObject))
+ return;
+ InspectorTest.sendCommand("Runtime.evaluate", {expression: "console.profile('Profile 1');"}, didStartConsoleProfile);
+}
+
+function didStartConsoleProfile(messageObject)
+{
+ if (!InspectorTest.expectedSuccess("startConsoleProfile", messageObject))
+ return;
+ InspectorTest.sendCommand("Runtime.evaluate", {expression: "console.profileEnd('Profile 1');"}, didStopConsoleProfile);
+}
+
+function didStopConsoleProfile(messageObject)
+{
+ if (!InspectorTest.expectedSuccess("stopConsoleProfile", messageObject))
+ return;
+ InspectorTest.sendCommand("Profiler.stop", {}, didStopFrontendProfile);
+}
+
+function didStopFrontendProfile(messageObject)
+{
+ if (!InspectorTest.expectedSuccess("stoppedFrontendProfile", messageObject))
+ return;
+ InspectorTest.sendCommand("Profiler.start", {}, didStartFrontendProfile2);
+}
+
+function didStartFrontendProfile2(messageObject)
+{
+ if (!InspectorTest.expectedSuccess("startFrontendProfileSecondTime", messageObject))
+ return;
+ InspectorTest.sendCommand("Profiler.stop", {}, didStopFrontendProfile2);
+}
+
+function didStopFrontendProfile2(messageObject)
+{
+ InspectorTest.expectedSuccess("stopFrontendProfileSecondTime", messageObject)
+ InspectorTest.completeTest();
+}
« no previous file with comments | « test/inspector/cpu-profiler/enable-disable-expected.txt ('k') | test/inspector/cpu-profiler/record-cpu-profile-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698