| 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="/perf_insights/mre/mre_result.html"> | 8 <link rel="import" href="/perf_insights/mre/mre_result.html"> |
| 9 <link rel="import" href="/tracing/core/test_utils.html"> | 9 <link rel="import" href="/tracing/core/test_utils.html"> |
| 10 <link rel="import" href="/tracing/extras/importer/trace_event_importer.html"> | 10 <link rel="import" href="/tracing/extras/importer/trace_event_importer.html"> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 type: ThreadSlice, | 39 type: ThreadSlice, |
| 40 name: 'some_slice', | 40 name: 'some_slice', |
| 41 start: 20, end: 30 | 41 start: 20, end: 30 |
| 42 })); | 42 })); |
| 43 } | 43 } |
| 44 }); | 44 }); |
| 45 | 45 |
| 46 assert.throw(function() { | 46 assert.throw(function() { |
| 47 var result = new pi.mre.MreResult(); | 47 var result = new pi.mre.MreResult(); |
| 48 tr.metrics.metricMapFunction(result, m, {}); | 48 tr.metrics.metricMapFunction(result, m, {}); |
| 49 }, Error, 'A metric name should be specified.'); | 49 }, Error, 'Metric names should be specified.'); |
| 50 | 50 |
| 51 assert.throw(function() { | 51 assert.throw(function() { |
| 52 var result = new pi.mre.MreResult(); | 52 var result = new pi.mre.MreResult(); |
| 53 tr.metrics.metricMapFunction(result, m, {'metric': 'wrongMetric'}); | 53 tr.metrics.metricMapFunction(result, m, {'metrics': ['wrongMetric']}); |
| 54 }, Error, '"wrongMetric" is not a registered metric.'); | 54 }, Error, '"wrongMetric" is not a registered metric.'); |
| 55 | 55 |
| 56 var result = new pi.mre.MreResult(); | 56 var result = new pi.mre.MreResult(); |
| 57 tr.metrics.metricMapFunction(result, m, {'metric': 'sampleMetric'}); | 57 tr.metrics.metricMapFunction(result, m, {'metrics': ['sampleMetric']}); |
| 58 assert.property(result.pairs, 'values'); | 58 assert.property(result.pairs, 'values'); |
| 59 assert.equal(result.pairs.values.length, 9); |
| 60 |
| 61 var result2 = new pi.mre.MreResult(); |
| 62 tr.metrics.metricMapFunction( |
| 63 result2, m, {'metrics': ['sampleMetric', 'sampleMetric2']}); |
| 64 assert.property(result2.pairs, 'values'); |
| 59 }); | 65 }); |
| 60 }); | 66 }); |
| 61 </script> | 67 </script> |
| OLD | NEW |