c97d869dff
R=dgozman@chromium.org Bug: chromium:696798 Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel Change-Id: Ida60ee5fb3e3e42d15bf6d4bad84dfcfb521b74f Reviewed-on: https://chromium-review.googlesource.com/722073 Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org> Cr-Commit-Position: refs/heads/master@{#48617}
52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
// Copyright 2017 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.
|
|
|
|
let {session, contextGroup, Protocol} = InspectorTest.start('Checks format of console.timeEnd output');
|
|
|
|
Protocol.Runtime.enable();
|
|
Protocol.Runtime.onConsoleAPICalled(message => {
|
|
InspectorTest.log(message.params.args[0].value);
|
|
});
|
|
|
|
InspectorTest.runAsyncTestSuite([
|
|
function zero() {
|
|
return checkInterval(0.0);
|
|
},
|
|
function verySmall() {
|
|
return checkInterval(1e-15);
|
|
},
|
|
function small() {
|
|
return checkInterval(0.001);
|
|
},
|
|
function regular() {
|
|
return checkInterval(1.2345);
|
|
},
|
|
function big() {
|
|
return checkInterval(10000.2345);
|
|
},
|
|
function veryBig() {
|
|
return checkInterval(1e+15 + 0.2345);
|
|
},
|
|
function huge() {
|
|
return checkInterval(1e+42);
|
|
},
|
|
function undefinedAsLabel() {
|
|
return checkInterval(1.0, 'undefined');
|
|
},
|
|
function emptyAsLabel() {
|
|
return checkInterval(1.0, '');
|
|
}
|
|
]);
|
|
|
|
async function checkInterval(time, label) {
|
|
label = label === undefined ? '\'timeEnd\'' : label;
|
|
utils.setCurrentTimeMSForTest(0.0);
|
|
Protocol.Runtime.evaluate({
|
|
expression: `console.log('js: ' + ${time} + 'ms')`
|
|
});
|
|
await Protocol.Runtime.evaluate({expression: `console.time(${label})`});
|
|
utils.setCurrentTimeMSForTest(time);
|
|
await Protocol.Runtime.evaluate({expression: `console.timeEnd(${label})`});
|
|
}
|