Chromium Code Reviews| 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 from datetime import datetime | 5 from datetime import datetime |
| 6 import hashlib | |
| 7 import json | |
| 8 | |
| 9 from google.appengine.ext import ndb | |
| 6 | 10 |
| 7 from crash.test.crash_testcase import CrashTestCase | 11 from crash.test.crash_testcase import CrashTestCase |
| 8 from model import analysis_status | 12 from model import analysis_status |
| 9 from model import result_status | 13 from model import result_status |
| 10 from model.crash.fracas_crash_analysis import FracasCrashAnalysis | 14 from model.crash.chrome_crash_analysis import ChromeCrashAnalysis |
| 11 | 15 |
| 12 | 16 |
| 13 class FracasCrashAnalysisTest(CrashTestCase): | 17 class _TestChromeCrashAnalysis(ChromeCrashAnalysis): |
|
wrengr (wrong one)
2016/09/10 00:22:06
docstring for what this class is up to?
stgao
2016/09/13 17:04:47
The name is a bit confusing. Is it just to subclas
Sharu Jiang
2016/09/14 20:46:36
Yes, this is only for testing purpose, because the
Sharu Jiang
2016/09/14 20:46:36
Done.
| |
| 18 | |
| 19 @staticmethod | |
| 20 def _CreateKey(crash_identifiers): | |
| 21 return ndb.Key('_TestChromeCrashAnalysis', hashlib.sha1( | |
| 22 json.dumps(crash_identifiers, sort_keys=True)).hexdigest()) | |
| 23 | |
| 24 | |
| 25 class ChromeCrashAnalysisTest(CrashTestCase): | |
| 14 | 26 |
| 15 def testDoNotUseIdentifiersToSetProperties(self): | 27 def testDoNotUseIdentifiersToSetProperties(self): |
| 16 crash_identifiers = { | 28 crash_identifiers = { |
| 17 'chrome_version': '1', | 29 'chrome_version': '1', |
| 18 'signature': 'signature/here', | 30 'signature': 'signature/here', |
| 19 'channel': 'canary', | 31 'channel': 'canary', |
| 20 'platform': 'win', | 32 'platform': 'win', |
| 21 'process_type': 'browser', | 33 'process_type': 'browser', |
| 22 } | 34 } |
| 23 FracasCrashAnalysis.Create(crash_identifiers).put() | 35 _TestChromeCrashAnalysis.Create(crash_identifiers).put() |
| 24 analysis = FracasCrashAnalysis.Get(crash_identifiers) | 36 analysis = _TestChromeCrashAnalysis.Get(crash_identifiers) |
| 25 self.assertIsNone(analysis.crashed_version) | 37 self.assertIsNone(analysis.crashed_version) |
| 26 self.assertIsNone(analysis.signature) | 38 self.assertIsNone(analysis.signature) |
| 27 self.assertIsNone(analysis.channel) | 39 self.assertIsNone(analysis.channel) |
| 28 self.assertIsNone(analysis.platform) | 40 self.assertIsNone(analysis.platform) |
| 29 | 41 |
| 30 def testFracasCrashAnalysisReset(self): | 42 def testChromeCrashAnalysisReset(self): |
| 31 analysis = FracasCrashAnalysis() | 43 analysis = ChromeCrashAnalysis() |
| 32 analysis.historical_metadata = {} | 44 analysis.historical_metadata = {} |
| 33 analysis.Reset() | 45 analysis.Reset() |
| 34 self.assertIsNone(analysis.channel) | 46 self.assertIsNone(analysis.channel) |
| 35 self.assertIsNone(analysis.historical_metadata) | 47 self.assertIsNone(analysis.historical_metadata) |
| OLD | NEW |