OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 import StringIO | 4 import StringIO |
5 import csv | 5 import csv |
6 import os | 6 import os |
7 import unittest | 7 import unittest |
8 | 8 |
9 from telemetry.csv_page_benchmark_results import CsvPageBenchmarkResults | 9 from telemetry.page import csv_page_benchmark_results |
10 from telemetry.page_set import PageSet | 10 from telemetry.page import page_set |
11 | 11 |
12 def _MakePageSet(): | 12 def _MakePageSet(): |
13 return PageSet.FromDict({ | 13 return page_set.PageSet.FromDict({ |
14 "description": "hello", | 14 "description": "hello", |
15 "pages": [ | 15 "pages": [ |
16 {"url": "http://www.foo.com/"}, | 16 {"url": "http://www.foo.com/"}, |
17 {"url": "http://www.bar.com/"} | 17 {"url": "http://www.bar.com/"} |
18 ] | 18 ] |
19 }, os.path.dirname(__file__)) | 19 }, os.path.dirname(__file__)) |
20 | 20 |
21 class NonPrintingCsvPageBenchmarkResults(CsvPageBenchmarkResults): | 21 class NonPrintingCsvPageBenchmarkResults( |
| 22 csv_page_benchmark_results.CsvPageBenchmarkResults): |
22 def __init__(self, *args): | 23 def __init__(self, *args): |
23 super(NonPrintingCsvPageBenchmarkResults, self).__init__(*args) | 24 super(NonPrintingCsvPageBenchmarkResults, self).__init__(*args) |
24 | 25 |
25 def _PrintPerfResult(self, *args): | 26 def _PrintPerfResult(self, *args): |
26 pass | 27 pass |
27 | 28 |
28 class CsvPageBenchmarkResultsTest(unittest.TestCase): | 29 class CsvPageBenchmarkResultsTest(unittest.TestCase): |
29 def setUp(self): | 30 def setUp(self): |
30 self._output = StringIO.StringIO() | 31 self._output = StringIO.StringIO() |
31 self._page_set = _MakePageSet() | 32 self._page_set = _MakePageSet() |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 120 |
120 results.PrintSummary('tag') | 121 results.PrintSummary('tag') |
121 | 122 |
122 self.assertEquals( | 123 self.assertEquals( |
123 self.output_header_row, | 124 self.output_header_row, |
124 ['url', 'a ()']) | 125 ['url', 'a ()']) |
125 self.assertEquals( | 126 self.assertEquals( |
126 self.output_data_rows, | 127 self.output_data_rows, |
127 [[self._page_set[0].url, '1.5'], | 128 [[self._page_set[0].url, '1.5'], |
128 [self._page_set[1].url, '2.5']]) | 129 [self._page_set[1].url, '2.5']]) |
OLD | NEW |