2017-01-17 20:21:38 +00:00
|
|
|
// 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.
|
|
|
|
|
2017-05-19 00:35:45 +00:00
|
|
|
let {session, contextGroup, Protocol} = InspectorTest.start('Checks format of console.timeEnd output');
|
2017-01-17 20:21:38 +00:00
|
|
|
|
|
|
|
Protocol.Runtime.enable();
|
|
|
|
Protocol.Runtime.onConsoleAPICalled(message => {
|
|
|
|
InspectorTest.log(message.params.args[0].value);
|
|
|
|
});
|
|
|
|
|
|
|
|
InspectorTest.runTestSuite([
|
|
|
|
function zero(next) {
|
|
|
|
checkInterval(0.0).then(next);
|
|
|
|
},
|
|
|
|
function verySmall(next) {
|
|
|
|
checkInterval(1e-15).then(next);
|
|
|
|
},
|
|
|
|
function small(next) {
|
|
|
|
checkInterval(0.001).then(next);
|
|
|
|
},
|
|
|
|
function regular(next) {
|
|
|
|
checkInterval(1.2345).then(next);
|
|
|
|
},
|
|
|
|
function big(next) {
|
|
|
|
checkInterval(10000.2345).then(next);
|
|
|
|
},
|
|
|
|
function veryBig(next) {
|
|
|
|
checkInterval(1e+15 + 0.2345).then(next);
|
|
|
|
},
|
|
|
|
function huge(next) {
|
|
|
|
checkInterval(1e+42).then(next);
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
|
|
|
function checkInterval(time) {
|
2017-02-28 20:22:24 +00:00
|
|
|
utils.setCurrentTimeMSForTest(0.0);
|
2017-01-17 20:21:38 +00:00
|
|
|
return Protocol.Runtime.evaluate({
|
|
|
|
expression: `console.log('js: ' + ${time} + 'ms')`})
|
|
|
|
.then(() => Protocol.Runtime.evaluate({
|
|
|
|
expression: 'console.time(\'timeEnd\')'}))
|
2017-02-28 20:22:24 +00:00
|
|
|
.then(() => utils.setCurrentTimeMSForTest(time))
|
2017-01-17 20:21:38 +00:00
|
|
|
.then(() => Protocol.Runtime.evaluate({
|
|
|
|
expression: 'console.timeEnd(\'timeEnd\')'}));
|
|
|
|
}
|