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>Slice Group 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.slice_group_selection_analysis'); 17 base.require('analysis.test.analysis_test_support'); 18 </script> 19 <script> 20 'use strict'; 21 22 function testSliceGroupSelectionAnalysisWithOneSlice() { 23 var data = tracing.analysis.test.createReferenceData(true); 24 25 var selection = new tracing.Selection(); 26 data.t1track.selectByTitle('f', selection); 27 28 var analysis = new tracing.analysis.SliceGroupSelectionAnalysis(); 29 analysis.selection = selection; 30 var rowEl = analysis.children[0]; 31 32 assertEquals(true, analysis instanceof 33 tracing.analysis.SliceGroupSelectionAnalysis); 34 assertEquals(1, analysis.children.length); 35 assertEquals(3, rowEl.children.length); 36 assertEquals('f', rowEl.children[0].textContent); 37 assertEquals('0.002', rowEl.children[1].textContent); 38 assertEquals('1', rowEl.children[2].textContent); 39 } 40 41 function testSliceGroupSelectionAnalysisWithTwoSlicesSameTitle() { 42 var data = tracing.analysis.test.createReferenceData(true); 43 44 var selection = new tracing.Selection(); 45 data.t1track.selectByTitle('b', selection); 46 47 var analysis = new tracing.analysis.SliceGroupSelectionAnalysis(); 48 analysis.selection = selection; 49 var rowEl = analysis.children[0]; 50 51 assertEquals(true, analysis instanceof 52 tracing.analysis.SliceGroupSelectionAnalysis); 53 assertEquals(1, analysis.children.length); 54 assertEquals('b', rowEl.children[0].textContent); 55 assertEquals('0.004', rowEl.children[1].textContent); 56 assertEquals('2', rowEl.children[2].textContent); 57 } 58 59 function testSliceGroupSelectionAnalysisWithTwoSlicesDifferentTitles() { 60 var data = tracing.analysis.test.createReferenceData(true); 61 62 var selection = new tracing.Selection(); 63 data.t1track.selectByTitle('b', selection); 64 data.t1track.selectByTitle('c', selection); 65 66 var analysis = new tracing.analysis.SliceGroupSelectionAnalysis(); 67 assertThrows(function() { 68 analysis.selection = selection; 69 }); 70 } 71 72 </script> 73 </body> 74 </html> 75