| OLD | NEW |
| (Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 from common import chromium_deps |
| 6 from crash import detect_regression_range |
| 7 from crash import fracas |
| 8 from crash import fracas_parser |
| 9 from crash import findit_for_crash |
| 10 from crash.stacktrace import Stacktrace |
| 11 from crash.test.crash_testcase import CrashTestCase |
| 12 |
| 13 |
| 14 class FracasTest(CrashTestCase): |
| 15 |
| 16 def testFindCulpritForChromeCrash(self): |
| 17 def _MockGetChromeDependency(*_): |
| 18 return {} |
| 19 |
| 20 def _MockParse(*_): |
| 21 return Stacktrace() |
| 22 |
| 23 def _MockDetectRegressionRange(historic): |
| 24 if historic: |
| 25 return '50.0.1233.0', '50.0.1234.0' |
| 26 |
| 27 return None |
| 28 |
| 29 def _MockGetDEPSRollsDict(*_): |
| 30 return {} |
| 31 |
| 32 def _MockFindItForCrash(*_): |
| 33 return [] |
| 34 |
| 35 self.mock(chromium_deps, 'GetChromeDependency', _MockGetChromeDependency) |
| 36 self.mock(fracas_parser.FracasParser, 'Parse', _MockParse) |
| 37 self.mock(detect_regression_range, 'DetectRegressionRange', |
| 38 _MockDetectRegressionRange) |
| 39 self.mock(chromium_deps, 'GetDEPSRollsDict', _MockGetDEPSRollsDict) |
| 40 self.mock(findit_for_crash, 'FindItForCrash', _MockFindItForCrash) |
| 41 |
| 42 expected_results = { |
| 43 'found': False, |
| 44 'suspected_project': '', |
| 45 'suspected_components': [], |
| 46 'culprits': [], |
| 47 } |
| 48 |
| 49 expected_tag = { |
| 50 'found_suspects': False, |
| 51 'has_regression_range': True, |
| 52 'solution': 'core_algorithm', |
| 53 } |
| 54 |
| 55 results, tag = fracas.FindCulpritForChromeCrash( |
| 56 'signature', 'win', 'frame1\nframe2', '50.0.1234.0', |
| 57 [{'chrome_version': '50.0.1234.0', 'cpm': 0.6}]) |
| 58 |
| 59 self.assertEqual(expected_results, results) |
| 60 self.assertEqual(expected_tag, tag) |
| 61 |
| 62 results, tag = fracas.FindCulpritForChromeCrash( |
| 63 'signature', 'win', 'frame1\nframe2', '50.0.1234.0', []) |
| 64 |
| 65 expected_tag['has_regression_range'] = False |
| 66 self.assertEqual(expected_tag, tag) |
| OLD | NEW |