| 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 json | 5 import json |
| 6 import os | 6 import os |
| 7 | 7 |
| 8 from common import constants | 8 from common import constants |
| 9 from common.pipeline_wrapper import pipeline_handlers | 9 from common.pipeline_wrapper import pipeline_handlers |
| 10 from crash import fracas_crash_pipeline | 10 from crash import fracas_crash_pipeline |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 self.assertTrue( | 143 self.assertTrue( |
| 144 fracas_crash_pipeline.ScheduleNewAnalysisForCrash( | 144 fracas_crash_pipeline.ScheduleNewAnalysisForCrash( |
| 145 crash_identifiers, chrome_version, signature, 'fracas', | 145 crash_identifiers, chrome_version, signature, 'fracas', |
| 146 platform, stack_trace, channel, historic_metadata)) | 146 platform, stack_trace, channel, historic_metadata)) |
| 147 | 147 |
| 148 self.execute_queued_tasks() | 148 self.execute_queued_tasks() |
| 149 | 149 |
| 150 self.assertEqual(1, len(pubsub_publish_requests)) | 150 self.assertEqual(1, len(pubsub_publish_requests)) |
| 151 expected_messages_data = [json.dumps({ | 151 expected_messages_data = [json.dumps({ |
| 152 'crash_identifiers': crash_identifiers, | 152 'crash_identifiers': crash_identifiers, |
| 153 'client_id': 'fracas', |
| 153 'result': analysis_result, | 154 'result': analysis_result, |
| 154 }, sort_keys=True)] | 155 }, sort_keys=True)] |
| 155 self.assertEqual(expected_messages_data, pubsub_publish_requests[0][0]) | 156 self.assertEqual(expected_messages_data, pubsub_publish_requests[0][0]) |
| 156 | 157 |
| 157 self.assertEqual(1, len(analyzed_crashes)) | 158 self.assertEqual(1, len(analyzed_crashes)) |
| 158 self.assertEqual( | 159 self.assertEqual( |
| 159 (channel, platform, signature, stack_trace, | 160 (signature, platform, stack_trace, chrome_version, historic_metadata), |
| 160 chrome_version, historic_metadata), | |
| 161 analyzed_crashes[0]) | 161 analyzed_crashes[0]) |
| 162 | 162 |
| 163 analysis = FracasCrashAnalysis.Get(crash_identifiers) | 163 analysis = FracasCrashAnalysis.Get(crash_identifiers) |
| 164 self.assertEqual(analysis_result, analysis.result) | 164 self.assertEqual(analysis_result, analysis.result) |
| 165 self.assertTrue(analysis.has_regression_range) | 165 self.assertTrue(analysis.has_regression_range) |
| 166 self.assertTrue(analysis.found_suspects) | 166 self.assertTrue(analysis.found_suspects) |
| 167 self.assertEqual('core', analysis.solution) | 167 self.assertEqual('core', analysis.solution) |
| 168 | 168 |
| 169 def testAnalysisAborted(self): | 169 def testAnalysisAborted(self): |
| 170 chrome_version = '1' | 170 chrome_version = '1' |
| 171 signature = 'signature' | 171 signature = 'signature' |
| 172 platform = 'win' | 172 platform = 'win' |
| 173 crash_identifiers = { | 173 crash_identifiers = { |
| 174 'chrome_version': chrome_version, | 174 'chrome_version': chrome_version, |
| 175 'signature': signature, | 175 'signature': signature, |
| 176 'channel': 'canary', | 176 'channel': 'canary', |
| 177 'platform': platform, | 177 'platform': platform, |
| 178 'process_type': 'browser', | 178 'process_type': 'browser', |
| 179 } | 179 } |
| 180 analysis = FracasCrashAnalysis.Create(crash_identifiers) | 180 analysis = FracasCrashAnalysis.Create(crash_identifiers) |
| 181 analysis.status = analysis_status.RUNNING | 181 analysis.status = analysis_status.RUNNING |
| 182 analysis.put() | 182 analysis.put() |
| 183 | 183 |
| 184 pipeline = fracas_crash_pipeline.FracasAnalysisPipeline(crash_identifiers) | 184 pipeline = fracas_crash_pipeline.FracasAnalysisPipeline(crash_identifiers) |
| 185 pipeline._SetErrorIfAborted(True) | 185 pipeline._SetErrorIfAborted(True) |
| 186 analysis = FracasCrashAnalysis.Get(crash_identifiers) | 186 analysis = FracasCrashAnalysis.Get(crash_identifiers) |
| 187 self.assertEqual(analysis_status.ERROR, analysis.status) | 187 self.assertEqual(analysis_status.ERROR, analysis.status) |
| OLD | NEW |