v8/test/inspector/runtime/console-log-doesnt-run-microtasks.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

27 lines
889 B
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 doesn't run microtasks.");
InspectorTest.evaluateInPage(
`
function testFunction()
{
Promise.resolve().then(function(){ console.log(239); });
console.log(42);
console.log(43);
}`);
InspectorTest.sendCommandOrDie("Runtime.enable", {});
InspectorTest.eventHandler["Runtime.consoleAPICalled"] = messageAdded;
InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "testFunction()" });
InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "setTimeout(() => console.log(\"finished\"), 0)" });
function messageAdded(result)
{
InspectorTest.logObject(result.params.args[0]);
if (result.params.args[0].value === "finished")
InspectorTest.completeTest();
}