v8/test/inspector/cpu-profiler/console-profile-end-parameterless-crash.js
kozyatinskiy 270db7903a [inspector] added inspector test runner [part 5]
- added most part of inspector tests that depends only on JavaScript domains.

BUG=chromium:635948
R=dgozman@chromium.org,alph@chromium.org

Committed: https://crrev.com/9ddbdab195923fc87fae3587ae06c5c1c5ca6d79
Review-Url: https://codereview.chromium.org/2369753004
Cr-Original-Commit-Position: refs/heads/master@{#39897}
Cr-Commit-Position: refs/heads/master@{#39931}
2016-10-02 21:23:03 +00:00

47 lines
1.3 KiB
JavaScript

// 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");
}