blob: 1820a94a79d61372b9e8a19bbf34d2b4803ac8f5 [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<!--
Copyright (c) 2012 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<head>
<title>TimelineProcess tests</title>
<style>
.timeline-view {
border: 1px solid black;
margin: 10px;
}
.timeline-find-dialog {
border: 1px solid black;
margin: 10px;
}
</style>
<script src="base.js"></script>
<script>
base.require('unittest');
base.require('test_utils');
base.require('timeline_process');
</script>
</head>
<body>
<script>
'use strict';
var TimelineProcess = tracing.TimelineProcess;
function testGetOrCreateCounter() {
var process = new TimelineProcess(7);
var ctrBar = process.getOrCreateCounter('foo', 'bar');
var ctrBar2 = process.getOrCreateCounter('foo', 'bar');
assertEquals(ctrBar2, ctrBar);
}
function testShiftTimestampsForward() {
var process = new TimelineProcess(7);
var ctr = process.getOrCreateCounter('foo', 'bar');
var thread = process.getOrCreateThread(1);
var shiftCount = 0;
thread.shiftTimestampsForward = function(ts) {
if (ts == 0.32)
shiftCount++;
};
ctr.shiftTimestampsForward = function(ts) {
if (ts == 0.32)
shiftCount++;
};
process.shiftTimestampsForward(0.32);
assertEquals(2, shiftCount);
}
</script>
</body>
</html>