| 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 import copy | 4 import copy |
| 5 import json | 5 import json |
| 6 | 6 |
| 7 from google.appengine.api import app_identity | 7 from google.appengine.api import app_identity |
| 8 | 8 |
| 9 from common.pipeline_wrapper import pipeline_handlers | 9 from common.pipeline_wrapper import pipeline_handlers |
| 10 from crash import crash_pipeline | 10 from crash import crash_pipeline |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 platform = 'win' | 146 platform = 'win' |
| 147 channel = 'canary' | 147 channel = 'canary' |
| 148 crash_identifiers = { | 148 crash_identifiers = { |
| 149 'chrome_version': chrome_version, | 149 'chrome_version': chrome_version, |
| 150 'signature': signature, | 150 'signature': signature, |
| 151 'channel': channel, | 151 'channel': channel, |
| 152 'platform': platform, | 152 'platform': platform, |
| 153 'process_type': 'browser', | 153 'process_type': 'browser', |
| 154 } | 154 } |
| 155 stack_trace = 'frame1\nframe2\nframe3' | 155 stack_trace = 'frame1\nframe2\nframe3' |
| 156 chrome_version = '50.2500.0.0' | 156 chrome_version = '50.2500.0.1' |
| 157 historical_metadata = {'50.2500.0.0': 1.0} | 157 historical_metadata = None |
| 158 | 158 |
| 159 mock_host = 'https://host.com' | 159 mock_host = 'https://host.com' |
| 160 self.mock(app_identity, 'get_default_version_hostname', lambda: mock_host) | 160 self.mock(app_identity, 'get_default_version_hostname', lambda: mock_host) |
| 161 | 161 |
| 162 self.assertTrue( | 162 self.assertTrue( |
| 163 crash_pipeline.ScheduleNewAnalysisForCrash( | 163 crash_pipeline.ScheduleNewAnalysisForCrash( |
| 164 crash_identifiers, chrome_version, signature, 'fracas', | 164 crash_identifiers, chrome_version, signature, 'fracas', |
| 165 platform, stack_trace, | 165 platform, stack_trace, |
| 166 {'channel': channel, 'historical_metadata': historical_metadata})) | 166 {'channel': channel, 'historical_metadata': historical_metadata})) |
| 167 | 167 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 182 | 182 |
| 183 expected_messages_data = [json.dumps({ | 183 expected_messages_data = [json.dumps({ |
| 184 'crash_identifiers': crash_identifiers, | 184 'crash_identifiers': crash_identifiers, |
| 185 'client_id': 'fracas', | 185 'client_id': 'fracas', |
| 186 'result': processed_analysis_result, | 186 'result': processed_analysis_result, |
| 187 }, sort_keys=True)] | 187 }, sort_keys=True)] |
| 188 self.assertEqual(expected_messages_data, pubsub_publish_requests[0][0]) | 188 self.assertEqual(expected_messages_data, pubsub_publish_requests[0][0]) |
| 189 | 189 |
| 190 self.assertEqual(1, len(analyzed_crashes)) | 190 self.assertEqual(1, len(analyzed_crashes)) |
| 191 self.assertEqual( | 191 self.assertEqual( |
| 192 (signature, platform, stack_trace, chrome_version, historical_metadata), | 192 (signature, platform, stack_trace, chrome_version, None), |
| 193 analyzed_crashes[0]) | 193 analyzed_crashes[0]) |
| 194 | 194 |
| 195 analysis = FracasCrashAnalysis.Get(crash_identifiers) | 195 analysis = FracasCrashAnalysis.Get(crash_identifiers) |
| 196 self.assertEqual(analysis_result, analysis.result) | 196 self.assertEqual(analysis_result, analysis.result) |
| 197 return analysis | 197 return analysis |
| 198 | 198 |
| 199 | 199 |
| 200 def testRunningAnalysis(self): | 200 def testRunningAnalysis(self): |
| 201 analysis_result = { | 201 analysis_result = { |
| 202 'found': True, | 202 'found': True, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 'process_type': 'browser', | 268 'process_type': 'browser', |
| 269 } | 269 } |
| 270 analysis = FracasCrashAnalysis.Create(crash_identifiers) | 270 analysis = FracasCrashAnalysis.Create(crash_identifiers) |
| 271 analysis.status = analysis_status.RUNNING | 271 analysis.status = analysis_status.RUNNING |
| 272 analysis.put() | 272 analysis.put() |
| 273 | 273 |
| 274 pipeline = crash_pipeline.CrashAnalysisPipeline(crash_identifiers, 'fracas') | 274 pipeline = crash_pipeline.CrashAnalysisPipeline(crash_identifiers, 'fracas') |
| 275 pipeline._SetErrorIfAborted(True) | 275 pipeline._SetErrorIfAborted(True) |
| 276 analysis = FracasCrashAnalysis.Get(crash_identifiers) | 276 analysis = FracasCrashAnalysis.Get(crash_identifiers) |
| 277 self.assertEqual(analysis_status.ERROR, analysis.status) | 277 self.assertEqual(analysis_status.ERROR, analysis.status) |
| OLD | NEW |