v8/test/inspector/runtime/console-timestamp.js
kozyatinskiy 24beac30ee [inspector] Make InspectorTest.sendCommand* private
Introduce Protocol.Domain.method(args) and Protocol.Domain.onEventName() instead.
Renamed InspectorTest.evaluateInPage -> InspectorTest.addScript.
Improved InspectorTest.logMessage.

BUG=chromium:635948
R=dgozman@chromium.org,alph@chromium.org

Review-Url: https://codereview.chromium.org/2390733002
Cr-Commit-Position: refs/heads/master@{#39942}
2016-10-03 23:33:07 +00:00

24 lines
969 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.
var messages = [];
function messageAdded(data)
{
var payload = data.params;
if (messages.length > 0)
InspectorTest.log("Message " + messages.length + " has non-decreasing timestamp: " + (payload.timestamp >= messages[messages.length - 1].timestamp));
messages.push(payload);
InspectorTest.log("Message has timestamp: " + !!payload.timestamp);
InspectorTest.log("Message timestamp doesn't differ too much from current time (one minute interval): " + (Math.abs(new Date().getTime() - payload.timestamp) < 60000));
if (messages.length === 3)
InspectorTest.completeTest();
}
Protocol.Runtime.onConsoleAPICalled(messageAdded);
Protocol.Runtime.enable();
Protocol.Runtime.evaluate({ expression: "console.log('testUnique'); for (var i = 0; i < 2; ++i) console.log('testDouble');" });