| 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', []), 0)] | 106 'a.cc': [(StackFrame(0, 'src/', '', 'func', 'a.cc', []), 0)] |
| 107 } | 107 } |
| 108 expected_result_str = 'Changed file a.cc which crashed in func (#0)' | 108 expected_result_str = 'Changed file a.cc crashed in func (#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', [7]), 0)] | 116 stack_infos = [(StackFrame(0, 'src/', '', 'func', '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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 expected_match_result.file_to_stack_infos = { | 152 expected_match_result.file_to_stack_infos = { |
| 153 'a.cc': stack_infos1, | 153 'a.cc': stack_infos1, |
| 154 'b.cc': stack_infos2 | 154 'b.cc': stack_infos2 |
| 155 } | 155 } |
| 156 expected_match_result.min_distance = 0 | 156 expected_match_result.min_distance = 0 |
| 157 | 157 |
| 158 expected_match_results = MatchResults(ignore_cls=set(['2'])) | 158 expected_match_results = MatchResults(ignore_cls=set(['2'])) |
| 159 expected_match_results['1'] = expected_match_result | 159 expected_match_results['1'] = expected_match_result |
| 160 | 160 |
| 161 self._VerifyTwoMatchResultsEqual(match_results, expected_match_results) | 161 self._VerifyTwoMatchResultsEqual(match_results, expected_match_results) |
| OLD | NEW |