| 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 import chromium_deps | 5 from common import chromium_deps |
| 6 from common.dependency import DependencyRoll | 6 from common.dependency import DependencyRoll |
| 7 from crash import detect_regression_range | 7 from crash import detect_regression_range |
| 8 from crash import findit_for_fracas | 8 from crash import findit_for_chromecrash |
| 9 from crash import fracas_parser | 9 from crash import fracas_parser |
| 10 from crash import findit_for_crash | 10 from crash import findit_for_crash |
| 11 from crash.callstack import CallStack | 11 from crash.callstack import CallStack |
| 12 from crash.component_classifier import ComponentClassifier | 12 from crash.component_classifier import ComponentClassifier |
| 13 from crash.project_classifier import ProjectClassifier | 13 from crash.project_classifier import ProjectClassifier |
| 14 from crash.results import MatchResult | 14 from crash.results import MatchResult |
| 15 from crash.stacktrace import Stacktrace | 15 from crash.stacktrace import Stacktrace |
| 16 from crash.callstack import CallStack | 16 from crash.callstack import CallStack |
| 17 from crash.test.crash_testcase import CrashTestCase | 17 from crash.test.crash_testcase import CrashTestCase |
| 18 | 18 |
| 19 | 19 |
| 20 class FinditForFracasTest(CrashTestCase): | 20 class FinditForChromeCrashTest(CrashTestCase): |
| 21 | 21 |
| 22 def testFindCulpritForChromeCrashEmptyStacktrace(self): | 22 def testFindCulpritForChromeCrashEmptyStacktrace(self): |
| 23 def _MockGetChromeDependency(*_): | 23 def _MockGetChromeDependency(*_): |
| 24 return {} | 24 return {} |
| 25 | 25 |
| 26 def _MockParse(*_): | 26 def _MockParse(*_): |
| 27 return Stacktrace() | 27 return Stacktrace() |
| 28 | 28 |
| 29 self.mock(chromium_deps, 'GetChromeDependency', _MockGetChromeDependency) | 29 self.mock(chromium_deps, 'GetChromeDependency', _MockGetChromeDependency) |
| 30 self.mock(fracas_parser.FracasParser, 'Parse', _MockParse) | 30 self.mock(fracas_parser.FracasParser, 'Parse', _MockParse) |
| 31 | 31 |
| 32 expected_results = {'found': False} | 32 expected_results = {'found': False} |
| 33 expected_tag = {'found_suspects': False, | 33 expected_tag = {'found_suspects': False, |
| 34 'has_regression_range': False} | 34 'has_regression_range': False} |
| 35 | 35 |
| 36 results, tag = findit_for_fracas.FindCulpritForChromeCrash( | 36 results, tag = findit_for_chromecrash.FindCulpritForChromeCrash( |
| 37 'signature', 'win', 'frame1\nframe2', '50.0.1234.0', | 37 'signature', 'win', 'frame1\nframe2', '50.0.1234.0', |
| 38 [{'chrome_version': '50.0.1234.0', 'cpm': 0.6}]) | 38 [{'chrome_version': '50.0.1234.0', 'cpm': 0.6}]) |
| 39 | 39 |
| 40 self.assertEqual(expected_results, results) | 40 self.assertEqual(expected_results, results) |
| 41 self.assertEqual(expected_tag, tag) | 41 self.assertEqual(expected_tag, tag) |
| 42 | 42 |
| 43 def testFindCulpritForChromeCrash(self): | 43 def testFindCulpritForChromeCrash(self): |
| 44 def _MockGetChromeDependency(*_): | 44 def _MockGetChromeDependency(*_): |
| 45 return {} | 45 return {} |
| 46 | 46 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 _MockDetectRegressionRange) | 78 _MockDetectRegressionRange) |
| 79 self.mock(chromium_deps, 'GetDEPSRollsDict', _MockGetDEPSRollsDict) | 79 self.mock(chromium_deps, 'GetDEPSRollsDict', _MockGetDEPSRollsDict) |
| 80 self.mock(findit_for_crash, 'FindItForCrash', _MockFindItForCrash) | 80 self.mock(findit_for_crash, 'FindItForCrash', _MockFindItForCrash) |
| 81 | 81 |
| 82 self.mock(ComponentClassifier, 'Classify', _MockComponentClassify) | 82 self.mock(ComponentClassifier, 'Classify', _MockComponentClassify) |
| 83 self.mock(ProjectClassifier, 'Classify', _MockProjectClassify) | 83 self.mock(ProjectClassifier, 'Classify', _MockProjectClassify) |
| 84 | 84 |
| 85 expected_results = {'found': False} | 85 expected_results = {'found': False} |
| 86 expected_tag = {'found_suspects': False} | 86 expected_tag = {'found_suspects': False} |
| 87 | 87 |
| 88 results, tag = findit_for_fracas.FindCulpritForChromeCrash( | 88 results, tag = findit_for_chromecrash.FindCulpritForChromeCrash( |
| 89 'signature', 'win', 'frame1\nframe2', '50.0.1234.0', | 89 'signature', 'win', 'frame1\nframe2', '50.0.1234.0', |
| 90 [{'chrome_version': '50.0.1234.0', 'cpm': 0.6}]) | 90 [{'chrome_version': '50.0.1234.0', 'cpm': 0.6}]) |
| 91 | 91 |
| 92 expected_results = { | 92 expected_results = { |
| 93 'found': True, | 93 'found': True, |
| 94 'suspected_project': '', | 94 'suspected_project': '', |
| 95 'suspected_components': [], | 95 'suspected_components': [], |
| 96 'suspected_cls': [dummy_match_result.ToDict()], | 96 'suspected_cls': [dummy_match_result.ToDict()], |
| 97 'regression_range': ('50.0.1233.0', '50.0.1234.0'), | 97 'regression_range': ('50.0.1233.0', '50.0.1234.0'), |
| 98 } | 98 } |
| 99 expected_tag = { | 99 expected_tag = { |
| 100 'found_suspects': True, | 100 'found_suspects': True, |
| 101 'has_regression_range': True, | 101 'has_regression_range': True, |
| 102 'solution': 'core_algorithm', | 102 'solution': 'core_algorithm', |
| 103 } | 103 } |
| 104 | 104 |
| 105 self.assertEqual(expected_results, results) | 105 self.assertEqual(expected_results, results) |
| 106 self.assertEqual(expected_tag, tag) | 106 self.assertEqual(expected_tag, tag) |
| 107 | 107 |
| 108 results, tag = findit_for_fracas.FindCulpritForChromeCrash( | 108 results, tag = findit_for_chromecrash.FindCulpritForChromeCrash( |
| 109 'signature', 'win', 'frame1\nframe2', '50.0.1234.0', | 109 'signature', 'win', 'frame1\nframe2', '50.0.1234.0', |
| 110 []) | 110 []) |
| 111 | 111 |
| 112 expected_results = { | 112 expected_results = { |
| 113 'found': False, | 113 'found': False, |
| 114 'suspected_project': '', | 114 'suspected_project': '', |
| 115 'suspected_components': [], | 115 'suspected_components': [], |
| 116 'suspected_cls': [], | 116 'suspected_cls': [], |
| 117 'regression_range': None | 117 'regression_range': None |
| 118 } | 118 } |
| 119 expected_tag = { | 119 expected_tag = { |
| 120 'found_suspects': False, | 120 'found_suspects': False, |
| 121 'has_regression_range': False, | 121 'has_regression_range': False, |
| 122 'solution': 'core_algorithm', | 122 'solution': 'core_algorithm', |
| 123 } | 123 } |
| 124 | 124 |
| 125 self.assertEqual(expected_results, results) | 125 self.assertEqual(expected_results, results) |
| 126 self.assertEqual(expected_tag, tag) | 126 self.assertEqual(expected_tag, tag) |
| OLD | NEW |