3 Copyright (c) 2014 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.
8 <link rel="import" href="/tracing/analysis/table_builder.html">
13 tvcm.unittest.testSuite(function() {
14 var THIS_DOC = document._currentScript.ownerDocument;
16 test('instantiateNestedTableNoNests', function() {
19 title: 'First Column',
20 value: function(row) { return row.firstData; },
24 title: 'Second Column',
25 value: function(row) { return row.secondData; }
40 var table = new TracingAnalysisNestedTable();
41 table.tableColumns = columns;
42 table.tableRows = rows;
44 this.addHTMLOutput(table);
47 test('instantiateNestedTableWithNests', function() {
50 title: 'First Column',
51 value: function(row) { return row.firstData; },
55 title: 'Second Column',
56 value: function(row) { return row.secondData; },
72 secondData: 'Sub2 A2',
75 firstData: 'SubSub1 A1',
76 secondData: 'SubSub1 A2',
79 firstData: 'SubSub2 A1',
80 secondData: 'SubSub2 A2',
96 var table = new TracingAnalysisNestedTable();
97 table.tableColumns = columns;
98 table.tableRows = rows;
100 this.addHTMLOutput(table);
103 test('instantiateSortingCallbacksWithNests', function() {
104 var table = new TracingAnalysisNestedTable();
108 title: 'First Column',
109 value: function(row) { return row.firstData; },
113 title: 'Second Column',
114 value: function(row) { return row.secondData; },
116 cmp: function(rowA, rowB) {
117 return rowA.secondData.toString().localeCompare(
118 rowB.secondData.toString());
120 showExpandButtons: true
130 firstData: 'Sub1 A1',
131 secondData: 'Sub1 A2'
134 firstData: 'Sub2 A1',
135 secondData: 'Sub2 A2',
138 firstData: 'SubSub1 A1',
139 secondData: 'SubSub1 A2',
142 firstData: 'SubSub2 A1',
143 secondData: 'SubSub2 A2',
148 firstData: 'Sub3 A1',
149 secondData: 'Sub3 A2'
170 secondData: 'Sub2F2',
173 firstData: 'SubSub1F1',
174 secondData: 'SubSub1F2',
177 firstData: 'SubSub2F1',
178 secondData: 'SubSub2F2',
195 table.tableColumns = columns;
196 table.tableRows = rows;
197 table.footerRows = footerRows;
198 this.addHTMLOutput(table);
200 var button = THIS_DOC.createElement('button');
201 button.textContent = 'Sort By Col 0';
202 button.addEventListener('click', function() {
203 table.sortDescending = !table.sortDescending;
204 table.sortColumnIndex = 0;
206 this.addHTMLOutput(button);