1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5'use strict';
6
7base.exportTo('tracing.analysis', function() {
8  function StubAnalysisResults() {
9    this.tables = [];
10  }
11  StubAnalysisResults.prototype = {
12    __proto__: Object.protoype,
13
14    appendTable: function(parent, className) {
15      var table = {
16        className: className,
17        rows: []
18      };
19      table.className = className;
20      this.tables.push(table);
21      return table;
22    },
23
24    appendTableHeader: function(table, label) {
25      if (table.tableHeader)
26        throw new Error('Only one summary header allowed.');
27      table.tableHeader = label;
28    },
29
30    appendSummaryRow: function(table, label, opt_text) {
31      table.rows.push({label: label,
32        text: opt_text});
33    },
34
35    appendSpacingRow: function(table) {
36      table.rows.push({spacing: true});
37    },
38
39    appendSummaryRowTime: function(table, label, time) {
40      table.rows.push({label: label,
41        time: time});
42    },
43
44    appendDataRow: function(table, label, duration, occurences,
45                            details, selectionGenerator) {
46      table.rows.push({label: label,
47        duration: duration,
48        occurences: occurences,
49        details: details,
50        selectionGenerator: selectionGenerator});
51    }
52  };
53
54  return {
55    StubAnalysisResults: StubAnalysisResults
56  };
57});
58