OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2016 The Chromium Authors. All rights reserved. | 3 Copyright 2016 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <link rel="import" href="/tracing/base/fixed_color_scheme.html"> | 8 <link rel="import" href="/tracing/base/fixed_color_scheme.html"> |
9 <link rel="import" href="/tracing/ui/base/deep_utils.html"> | 9 <link rel="import" href="/tracing/ui/base/deep_utils.html"> |
10 <link rel="import" href="/tracing/value/diagnostics/breakdown.html"> | 10 <link rel="import" href="/tracing/value/diagnostics/breakdown.html"> |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 breakdown.set('ba---a', NaN); | 112 breakdown.set('ba---a', NaN); |
113 breakdown.set('inf', Infinity); | 113 breakdown.set('inf', Infinity); |
114 breakdown.set('-inf', -Infinity); | 114 breakdown.set('-inf', -Infinity); |
115 breakdown.set('goose egg', 0); | 115 breakdown.set('goose egg', 0); |
116 breakdown.set('<0', -1); | 116 breakdown.set('<0', -1); |
117 | 117 |
118 const span = tr.v.ui.createDiagnosticSpan(breakdown); | 118 const span = tr.v.ui.createDiagnosticSpan(breakdown); |
119 assert.strictEqual('TR-V-UI-BREAKDOWN-SPAN', span.tagName); | 119 assert.strictEqual('TR-V-UI-BREAKDOWN-SPAN', span.tagName); |
120 this.addHTMLOutput(span); | 120 this.addHTMLOutput(span); |
121 }); | 121 }); |
| 122 |
| 123 test('correlate', function() { |
| 124 const sample0Breakdown = new tr.v.d.Breakdown(); |
| 125 sample0Breakdown.set('a', 5); |
| 126 sample0Breakdown.set('b', 3); |
| 127 sample0Breakdown.set('c', 2); |
| 128 const sample1Breakdown = new tr.v.d.Breakdown(); |
| 129 sample1Breakdown.set('a', 50); |
| 130 sample1Breakdown.set('b', 30); |
| 131 sample1Breakdown.set('c', 20); |
| 132 const relatedBreakdown = new tr.v.d.RelatedHistogramBreakdown(); |
| 133 relatedBreakdown.set('a', tr.v.Histogram.create('root:a', |
| 134 tr.b.Unit.byName.timeDurationInMs, [5, 50])); |
| 135 relatedBreakdown.set('b', tr.v.Histogram.create('root:b', |
| 136 tr.b.Unit.byName.timeDurationInMs, [3, 30])); |
| 137 relatedBreakdown.set('c', tr.v.Histogram.create('root:c', |
| 138 tr.b.Unit.byName.timeDurationInMs, [2, 20])); |
| 139 const hist = tr.v.Histogram.create('root', |
| 140 tr.b.Unit.byName.timeDurationInMs, [ |
| 141 { |
| 142 value: 10, |
| 143 diagnostics: new Map([['breakdown', sample0Breakdown]]), |
| 144 }, |
| 145 { |
| 146 value: 100, |
| 147 diagnostics: new Map([['breakdown', sample1Breakdown]]), |
| 148 }, |
| 149 ], { |
| 150 diagnostics: new Map([ |
| 151 ['breakdown', relatedBreakdown], |
| 152 ]), |
| 153 }); |
| 154 const span = tr.v.ui.createDiagnosticSpan(sample0Breakdown, 'breakdown', |
| 155 hist); |
| 156 this.addHTMLOutput(span); |
| 157 const links = tr.ui.b.findDeepElementsMatching(span, |
| 158 'tr-ui-a-analysis-link'); |
| 159 assert.lengthOf(links, 4); |
| 160 assert.strictEqual(links[0].title, ''); |
| 161 assert.strictEqual(links[1].title, 'root:a'); |
| 162 assert.strictEqual(links[2].title, 'root:b'); |
| 163 assert.strictEqual(links[3].title, 'root:c'); |
| 164 assert.strictEqual(links[0].textContent, 'Select All'); |
| 165 assert.strictEqual(links[1].textContent, 'a'); |
| 166 assert.strictEqual(links[2].textContent, 'b'); |
| 167 assert.strictEqual(links[3].textContent, 'c'); |
| 168 assert.lengthOf(links[0].selection, 3); |
| 169 assert.strictEqual(links[0].selection[0], 'root:a'); |
| 170 assert.strictEqual(links[0].selection[1], 'root:b'); |
| 171 assert.strictEqual(links[0].selection[2], 'root:c'); |
| 172 assert.lengthOf(links[1].selection, 1); |
| 173 assert.strictEqual(links[1].selection[0], 'root:a'); |
| 174 assert.lengthOf(links[2].selection, 1); |
| 175 assert.strictEqual(links[2].selection[0], 'root:b'); |
| 176 assert.lengthOf(links[3].selection, 1); |
| 177 assert.strictEqual(links[3].selection[0], 'root:c'); |
| 178 }); |
122 }); | 179 }); |
123 </script> | 180 </script> |
OLD | NEW |