1 <!DOCTYPE html> 2 <!-- 3 Copyright 2015 The Chromium Authors. All rights reserved. 4 Use of this source code is governed by a BSD-style license that can be 5 found in the LICENSE file. 6 --> 7 8 <link rel="import" href="/tracing/base/iteration_helpers.html"> 9 <link rel="import" href="/tracing/core/test_utils.html"> 10 <link rel="import" href="/tracing/mre/mre_result.html"> 11 12 <script> 13 'use strict'; 14 15 tr.b.unittest.testSuite(function() { 16 var test_utils = tr.c.TestUtils; 17 var ThreadSlice = tr.model.ThreadSlice; 18 19 test('traceStatsTest', function() { 20 var m = test_utils.newModel(function(m) { 21 var p1 = m.getOrCreateProcess(1); 22 var t2 = p1.getOrCreateThread(2); 23 t2.sliceGroup.pushSlice(test_utils.newSliceEx({ 24 name: 'some_slice', 25 start: 0, duration: 10 26 })); 27 }); 28 29 var result = new pi.mre.MreResult(); 30 pi.m.traceStatsFunctionForTest(result, m); 31 32 assert.equal(tr.b.dictionaryLength(result.pairs), 1); 33 var dict = result.pairs.stats; 34 assert.equal(dict.totalEvents, 1); 35 assert.equal(dict.firstTimeInMS, 0); 36 assert.equal(dict.lastTimeInMS, 10); 37 assert.equal(dict.durationInMS, 10); 38 assert.equal(dict.eventsPerSecond, 100); 39 }); 40 }); 41 42 </script> 43