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/related_value_map.html"> | 8 <link rel="import" href="/tracing/value/diagnostics/related_value_map.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/diagnostic_span.html"> | 10 <link rel="import" href="/tracing/value/ui/diagnostic_span.html"> |
11 <link rel="import" href="/tracing/value/value.html"> | 11 <link rel="import" href="/tracing/value/value.html"> |
12 | 12 |
13 <script> | 13 <script> |
14 'use strict'; | 14 'use strict'; |
15 | 15 |
16 tr.b.unittest.testSuite(function() { | 16 tr.b.unittest.testSuite(function() { |
17 var TEST_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear( | |
18 tr.v.Unit.byName.timeDurationInMs, tr.b.Range.fromExplicitRange(0, 1000), | |
19 10); | |
20 | |
21 test('instantiate_RelatedValueMap', function() { | 17 test('instantiate_RelatedValueMap', function() { |
22 var aValue = new tr.v.NumericValue('a', TEST_NUMERIC_BUILDER.build()); | 18 var aValue = new tr.v.NumericValue('a', new tr.v.Histogram( |
23 var bValue = new tr.v.NumericValue('b', TEST_NUMERIC_BUILDER.build()); | 19 tr.v.Unit.byName.unitlessNumber)); |
| 20 var bValue = new tr.v.NumericValue('b', new tr.v.Histogram( |
| 21 tr.v.Unit.byName.unitlessNumber)); |
24 var diagnostic = new tr.v.d.RelatedValueMap(); | 22 var diagnostic = new tr.v.d.RelatedValueMap(); |
25 diagnostic.set('foo', aValue); | 23 diagnostic.set('foo', aValue); |
26 diagnostic.set('bar', bValue); | 24 diagnostic.set('bar', bValue); |
27 var span = tr.v.ui.createDiagnosticSpan(diagnostic); | 25 var span = tr.v.ui.createDiagnosticSpan(diagnostic); |
28 assert.strictEqual('TR-V-UI-RELATED-VALUE-MAP-SPAN', span.tagName); | 26 assert.strictEqual('TR-V-UI-RELATED-VALUE-MAP-SPAN', span.tagName); |
29 this.addHTMLOutput(span); | 27 this.addHTMLOutput(span); |
30 assert.isDefined(tr.b.findDeepElementMatchingPredicate( | 28 assert.isDefined(tr.b.findDeepElementMatchingPredicate( |
31 span, function(element) { | 29 span, function(element) { |
32 return element.textContent === 'foo'; | 30 return element.textContent === 'foo'; |
33 })); | 31 })); |
34 assert.isDefined(tr.b.findDeepElementMatchingPredicate( | 32 assert.isDefined(tr.b.findDeepElementMatchingPredicate( |
35 span, function(element) { | 33 span, function(element) { |
36 return element.textContent === 'bar'; | 34 return element.textContent === 'bar'; |
37 })); | 35 })); |
38 }); | 36 }); |
39 }); | 37 }); |
40 </script> | 38 </script> |
OLD | NEW |