OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2015 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/assert_utils.html"> | 8 <link rel="import" href="/tracing/base/assert_utils.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/histogram.html"> | 10 <link rel="import" href="/tracing/value/histogram.html"> |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 span.referenceHistogram = tr.v.Histogram.create('', | 246 span.referenceHistogram = tr.v.Histogram.create('', |
247 tr.b.Unit.byName.unitlessNumber, [2, 20, 200], { | 247 tr.b.Unit.byName.unitlessNumber, [2, 20, 200], { |
248 binBoundaries: tr.v.HistogramBinBoundaries.SINGULAR, | 248 binBoundaries: tr.v.HistogramBinBoundaries.SINGULAR, |
249 }); | 249 }); |
250 this.addHTMLOutput(span); | 250 this.addHTMLOutput(span); |
251 }); | 251 }); |
252 | 252 |
253 test('breakdownUnit', async function() { | 253 test('breakdownUnit', async function() { |
254 const root = new tr.v.Histogram('root', tr.b.Unit.byName.sizeInBytes); | 254 const root = new tr.v.Histogram('root', tr.b.Unit.byName.sizeInBytes); |
255 const sampleBreakdown = new tr.v.d.Breakdown(); | 255 const sampleBreakdown = new tr.v.d.Breakdown(); |
256 sampleBreakdown.set('x', 30 << 20); | 256 sampleBreakdown.set('x', 30 << 20, 'a'); |
257 sampleBreakdown.set('y', 70 << 20); | 257 sampleBreakdown.set('y', 70 << 20, 'b'); |
258 root.addSample(100 << 20, {sampleBreakdown}); | 258 root.addSample(100 << 20, {sampleBreakdown}); |
259 const rhb = new tr.v.d.RelatedHistogramBreakdown(); | |
260 root.diagnostics.set('rhb', rhb); | |
261 const aHist = new tr.v.Histogram('a', tr.b.Unit.byName.sizeInBytes); | 259 const aHist = new tr.v.Histogram('a', tr.b.Unit.byName.sizeInBytes); |
262 rhb.set('a', aHist); | |
263 aHist.addSample(10 << 20); | 260 aHist.addSample(10 << 20); |
264 const bHist = new tr.v.Histogram('b', tr.b.Unit.byName.sizeInBytes); | 261 const bHist = new tr.v.Histogram('b', tr.b.Unit.byName.sizeInBytes); |
265 rhb.set('b', bHist); | |
266 bHist.addSample(90 << 20); | 262 bHist.addSample(90 << 20); |
267 const span = document.createElement('tr-v-ui-histogram-span'); | 263 const span = document.createElement('tr-v-ui-histogram-span'); |
268 this.addHTMLOutput(span); | 264 this.addHTMLOutput(span); |
269 span.histogram = root; | 265 span.histogram = root; |
270 assert.isDefined(tr.ui.b.findDeepElementMatchingPredicate( | 266 assert.isDefined(tr.ui.b.findDeepElementMatchingPredicate( |
271 span, e => e.textContent === '100.0 MiB')); | 267 span, e => e.textContent === '100.0 MiB')); |
272 assert.isDefined(tr.ui.b.findDeepElementMatchingPredicate( | 268 assert.isDefined(tr.ui.b.findDeepElementMatchingPredicate( |
273 span, e => e.textContent === '30.0 MiB')); | 269 span, e => e.textContent === '30.0 MiB')); |
274 assert.isDefined(tr.ui.b.findDeepElementMatchingPredicate( | 270 assert.isDefined(tr.ui.b.findDeepElementMatchingPredicate( |
275 span, e => e.textContent === '70.0 MiB')); | 271 span, e => e.textContent === '70.0 MiB')); |
(...skipping 11 matching lines...) Expand all Loading... |
287 {value: 1, diagnostics: new Map([ | 283 {value: 1, diagnostics: new Map([ |
288 ['sample diagnostic', new tr.v.d.GenericSet(['value1'])], | 284 ['sample diagnostic', new tr.v.d.GenericSet(['value1'])], |
289 ])}, | 285 ])}, |
290 {value: 10, diagnostics: new Map([ | 286 {value: 10, diagnostics: new Map([ |
291 ['sample diagnostic', new tr.v.d.GenericSet(['value10'])], | 287 ['sample diagnostic', new tr.v.d.GenericSet(['value10'])], |
292 ])}, | 288 ])}, |
293 ], { | 289 ], { |
294 diagnostics: new Map([ | 290 diagnostics: new Map([ |
295 [tr.v.d.RESERVED_NAMES.BENCHMARKS, new tr.v.d.GenericSet([ | 291 [tr.v.d.RESERVED_NAMES.BENCHMARKS, new tr.v.d.GenericSet([ |
296 'system_health.common_desktop'])], | 292 'system_health.common_desktop'])], |
297 ['breakdown', new tr.v.d.RelatedHistogramBreakdown()], | 293 ['breakdown', new tr.v.d.Breakdown()], |
298 ]), | 294 ]), |
299 }); | 295 }); |
300 this.addHTMLOutput(span); | 296 this.addHTMLOutput(span); |
301 const metric = tr.ui.b.findDeepElementMatching( | 297 const metric = tr.ui.b.findDeepElementMatching( |
302 span, '#metric_diagnostics'); | 298 span, '#metric_diagnostics'); |
303 assert.strictEqual(span.rowState.diagnosticsTab, metric.tabLabel); | 299 assert.strictEqual(span.rowState.diagnosticsTab, metric.tabLabel); |
304 const tabs = tr.ui.b.findDeepElementMatching( | 300 const tabs = tr.ui.b.findDeepElementMatching( |
305 span, 'TR-UI-B-TAB-VIEW'); | 301 span, 'TR-UI-B-TAB-VIEW'); |
306 assert.strictEqual(tabs.selectedSubView, metric); | 302 assert.strictEqual(tabs.selectedSubView, metric); |
307 | 303 |
308 const sample = tr.ui.b.findDeepElementMatching( | 304 const sample = tr.ui.b.findDeepElementMatching( |
309 span, '#sample_diagnostics_container'); | 305 span, '#sample_diagnostics_container'); |
310 await span.rowState.update({diagnosticsTab: sample.tabLabel}); | 306 await span.rowState.update({diagnosticsTab: sample.tabLabel}); |
311 // Need to wait an extra frame here because updateDiagnostics_ cannot await | 307 // Need to wait an extra frame here because updateDiagnostics_ cannot await |
312 // on onSelectedDiagnosticsChanged_, which is called via the | 308 // on onSelectedDiagnosticsChanged_, which is called via the |
313 // selected-tab-change event. | 309 // selected-tab-change event. |
314 await tr.b.animationFrame(); | 310 await tr.b.animationFrame(); |
315 assert.strictEqual(tabs.selectedSubView, sample); | 311 assert.strictEqual(tabs.selectedSubView, sample); |
316 | 312 |
317 const metadata = tr.ui.b.findDeepElementMatching( | 313 const metadata = tr.ui.b.findDeepElementMatching( |
318 span, '#metadata_diagnostics'); | 314 span, '#metadata_diagnostics'); |
319 await span.rowState.update({diagnosticsTab: metadata.tabLabel}); | 315 await span.rowState.update({diagnosticsTab: metadata.tabLabel}); |
320 assert.strictEqual(tabs.selectedSubView, metadata); | 316 assert.strictEqual(tabs.selectedSubView, metadata); |
321 }); | 317 }); |
322 }); | 318 }); |
323 </script> | 319 </script> |
OLD | NEW |