270db7903a
- 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}
38 lines
1.1 KiB
JavaScript
38 lines
1.1 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("Check that console.log is reported through Console domain as well.");
|
|
|
|
var expectedMessages = 4;
|
|
var messages = [];
|
|
|
|
InspectorTest.eventHandler["Runtime.consoleAPICalled"] = consoleAPICalled;
|
|
InspectorTest.eventHandler["Console.messageAdded"] = messageAdded;
|
|
InspectorTest.sendCommandOrDie("Runtime.enable", {});
|
|
InspectorTest.sendCommandOrDie("Console.enable", {});
|
|
InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "console.log(42)" });
|
|
InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "console.error('abc')" });
|
|
|
|
function consoleAPICalled(result)
|
|
{
|
|
messages.push("api call: " + result.params.args[0].value);
|
|
if (!(--expectedMessages))
|
|
done();
|
|
}
|
|
|
|
function messageAdded(result)
|
|
{
|
|
messages.push("console message: " + result.params.message.text);
|
|
if (!(--expectedMessages))
|
|
done();
|
|
}
|
|
|
|
function done()
|
|
{
|
|
messages.sort();
|
|
for (var message of messages)
|
|
InspectorTest.log(message);
|
|
InspectorTest.completeTest();
|
|
}
|