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>Single Counter Selection Analysis Tests</title> 10 <script src="/src/base.js"></script> 11 </head> 12 <body> 13 <script> 14 base.require('unittest'); 15 base.require('test_utils'); 16 base.require('analysis.single_counter_selection_analysis'); 17 base.require('analysis.test.analysis_test_support'); 18 </script> 19 <script> 20 'use strict'; 21 22 function testSingleCounterSelectionWithSlice() { 23 var data = tracing.analysis.test.createReferenceData(true); 24 25 var selection = new tracing.Selection(); 26 data.t1track.selectByTitle('b', selection); 27 28 var analysis = new tracing.analysis.SingleCounterSelectionAnalysis(); 29 assertThrows(function() { 30 analysis.selection = selection; 31 }); 32 } 33 34 function testSingleCounterSelectionAnalysisWithSingleCounter() { 35 var data = tracing.analysis.test.createReferenceData(true); 36 37 var selection = new tracing.Selection(); 38 selection.addCounterSample(data.ctr1track, data.ctr1track.counter, 0); 39 40 var analysis = new tracing.analysis.SingleCounterSelectionAnalysis(); 41 analysis.selection = selection; 42 43 var singleCounterEl = analysis; 44 var rowEl = singleCounterEl.children[0]; 45 46 assertEquals(true, singleCounterEl instanceof 47 tracing.analysis.SingleCounterSelectionAnalysis); 48 assertEquals(1, singleCounterEl.children.length); 49 assertEquals('ctr1', rowEl.children[0].textContent); 50 assertEquals('0', rowEl.children[1].textContent); 51 } 52 53 function testSingleCounterSelectionAnalysisWithMultipleCounters() { 54 var data = tracing.analysis.test.createReferenceData(true); 55 56 var selection = new tracing.Selection(); 57 selection.addCounterSample(data.ctr1track, data.ctr1track.counter, 0); 58 selection.addCounterSample(data.ctr2track, data.ctr2track.counter, 3); 59 60 var analysis = new tracing.analysis.SingleCounterSelectionAnalysis(); 61 assertThrows(function() { 62 analysis.selection = selection; 63 }); 64 } 65 66 </script> 67 </body> 68 </html> 69