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 common import constants | 5 from common import constants |
6 from common.pipeline_wrapper import pipeline_handlers | 6 from common.pipeline_wrapper import pipeline_handlers |
7 from crash import classifier | 7 from crash import classifier |
8 from crash.callstack import CallStack | 8 from crash.callstack import CallStack, StackFrame |
9 from crash.callstack import StackFrame | |
10 from crash.results import Result | 9 from crash.results import Result |
11 from crash.test.crash_testcase import CrashTestCase | 10 from crash.test.crash_testcase import CrashTestCase |
12 | 11 |
13 | 12 |
14 class DummyClassifier(classifier.Classifier): | 13 class DummyClassifier(classifier.Classifier): |
15 | 14 |
16 def GetClassFromStackFrame(self, frame): | 15 def GetClassFromStackFrame(self, frame): |
17 if frame.dep_path == 'src/': | 16 if frame.dep_path == 'src/': |
18 return 'class_1' | 17 return 'class_1' |
19 | 18 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 result = Result(self.GetDummyChangeLog(), 'src/') | 67 result = Result(self.GetDummyChangeLog(), 'src/') |
69 result.file_to_stack_infos = { | 68 result.file_to_stack_infos = { |
70 'f0.cc': [(StackFrame( | 69 'f0.cc': [(StackFrame( |
71 0, 'src/', 'a::c(p* &d)', 'f0.cc', 'src/f0.cc', [177]), 0)] | 70 0, 'src/', 'a::c(p* &d)', 'f0.cc', 'src/f0.cc', [177]), 0)] |
72 } | 71 } |
73 | 72 |
74 self.assertEqual(dummy_classifier.Classify([result], CallStack(0)), | 73 self.assertEqual(dummy_classifier.Classify([result], CallStack(0)), |
75 'class_3') | 74 'class_3') |
76 | 75 |
77 | 76 |
OLD | NEW |