| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 | 4 |
| 5 from common.blame import Region, Blame | 5 from common.blame import Region, Blame |
| 6 from common.change_log import ChangeLog | 6 from common.change_log import ChangeLog |
| 7 from crash.callstack import StackFrame | 7 from crash.callstack import StackFrame |
| 8 from crash.results import Result, MatchResult, MatchResults | 8 from crash.results import Result, MatchResult, MatchResults |
| 9 from crash.test.crash_test_suite import CrashTestSuite | 9 from crash.test.crash_test_suite import CrashTestSuite |
| 10 | 10 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 result = Result(DUMMY_CHANGELOG1, 'src/', | 99 result = Result(DUMMY_CHANGELOG1, 'src/', |
| 100 confidence=1, reason='some reason') | 100 confidence=1, reason='some reason') |
| 101 | 101 |
| 102 expected_result_str = '' | 102 expected_result_str = '' |
| 103 self.assertEqual(result.ToString(), expected_result_str) | 103 self.assertEqual(result.ToString(), expected_result_str) |
| 104 | 104 |
| 105 result.file_to_stack_infos = { | 105 result.file_to_stack_infos = { |
| 106 'a.cc': [(StackFrame(0, 'src/', 'func', 'a.cc', 'src/a.cc', []), 0)] | 106 'a.cc': [(StackFrame(0, 'src/', 'func', 'a.cc', 'src/a.cc', []), 0)] |
| 107 } | 107 } |
| 108 expected_result_str = 'Changed file a.cc crashed in func (#0)' | 108 expected_result_str = 'Changed file a.cc crashed in frame #0' |
| 109 | 109 |
| 110 self.assertEqual(str(result), expected_result_str) | 110 self.assertEqual(str(result), expected_result_str) |
| 111 | 111 |
| 112 def testMatchResultUpdate(self): | 112 def testMatchResultUpdate(self): |
| 113 # Touched lines have intersection with crashed lines. | 113 # Touched lines have intersection with crashed lines. |
| 114 result = MatchResult(DUMMY_CHANGELOG1, 'src/', | 114 result = MatchResult(DUMMY_CHANGELOG1, 'src/', |
| 115 confidence=1, reason='some reason') | 115 confidence=1, reason='some reason') |
| 116 stack_infos = [(StackFrame(0, 'src/', 'func', 'a.cc', 'src/a.cc', [7]), 0)] | 116 stack_infos = [(StackFrame(0, 'src/', 'func', 'a.cc', 'src/a.cc', [7]), 0)] |
| 117 | 117 |
| 118 result.Update('a.cc', stack_infos, DUMMY_BLAME) | 118 result.Update('a.cc', stack_infos, DUMMY_BLAME) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 expected_match_result.file_to_stack_infos = { | 154 expected_match_result.file_to_stack_infos = { |
| 155 'a.cc': stack_infos1, | 155 'a.cc': stack_infos1, |
| 156 'b.cc': stack_infos2 | 156 'b.cc': stack_infos2 |
| 157 } | 157 } |
| 158 expected_match_result.min_distance = 0 | 158 expected_match_result.min_distance = 0 |
| 159 | 159 |
| 160 expected_match_results = MatchResults(ignore_cls=set(['2'])) | 160 expected_match_results = MatchResults(ignore_cls=set(['2'])) |
| 161 expected_match_results['1'] = expected_match_result | 161 expected_match_results['1'] = expected_match_result |
| 162 | 162 |
| 163 self._VerifyTwoMatchResultsEqual(match_results, expected_match_results) | 163 self._VerifyTwoMatchResultsEqual(match_results, expected_match_results) |
| OLD | NEW |