1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 Copyright (c) 2012 The Chromium Authors. All rights reserved. 5 Use of this source code is governed by a BSD-style license that can be 6 found in the LICENSE file. 7 --> 8 <head> 9 <title>Process tests</title> 10 <style> 11 .view { 12 border: 1px solid black; 13 margin: 10px; 14 } 15 .find-dialog { 16 border: 1px solid black; 17 margin: 10px; 18 } 19 </style> 20 <script src="/src/base.js"></script> 21 <script> 22 base.require('unittest'); 23 base.require('test_utils'); 24 base.require('model.process'); 25 </script> 26 </head> 27 <body> 28 <script> 29 'use strict'; 30 31 var Process = tracing.model.Process; 32 33 function testGetOrCreateCounter() { 34 var process = new Process(7); 35 var ctrBar = process.getOrCreateCounter('foo', 'bar'); 36 var ctrBar2 = process.getOrCreateCounter('foo', 'bar'); 37 assertEquals(ctrBar2, ctrBar); 38 } 39 40 function testShiftTimestampsForward() { 41 var process = new Process(7); 42 var ctr = process.getOrCreateCounter('foo', 'bar'); 43 var thread = process.getOrCreateThread(1); 44 45 var shiftCount = 0; 46 thread.shiftTimestampsForward = function(ts) { 47 if (ts == 0.32) 48 shiftCount++; 49 }; 50 ctr.shiftTimestampsForward = function(ts) { 51 if (ts == 0.32) 52 shiftCount++; 53 }; 54 process.shiftTimestampsForward(0.32); 55 assertEquals(2, shiftCount); 56 } 57 58 </script> 59 </body> 60 </html> 61