<!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>Single Counter Selection Analysis Tests</title>
<script src="/src/base.js"></script>
</head>
<body>
<script>
base.require('unittest');
base.require('test_utils');
base.require('analysis.single_counter_selection_analysis');
base.require('analysis.test.analysis_test_support');
</script>
<script>
'use strict';
function testSingleCounterSelectionWithSlice() {
var data = tracing.analysis.test.createReferenceData(true);
var selection = new tracing.Selection();
data.t1track.selectByTitle('b', selection);
var analysis = new tracing.analysis.SingleCounterSelectionAnalysis();
assertThrows(function() {
analysis.selection = selection;
});
}
function testSingleCounterSelectionAnalysisWithSingleCounter() {
var data = tracing.analysis.test.createReferenceData(true);
var selection = new tracing.Selection();
selection.addCounterSample(data.ctr1track, data.ctr1track.counter, 0);
var analysis = new tracing.analysis.SingleCounterSelectionAnalysis();
analysis.selection = selection;
var singleCounterEl = analysis;
var rowEl = singleCounterEl.children[0];
assertEquals(true, singleCounterEl instanceof
tracing.analysis.SingleCounterSelectionAnalysis);
assertEquals(1, singleCounterEl.children.length);
assertEquals('ctr1', rowEl.children[0].textContent);
assertEquals('0', rowEl.children[1].textContent);
}
function testSingleCounterSelectionAnalysisWithMultipleCounters() {
var data = tracing.analysis.test.createReferenceData(true);
var selection = new tracing.Selection();
selection.addCounterSample(data.ctr1track, data.ctr1track.counter, 0);
selection.addCounterSample(data.ctr2track, data.ctr2track.counter, 3);
var analysis = new tracing.analysis.SingleCounterSelectionAnalysis();
assertThrows(function() {
analysis.selection = selection;
});
}
</script>
</body>
</html>