Index: tools/telemetry/telemetry/page_benchmark_results_unittest.py |
diff --git a/tools/telemetry/telemetry/page_benchmark_results_unittest.py b/tools/telemetry/telemetry/page_benchmark_results_unittest.py |
index fec3aafcbbe0cd7e6789a16241e216b6edb035a5..f2e5ab2f0b9596e6b36c237a644d6e2acc3ab10c 100644 |
--- a/tools/telemetry/telemetry/page_benchmark_results_unittest.py |
+++ b/tools/telemetry/telemetry/page_benchmark_results_unittest.py |
@@ -105,3 +105,32 @@ class PageBenchmarkResultsTest(unittest.TestCase): |
self.assertEquals( |
benchmark_results.results, |
expected) |
+ |
+ def test_histogram(self): |
+ page_set = _MakePageSet() |
+ |
+ benchmark_results = SummarySavingPageBenchmarkResults() |
+ benchmark_results.WillMeasurePage(page_set.pages[0]) |
+ benchmark_results.Add('a', '', |
+ '{"buckets": [{"low": 1, "high": 2, "count": 1}]}', |
+ data_type='histogram') |
+ benchmark_results.DidMeasurePage() |
+ |
+ benchmark_results.WillMeasurePage(page_set.pages[1]) |
+ benchmark_results.Add('a', '', |
+ '{"buckets": [{"low": 2, "high": 3, "count": 1}]}', |
+ data_type='histogram') |
+ benchmark_results.DidMeasurePage() |
+ |
+ benchmark_results.PrintSummary(None) |
+ |
+ expected = [ |
+ '*HISTOGRAM a_by_url.http___www.foo.com_: ' + |
+ 'a_by_url.http___www.foo.com_= ' + |
+ '{"buckets": [{"low": 1, "high": 2, "count": 1}]}\n' + |
+ 'Avg a_by_url.http___www.foo.com_: 1.500000', |
+ '*HISTOGRAM a_by_url.http___www.bar.com_: ' + |
+ 'a_by_url.http___www.bar.com_= ' + |
+ '{"buckets": [{"low": 2, "high": 3, "count": 1}]}\n' + |
+ 'Avg a_by_url.http___www.bar.com_: 2.500000'] |
+ self.assertEquals(benchmark_results.results, expected) |