mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 14:41:29 +00:00

PR-URL: https://github.com/nodejs/node/pull/54077 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
44 lines
1.5 KiB
JavaScript
44 lines
1.5 KiB
JavaScript
// Copyright 2024 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 default label with console.time() and friends');
|
|
|
|
(async function test() {
|
|
await Protocol.Runtime.enable();
|
|
|
|
utils.setCurrentTimeMSForTest(0.0);
|
|
await Protocol.Runtime.evaluate({expression: `console.time(undefined)`});
|
|
utils.setCurrentTimeMSForTest(1.0);
|
|
await Promise.all([
|
|
Protocol.Runtime.evaluate({expression: `console.timeLog(undefined, 'a')`}),
|
|
Protocol.Runtime.onceConsoleAPICalled().then(logArgs),
|
|
]);
|
|
utils.setCurrentTimeMSForTest(2.0);
|
|
await Promise.all([
|
|
Protocol.Runtime.evaluate({expression: `console.timeEnd(undefined)`}),
|
|
Protocol.Runtime.onceConsoleAPICalled().then(logArgs),
|
|
]);
|
|
|
|
utils.setCurrentTimeMSForTest(3.0);
|
|
await Protocol.Runtime.evaluate({expression: `console.time()`});
|
|
utils.setCurrentTimeMSForTest(4.0);
|
|
await Promise.all([
|
|
Protocol.Runtime.evaluate({expression: `console.timeLog()`}),
|
|
Protocol.Runtime.onceConsoleAPICalled().then(logArgs),
|
|
]);
|
|
utils.setCurrentTimeMSForTest(5.0);
|
|
await Promise.all([
|
|
Protocol.Runtime.evaluate({expression: `console.timeEnd()`}),
|
|
Protocol.Runtime.onceConsoleAPICalled().then(logArgs),
|
|
]);
|
|
|
|
await Protocol.Runtime.disable();
|
|
InspectorTest.completeTest();
|
|
})()
|
|
|
|
function logArgs(message) {
|
|
InspectorTest.logMessage(message.params.args);
|
|
}
|