Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Side by Side Diff: appengine/findit/handlers/crash/test/crash_handler_test.py

Issue 2432203003: [Predator] Run predator. (Closed)
Patch Set: Rebase. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 base64 5 import base64
6 import copy 6 import copy
7 import json 7 import json
8 import logging 8 import logging
9 9
10 from google.appengine.api import app_identity 10 from google.appengine.api import app_identity
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 # TODO(wrengr): should we clone ``crash_data`` rather than mutating it? 85 # TODO(wrengr): should we clone ``crash_data`` rather than mutating it?
86 crash_data['platform'] = self.RenamePlatform(crash_data['platform']) 86 crash_data['platform'] = self.RenamePlatform(crash_data['platform'])
87 return crash_data 87 return crash_data
88 88
89 def _NeedsNewAnalysis(self, new_crash_data): 89 def _NeedsNewAnalysis(self, new_crash_data):
90 logging.debug('Called _MockFindit._NeedsNewAnalysis, as desired') 90 logging.debug('Called _MockFindit._NeedsNewAnalysis, as desired')
91 testcase.assertDictEqual(new_crash_data, renamed_crash_data) 91 testcase.assertDictEqual(new_crash_data, renamed_crash_data)
92 return False 92 return False
93 93
94 self.mock(crash_pipeline, 'FinditForClientID', 94 self.mock(crash_pipeline, 'FinditForClientID',
95 lambda _client_id: _MockFindit()) 95 lambda _client_id, repository: _MockFindit())
96 self.assertFalse(crash_handler.ScheduleNewAnalysis(original_crash_data)) 96 self.assertFalse(crash_handler.ScheduleNewAnalysis(original_crash_data))
97 97
98 def testScheduleNewAnalysisSkipsUnsupportedChannel(self): 98 def testScheduleNewAnalysisSkipsUnsupportedChannel(self):
99 self.assertFalse(crash_handler.ScheduleNewAnalysis(DummyCrashData( 99 self.assertFalse(crash_handler.ScheduleNewAnalysis(DummyCrashData(
100 client_id = CrashClient.FRACAS, 100 client_id = CrashClient.FRACAS,
101 version = None, 101 version = None,
102 signature = None, 102 signature = None,
103 crash_identifiers = {}, 103 crash_identifiers = {},
104 channel = 'unsupported_channel'))) 104 channel = 'unsupported_channel')))
105 105
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 def _MockGetChromeDependency(_self, _revision, _platform): 238 def _MockGetChromeDependency(_self, _revision, _platform):
239 raise AssertionError("GetChromeDependency shouldn't ever be called. " 239 raise AssertionError("GetChromeDependency shouldn't ever be called. "
240 'That it was indicates some sort of problem with our mocking code.') 240 'That it was indicates some sort of problem with our mocking code.')
241 self.mock(chrome_dependency_fetcher.ChromeDependencyFetcher, 241 self.mock(chrome_dependency_fetcher.ChromeDependencyFetcher,
242 'GetDependency', _MockGetChromeDependency) 242 'GetDependency', _MockGetChromeDependency)
243 243
244 crash_data = DummyCrashData( 244 crash_data = DummyCrashData(
245 client_id = CrashClient.FRACAS, 245 client_id = CrashClient.FRACAS,
246 version = '50.2500.0.1', 246 version = '50.2500.0.1',
247 stack_trace = 'frame1\nframe2\nframe3') 247 stack_trace = 'frame1\nframe2\nframe3')
248 # A fake repository, needed by the Findit constructor. We should never
249 # go over the wire (e.g., in the call to ScheduleNewAnalysis below),
250 # and this helps ensure that.
251 self.mock(gitiles_repository, 'GitilesRepository',
252 lambda *_args, **_kwargs: None)
253 self.assertTrue(crash_handler.ScheduleNewAnalysis(crash_data)) 248 self.assertTrue(crash_handler.ScheduleNewAnalysis(crash_data))
254 249
255 # The catch/re-raise is to clean up the callstack that's reported 250 # The catch/re-raise is to clean up the callstack that's reported
256 # when things acciddentally go over the wire (and subsequently fail). 251 # when things acciddentally go over the wire (and subsequently fail).
257 try: 252 try:
258 self.execute_queued_tasks() 253 self.execute_queued_tasks()
259 except AppError, e: # pragma: no cover 254 except AppError, e: # pragma: no cover
260 raise e 255 raise e
261 256
262 self.assertEqual(1, len(pubsub_publish_requests)) 257 self.assertEqual(1, len(pubsub_publish_requests))
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 'has_regression_range': True, 334 'has_regression_range': True,
340 'solution': 'core', 335 'solution': 'core',
341 'unsupported_tag': '', 336 'unsupported_tag': '',
342 } 337 }
343 338
344 analysis = self._TestRunningAnalysisForResult( 339 analysis = self._TestRunningAnalysisForResult(
345 analysis_result, analysis_tags) 340 analysis_result, analysis_tags)
346 self.assertTrue(analysis.has_regression_range) 341 self.assertTrue(analysis.has_regression_range)
347 self.assertTrue(analysis.found_suspects) 342 self.assertTrue(analysis.found_suspects)
348 self.assertEqual('core', analysis.solution) 343 self.assertEqual('core', analysis.solution)
OLDNEW
« no previous file with comments | « appengine/findit/handlers/crash/crash_handler.py ('k') | appengine/findit/util_scripts/crash_queries/crash_iterator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698