diff options
author | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-10 20:25:23 +0000 |
---|---|---|
committer | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-10 20:25:23 +0000 |
commit | ac25f9e297099a699d6b9eadae6c906d68e55cf1 (patch) | |
tree | c147822045d632139f1e79aa615720dbf53284e1 /tools | |
parent | 663f3fc11ff3f33e53c9f332403c789bef0109ad (diff) | |
download | chromium_src-ac25f9e297099a699d6b9eadae6c906d68e55cf1.zip chromium_src-ac25f9e297099a699d6b9eadae6c906d68e55cf1.tar.gz chromium_src-ac25f9e297099a699d6b9eadae6c906d68e55cf1.tar.bz2 |
Telemetry: Add tests which would've caught the memory_benchmark breakage.
BUG=169084
R=nduca
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/11778100
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176143 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r-- | tools/telemetry/telemetry/csv_page_benchmark_results_unittest.py | 23 | ||||
-rw-r--r-- | tools/telemetry/telemetry/page_benchmark_results_unittest.py | 29 |
2 files changed, 52 insertions, 0 deletions
diff --git a/tools/telemetry/telemetry/csv_page_benchmark_results_unittest.py b/tools/telemetry/telemetry/csv_page_benchmark_results_unittest.py index db57b35..f18807d 100644 --- a/tools/telemetry/telemetry/csv_page_benchmark_results_unittest.py +++ b/tools/telemetry/telemetry/csv_page_benchmark_results_unittest.py @@ -103,4 +103,27 @@ class CsvPageBenchmarkResultsTest(unittest.TestCase): [[self._page_set[0].url, '-', '3'], [self._page_set[1].url, '4', '-']]) + def test_histogram(self): + results = NonPrintingCsvPageBenchmarkResults(csv.writer(self._output), + False) + results.WillMeasurePage(self._page_set[0]) + results.Add('a', '', + '{"buckets": [{"low": 1, "high": 2, "count": 1}]}', + data_type='histogram') + results.DidMeasurePage() + + results.WillMeasurePage(self._page_set[1]) + results.Add('a', '', + '{"buckets": [{"low": 2, "high": 3, "count": 1}]}', + data_type='histogram') + results.DidMeasurePage() + results.PrintSummary('tag') + + self.assertEquals( + self.output_header_row, + ['url', 'a ()']) + self.assertEquals( + self.output_data_rows, + [[self._page_set[0].url, '1.5'], + [self._page_set[1].url, '2.5']]) diff --git a/tools/telemetry/telemetry/page_benchmark_results_unittest.py b/tools/telemetry/telemetry/page_benchmark_results_unittest.py index fec3aaf..f2e5ab2 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) |