OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2017 The Chromium Authors. All rights reserved. | 2 # Copyright 2017 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import contextlib | 6 import contextlib |
7 import copy | 7 import copy |
8 import difflib | 8 import difflib |
9 import glob | 9 import glob |
10 import itertools | 10 import itertools |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 return self._DoArchiveTest(debug_measures=True) | 150 return self._DoArchiveTest(debug_measures=True) |
151 | 151 |
152 @_CompareWithGolden() | 152 @_CompareWithGolden() |
153 def test_Console(self): | 153 def test_Console(self): |
154 with tempfile.NamedTemporaryFile(suffix='.size') as size_file, \ | 154 with tempfile.NamedTemporaryFile(suffix='.size') as size_file, \ |
155 tempfile.NamedTemporaryFile(suffix='.txt') as output_file: | 155 tempfile.NamedTemporaryFile(suffix='.txt') as output_file: |
156 file_format.SaveSizeInfo(self._CloneSizeInfo(), size_file.name) | 156 file_format.SaveSizeInfo(self._CloneSizeInfo(), size_file.name) |
157 query = [ | 157 query = [ |
158 'ShowExamples()', | 158 'ShowExamples()', |
159 'ExpandRegex("_foo_")', | 159 'ExpandRegex("_foo_")', |
| 160 'CategorizeGenerated()', |
| 161 'CategorizeByChromeComponent()', |
160 'Print(size_info, to_file=%r)' % output_file.name, | 162 'Print(size_info, to_file=%r)' % output_file.name, |
161 ] | 163 ] |
162 ret = _RunApp('console', [size_file.name, '--query', '; '.join(query)]) | 164 ret = _RunApp('console', [size_file.name, '--query', '; '.join(query)]) |
163 with open(output_file.name) as f: | 165 with open(output_file.name) as f: |
164 ret.extend(l.rstrip() for l in f) | 166 ret.extend(l.rstrip() for l in f) |
165 return ret | 167 return ret |
166 | 168 |
167 @_CompareWithGolden() | 169 @_CompareWithGolden() |
168 def test_Diff_NullDiff(self): | 170 def test_Diff_NullDiff(self): |
169 with tempfile.NamedTemporaryFile(suffix='.size') as temp_file: | 171 with tempfile.NamedTemporaryFile(suffix='.size') as temp_file: |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 global update_goldens | 297 global update_goldens |
296 update_goldens = True | 298 update_goldens = True |
297 for f in glob.glob(os.path.join(_TEST_DATA_DIR, '*.golden')): | 299 for f in glob.glob(os.path.join(_TEST_DATA_DIR, '*.golden')): |
298 os.unlink(f) | 300 os.unlink(f) |
299 | 301 |
300 unittest.main(argv=argv, verbosity=2) | 302 unittest.main(argv=argv, verbosity=2) |
301 | 303 |
302 | 304 |
303 if __name__ == '__main__': | 305 if __name__ == '__main__': |
304 main() | 306 main() |
OLD | NEW |