| 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 import re | 5 import re |
| 6 | 6 |
| 7 from google.appengine.api import users | 7 from google.appengine.api import users |
| 8 | 8 |
| 9 from common.findit_testcase import FinditTestCase | 9 from crash.test.crash_testcase import CrashTestCase |
| 10 from crash.type_enums import CrashClient | 10 from crash.type_enums import CrashClient |
| 11 from model.crash.crash_config import CrashConfig | 11 from model.crash.crash_config import CrashConfig |
| 12 | 12 |
| 13 | 13 |
| 14 DUMMY_COMPILED_COMPONENT_PATTERNS = { | 14 DUMMY_COMPILED_COMPONENT_PATTERNS = { |
| 15 "path_function_component": [ | 15 "path_function_component": [ |
| 16 [ | 16 [ |
| 17 re.compile("src/comp1.*"), | 17 re.compile("src/comp1.*"), |
| 18 None, | 18 None, |
| 19 "Comp1>Dummy" | 19 "Comp1>Dummy" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 42 ], | 42 ], |
| 43 ], | 43 ], |
| 44 "top_n": 4 | 44 "top_n": 4 |
| 45 } | 45 } |
| 46 | 46 |
| 47 CONFIG_DATA = { | 47 CONFIG_DATA = { |
| 48 'component_classifier': DUMMY_COMPONENT_PATTERNS, | 48 'component_classifier': DUMMY_COMPONENT_PATTERNS, |
| 49 } | 49 } |
| 50 | 50 |
| 51 | 51 |
| 52 class CrashAnalysisTest(FinditTestCase): | 52 class CrashAnalysisTest(CrashTestCase): |
| 53 | 53 |
| 54 def setUp(self): | 54 def setUp(self): |
| 55 super(CrashAnalysisTest, self).setUp() | 55 super(CrashAnalysisTest, self).setUp() |
| 56 CrashConfig.Get().Update( | 56 CrashConfig.Get().Update( |
| 57 users.User(email='admin@chromium.org'), True, **CONFIG_DATA) | 57 users.User(email='admin@chromium.org'), True, **CONFIG_DATA) |
| 58 | 58 |
| 59 def _VerifyTwoCompiledComponentClassifierEqual(self, setting1, setting2): | 59 def _VerifyTwoCompiledComponentClassifierEqual(self, setting1, setting2): |
| 60 self.assertEqual(setting1['top_n'], setting2['top_n']) | 60 self.assertEqual(setting1['top_n'], setting2['top_n']) |
| 61 self.assertEqual(len(setting1['path_function_component']), | 61 self.assertEqual(len(setting1['path_function_component']), |
| 62 len(setting2['path_function_component'])) | 62 len(setting2['path_function_component'])) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 self.assertEqual(crash_config.component_classifier, | 94 self.assertEqual(crash_config.component_classifier, |
| 95 DUMMY_COMPONENT_PATTERNS) | 95 DUMMY_COMPONENT_PATTERNS) |
| 96 self._VerifyTwoCompiledComponentClassifierEqual( | 96 self._VerifyTwoCompiledComponentClassifierEqual( |
| 97 crash_config.compiled_component_classifier, | 97 crash_config.compiled_component_classifier, |
| 98 DUMMY_COMPILED_COMPONENT_PATTERNS) | 98 DUMMY_COMPILED_COMPONENT_PATTERNS) |
| 99 | 99 |
| 100 def testGetClientConfig(self): | 100 def testGetClientConfig(self): |
| 101 crash_config = CrashConfig.Get() | 101 crash_config = CrashConfig.Get() |
| 102 self.assertIsNotNone(crash_config.GetClientConfig(CrashClient.FRACAS)) | 102 self.assertIsNotNone(crash_config.GetClientConfig(CrashClient.FRACAS)) |
| 103 self.assertIsNone(crash_config.GetClientConfig('Unsupported_client')) | 103 self.assertIsNone(crash_config.GetClientConfig('Unsupported_client')) |
| OLD | NEW |