| 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 copy | 6 import copy |
| 7 import difflib | 7 import difflib |
| 8 import itertools | 8 import itertools |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 def test_ConsoleNullDiff(self): | 80 def test_ConsoleNullDiff(self): |
| 81 with tempfile.NamedTemporaryFile(suffix='.size') as temp_file: | 81 with tempfile.NamedTemporaryFile(suffix='.size') as temp_file: |
| 82 file_format.SaveSizeInfo(self._CloneSizeInfo(), temp_file.name) | 82 file_format.SaveSizeInfo(self._CloneSizeInfo(), temp_file.name) |
| 83 return _RunApp('console.py', '--query', 'Diff(size_info1, size_info2)', | 83 return _RunApp('console.py', '--query', 'Diff(size_info1, size_info2)', |
| 84 temp_file.name, temp_file.name) | 84 temp_file.name, temp_file.name) |
| 85 | 85 |
| 86 @_CompareWithGolden | 86 @_CompareWithGolden |
| 87 def test_ActualDiff(self): | 87 def test_ActualDiff(self): |
| 88 map1 = self._CloneSizeInfo() | 88 map1 = self._CloneSizeInfo() |
| 89 map2 = self._CloneSizeInfo() | 89 map2 = self._CloneSizeInfo() |
| 90 map1.metadata = {"foo": 1, "bar": [1,2,3], "baz": "yes"} |
| 91 map2.metadata = {"foo": 1, "bar": [1,3], "baz": "yes"} |
| 90 map1.symbols -= map1.symbols[0] | 92 map1.symbols -= map1.symbols[0] |
| 91 map2.symbols -= map2.symbols[-1] | 93 map2.symbols -= map2.symbols[-1] |
| 92 map1.symbols[1].size -= 10 | 94 map1.symbols[1].size -= 10 |
| 93 diff = models.Diff(map1, map2) | 95 diff = models.Diff(map1, map2) |
| 94 return describe.GenerateLines(diff, verbose=True) | 96 return describe.GenerateLines(diff, verbose=True) |
| 95 | 97 |
| 96 @_CompareWithGolden | 98 @_CompareWithGolden |
| 97 def test_SymbolGroupMethods(self): | 99 def test_SymbolGroupMethods(self): |
| 98 all_syms = self._CloneSizeInfo().symbols | 100 all_syms = self._CloneSizeInfo().symbols |
| 99 global_syms = all_syms.WhereNameMatches('GLOBAL') | 101 global_syms = all_syms.WhereNameMatches('GLOBAL') |
| (...skipping 22 matching lines...) Expand all Loading... |
| 122 if len(argv) > 1 and argv[1] == '--update': | 124 if len(argv) > 1 and argv[1] == '--update': |
| 123 argv.pop(0) | 125 argv.pop(0) |
| 124 global update_goldens | 126 global update_goldens |
| 125 update_goldens = True | 127 update_goldens = True |
| 126 | 128 |
| 127 unittest.main(argv=argv, verbosity=2) | 129 unittest.main(argv=argv, verbosity=2) |
| 128 | 130 |
| 129 | 131 |
| 130 if __name__ == '__main__': | 132 if __name__ == '__main__': |
| 131 main() | 133 main() |
| OLD | NEW |