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

Unified Diff: test/inspector/cpu-profiler/console-profile-end-parameterless-crash.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/console-profile-end-parameterless-crash.js
diff --git a/test/inspector/cpu-profiler/console-profile-end-parameterless-crash.js b/test/inspector/cpu-profiler/console-profile-end-parameterless-crash.js
new file mode 100644
index 0000000000000000000000000000000000000000..484a310fae094849009eb905d7d965823701672f
--- /dev/null
+++ b/test/inspector/cpu-profiler/console-profile-end-parameterless-crash.js
@@ -0,0 +1,46 @@
+// 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("Tests that \"console.profileEnd()\" does not cause crash. (webkit:105759)");
+
+InspectorTest.evaluateInPage(`
+function collectProfiles()
+{
+ console.profile();
+ console.profile("titled");
+ console.profileEnd();
+ console.profileEnd();
+}`);
+
+InspectorTest.fail = function(message)
+{
+ InspectorTest.log("FAIL: " + message);
+ InspectorTest.completeTest();
+}
+
+InspectorTest.sendCommand("Profiler.enable", {});
+InspectorTest.sendCommand("Runtime.evaluate", { expression: "collectProfiles()"}, didCollectProfiles);
+
+var headers = [];
+InspectorTest.eventHandler["Profiler.consoleProfileFinished"] = function(messageObject)
+{
+ headers.push({
+ title: messageObject["params"]["title"]
+ });
+}
+
+function didCollectProfiles(messageObject)
+{
+ if (headers.length !== 2)
+ return InspectorTest.fail("Cannot retrive headers: " + JSON.stringify(messageObject, null, 4));
+ InspectorTest.log("SUCCESS: found 2 profile headers");
+ for (var i = 0; i < headers.length; i++) {
+ if (headers[i].title === "titled") {
+ InspectorTest.log("SUCCESS: titled profile found");
+ InspectorTest.completeTest();
+ return;
+ }
+ }
+ InspectorTest.fail("Cannot find titled profile");
+}

Powered by Google App Engine
This is Rietveld 408576698