| 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 """This module is interfacas between clients-specific code and core. | 5 """This module is interfacas between clients-specific code and core. |
| 6 | 6 |
| 7 Note, fracas and cracas are almost identical and fracas is an intermidiate | 7 Note, fracas and cracas are almost identical and fracas is an intermidiate |
| 8 state while transfering to cracas, so they can be handled in the same code path | 8 state while transfering to cracas, so they can be handled in the same code path |
| 9 and can be referred to as chromecrash.""" | 9 and can be referred to as chromecrash.""" |
| 10 | 10 |
| 11 import copy | 11 import copy |
| 12 import json | 12 import json |
| 13 import logging | 13 import logging |
| 14 | 14 |
| 15 from google.appengine.ext import ndb | 15 from google.appengine.ext import ndb |
| 16 | 16 |
| 17 from common import appengine_util | 17 from common import appengine_util |
| 18 from common import time_util | 18 from common import time_util |
| 19 from crash import findit_for_chromecrash | 19 from crash import findit_for_chromecrash |
| 20 from crash.type_enums import CrashClient | 20 from crash.type_enums import CrashClient |
| 21 from model import analysis_status | 21 from model import analysis_status |
| 22 from model.crash.crash_config import CrashConfig | 22 from model.crash.crash_config import CrashConfig |
| 23 from model.crash.fracas_crash_analysis import FracasCrashAnalysis | 23 from model.crash.fracas_crash_analysis import FracasCrashAnalysis |
| 24 from model.crash.cracas_crash_analysis import CracasCrashAnalysis |
| 24 | 25 |
| 25 # TODO(katesonia): Move this to fracas config. | 26 # TODO(katesonia): Move this to fracas config. |
| 26 _FINDIT_FRACAS_FEEDBACK_URL_TEMPLATE = '%s/crash/fracas-result-feedback?key=%s' | 27 _FINDIT_FRACAS_FEEDBACK_URL_TEMPLATE = '%s/crash/fracas-result-feedback?key=%s' |
| 27 # TODO(katesonia): Move this to a common config in config page. | 28 # TODO(katesonia): Move this to a common config in config page. |
| 28 _SUPPORTED_CLIENTS = [CrashClient.FRACAS] | 29 _SUPPORTED_CLIENTS = [CrashClient.FRACAS] |
| 29 | 30 |
| 30 | 31 |
| 31 def CheckPolicyForClient(crash_identifiers, chrome_version, signature, | 32 def CheckPolicyForClient(crash_identifiers, chrome_version, signature, |
| 32 client_id, platform, stack_trace, customized_data): | 33 client_id, platform, stack_trace, customized_data): |
| 33 """Checks if args pass client policy and updates parameters.""" | 34 """Checks if args pass client policy and updates parameters.""" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 71 |
| 71 return True, (crash_identifiers, chrome_version, signature, client_id, | 72 return True, (crash_identifiers, chrome_version, signature, client_id, |
| 72 platform, stack_trace, customized_data) | 73 platform, stack_trace, customized_data) |
| 73 | 74 |
| 74 | 75 |
| 75 def GetAnalysisForClient(crash_identifiers, client_id): | 76 def GetAnalysisForClient(crash_identifiers, client_id): |
| 76 """Gets analysis entity based on client id.""" | 77 """Gets analysis entity based on client id.""" |
| 77 if client_id == CrashClient.FRACAS: | 78 if client_id == CrashClient.FRACAS: |
| 78 return FracasCrashAnalysis.Get(crash_identifiers) | 79 return FracasCrashAnalysis.Get(crash_identifiers) |
| 79 elif client_id == CrashClient.CRACAS: # pragma: no cover. | 80 elif client_id == CrashClient.CRACAS: # pragma: no cover. |
| 80 # TODO(katesonia): Add CracasCrashAnalysis model. | 81 return CracasCrashAnalysis.Get(crash_identifiers) |
| 81 return None | |
| 82 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. | 82 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. |
| 83 # TODO(katesonia): Add ClusterfuzzCrashAnalysis model. | 83 # TODO(katesonia): Add ClusterfuzzCrashAnalysis model. |
| 84 return None | 84 return None |
| 85 | 85 |
| 86 return None | 86 return None |
| 87 | 87 |
| 88 | 88 |
| 89 def CreateAnalysisForClient(crash_identifiers, client_id): | 89 def CreateAnalysisForClient(crash_identifiers, client_id): |
| 90 """Creates analysis entity based on client id.""" | 90 """Creates analysis entity based on client id.""" |
| 91 if client_id == CrashClient.FRACAS: | 91 if client_id == CrashClient.FRACAS: |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 if (analysis.client_id == CrashClient.FRACAS or | 158 if (analysis.client_id == CrashClient.FRACAS or |
| 159 analysis.client_id == CrashClient.CRACAS): | 159 analysis.client_id == CrashClient.CRACAS): |
| 160 result, tags = findit_for_chromecrash.FindCulpritForChromeCrash( | 160 result, tags = findit_for_chromecrash.FindCulpritForChromeCrash( |
| 161 analysis.signature, analysis.platform, analysis.stack_trace, | 161 analysis.signature, analysis.platform, analysis.stack_trace, |
| 162 analysis.crashed_version, analysis.historical_metadata) | 162 analysis.crashed_version, analysis.historical_metadata) |
| 163 elif analysis.client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. | 163 elif analysis.client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. |
| 164 # TODO(katesonia): Implement findit_for_clusterfuzz. | 164 # TODO(katesonia): Implement findit_for_clusterfuzz. |
| 165 pass | 165 pass |
| 166 | 166 |
| 167 return result, tags | 167 return result, tags |
| OLD | NEW |