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/value/diagnostics/composition.html"> | 8 <link rel="import" href="/tracing/value/diagnostics/composition.html"> |
9 <link rel="import" href="/tracing/value/histogram.html"> | 9 <link rel="import" href="/tracing/value/histogram.html"> |
10 <link rel="import" href="/tracing/value/ui/composition_span.html"> | 10 <link rel="import" href="/tracing/value/ui/composition_span.html"> |
11 <link rel="import" href="/tracing/value/ui/diagnostic_span.html"> | 11 <link rel="import" href="/tracing/value/ui/diagnostic_span.html"> |
12 <link rel="import" href="/tracing/value/value.html"> | 12 <link rel="import" href="/tracing/value/value.html"> |
13 | 13 |
14 <script> | 14 <script> |
15 'use strict'; | 15 'use strict'; |
16 | 16 |
17 tr.b.unittest.testSuite(function() { | 17 tr.b.unittest.testSuite(function() { |
18 var TEST_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear( | |
19 tr.v.Unit.byName.timeDurationInMs, tr.b.Range.fromExplicitRange(0, 1), | |
20 20); | |
21 | |
22 test('instantiate_Composition', function() { | 18 test('instantiate_Composition', function() { |
23 var numeric = TEST_NUMERIC_BUILDER.build(); | 19 var numeric = new tr.v.Histogram(tr.v.Unit.byName.timeDurationInMs); |
24 var scalar = new tr.v.ScalarNumeric(tr.v.Unit.byName.timeDurationInMs, 42); | 20 var scalar = new tr.v.ScalarNumeric(tr.v.Unit.byName.timeDurationInMs, 42); |
25 for (var i = 0; i < 1e2; ++i) { | 21 for (var i = 0; i < 1e2; ++i) { |
26 numeric.add(Math.random()); | 22 numeric.add(Math.random()); |
27 } | 23 } |
28 var composition = new tr.v.d.Composition(); | 24 var composition = new tr.v.d.Composition(); |
29 composition.add(new tr.v.NumericValue('numeric', numeric)); | 25 composition.add(new tr.v.NumericValue('numeric', numeric)); |
30 composition.add(new tr.v.NumericValue('scalar', scalar)); | 26 composition.add(new tr.v.NumericValue('scalar', scalar)); |
31 var span = tr.v.ui.createDiagnosticSpan(composition); | 27 var span = tr.v.ui.createDiagnosticSpan(composition); |
32 assert.strictEqual('TR-V-UI-COMPOSITION-SPAN', span.tagName); | 28 assert.strictEqual('TR-V-UI-COMPOSITION-SPAN', span.tagName); |
33 this.addHTMLOutput(span); | 29 this.addHTMLOutput(span); |
34 }); | 30 }); |
35 }); | 31 }); |
36 </script> | 32 </script> |
OLD | NEW |