| OLD | NEW |
| 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 json | 6 import json |
| 7 import os | 7 import os |
| 8 import re | 8 import re |
| 9 | 9 |
| 10 import webapp2 | 10 import webapp2 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 def Mocked_ScheduleNewAnalysisForCrash(*crash_data, **_): | 23 def Mocked_ScheduleNewAnalysisForCrash(*crash_data, **_): |
| 24 requested_crashes.append(crash_data) | 24 requested_crashes.append(crash_data) |
| 25 self.mock(fracas_crash.fracas_crash_pipeline, 'ScheduleNewAnalysisForCrash', | 25 self.mock(fracas_crash.fracas_crash_pipeline, 'ScheduleNewAnalysisForCrash', |
| 26 Mocked_ScheduleNewAnalysisForCrash) | 26 Mocked_ScheduleNewAnalysisForCrash) |
| 27 | 27 |
| 28 def testAnalysisScheduled(self): | 28 def testAnalysisScheduled(self): |
| 29 requested_crashes = [] | 29 requested_crashes = [] |
| 30 self._MockScheduleNewAnalysisForCrash(requested_crashes) | 30 self._MockScheduleNewAnalysisForCrash(requested_crashes) |
| 31 self.mock_current_user(user_email='test@chromium.org', is_admin=True) | 31 self.mock_current_user(user_email='test@chromium.org', is_admin=True) |
| 32 | 32 |
| 33 client_id = 'fracas' |
| 33 channel = 'supported_channel' | 34 channel = 'supported_channel' |
| 34 platform = 'supported_platform' | 35 platform = 'supported_platform' |
| 35 signature = 'signature/here' | 36 signature = 'signature/here' |
| 36 stack_trace = 'frame1\nframe2\nframe3' | 37 stack_trace = 'frame1\nframe2\nframe3' |
| 37 chrome_version = '50.2500.0.0' | 38 chrome_version = '50.2500.0.0' |
| 38 versions_to_cpm = [['50.2500.0.0']] | 39 historic_metadata = [{'chrome_version': '50.2500.0.0', 'cpm': 0.6}] |
| 40 |
| 41 crash_identifiers = { |
| 42 'chrome_version': chrome_version, |
| 43 'signature': signature, |
| 44 'channel': channel, |
| 45 'platform': platform, |
| 46 'process_type': 'renderer' |
| 47 } |
| 39 | 48 |
| 40 request_json_data = { | 49 request_json_data = { |
| 41 'message': { | 50 'message': { |
| 42 'data': base64.b64encode(json.dumps({ | 51 'data': base64.b64encode(json.dumps({ |
| 43 'channel': channel, | 52 'customized_data': { |
| 44 'platform': platform, | 53 'channel': 'supported_channel', |
| 45 'signature': signature, | 54 'historic_metadata': [ |
| 46 'stack_trace': stack_trace, | 55 { |
| 47 'chrome_version': chrome_version, | 56 'chrome_version': '50.2500.0.0', |
| 48 'versions_to_cpm': versions_to_cpm, | 57 'cpm': 0.6 |
| 58 }, |
| 59 ] |
| 60 }, |
| 61 'chrome_version': '50.2500.0.0', |
| 62 'signature': 'signature/here', |
| 63 'client_id': 'fracas', |
| 64 'platform': 'supported_platform', |
| 65 'crash_identifiers': { |
| 66 'chrome_version': '50.2500.0.0', |
| 67 'signature': 'signature/here', |
| 68 'channel': 'supported_channel', |
| 69 'platform': 'supported_platform', |
| 70 'process_type': 'renderer' |
| 71 }, |
| 72 'stack_trace': 'frame1\nframe2\nframe3' |
| 49 })), | 73 })), |
| 50 'message_id': 'id', | 74 'message_id': 'id', |
| 51 }, | 75 }, |
| 52 'subscription': 'subscription', | 76 'subscription': 'subscription', |
| 53 } | 77 } |
| 54 | 78 |
| 55 self.test_app.post_json('/_ah/push-handlers/crash/fracas', | 79 self.test_app.post_json('/_ah/push-handlers/crash/fracas', |
| 56 request_json_data) | 80 request_json_data) |
| 57 | 81 |
| 58 self.assertEqual(1, len(requested_crashes)) | 82 self.assertEqual(1, len(requested_crashes)) |
| 59 self.assertEqual( | 83 self.assertEqual( |
| 60 (channel, platform, signature, stack_trace, | 84 (crash_identifiers, chrome_version, signature, client_id, |
| 61 chrome_version, versions_to_cpm), | 85 platform, stack_trace, channel, historic_metadata), |
| 62 requested_crashes[0]) | 86 requested_crashes[0]) |
| OLD | NEW |