v8/test/inspector/runtime/console-time-log.js
Alexey Kozyatinskiy 7b32eb8c7b inspector: implement console.timeLog
New method was added to console spec [1].
This CL implements it.

[1] https://console.spec.whatwg.org/#timelog

R=dgozman@chromium.org,yangguo@chromium.org

Bug: chromium:854474
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ie5f249795979bb886cf824ae9f950c5ef78ce04d
Reviewed-on: https://chromium-review.googlesource.com/1247641
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56294}
2018-09-28 17:34:08 +00:00

30 lines
1.2 KiB
JavaScript

// Copyright 2018 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.
const {session, contextGroup, Protocol} =
InspectorTest.start('Test for console.timeLog');
(async function test() {
Protocol.Runtime.enable();
utils.setCurrentTimeMSForTest(0.0);
await Protocol.Runtime.evaluate({expression: `console.time('42')`});
utils.setCurrentTimeMSForTest(1.0);
Protocol.Runtime.evaluate({expression: `console.timeLog('42', 'a')`});
logArgs(await Protocol.Runtime.onceConsoleAPICalled());
utils.setCurrentTimeMSForTest(2.0);
Protocol.Runtime.evaluate({expression: `console.timeLog('42', 'a', 'b')`});
logArgs(await Protocol.Runtime.onceConsoleAPICalled());
utils.setCurrentTimeMSForTest(3.0);
Protocol.Runtime.evaluate({expression: `console.timeEnd('42')`});
logArgs(await Protocol.Runtime.onceConsoleAPICalled());
utils.setCurrentTimeMSForTest(4.0);
Protocol.Runtime.evaluate({expression: `console.timeLog('42', 'text')`});
logArgs(await Protocol.Runtime.onceConsoleAPICalled());
InspectorTest.completeTest();
})()
function logArgs(message) {
InspectorTest.logMessage(message.params.args);
}