| 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 testing_utils import testing | 5 from testing_utils import testing |
| 6 | 6 |
| 7 from crash.test.crash_testcase import CrashTestCase | 7 from crash.test.crash_testcase import CrashTestCase |
| 8 | 8 |
| 9 | 9 |
| 10 class StacktraceTestSuite(CrashTestCase): #pragma: no cover. | 10 class StacktraceTestSuite(CrashTestCase): #pragma: no cover. |
| 11 | 11 |
| 12 def _VerifyTwoStackFramesEqual(self, frame1, frame2): | 12 def _VerifyTwoStackFramesEqual(self, frame1, frame2): |
| 13 self.assertIsNotNone(frame1, "the first frame is unexpectedly missing") |
| 14 self.assertIsNotNone(frame2, "the second frame is unexpectedly missing") |
| 13 self.assertEqual(str(frame1), str(frame2)) | 15 self.assertEqual(str(frame1), str(frame2)) |
| 14 self.assertEqual(frame1.dep_path, frame2.dep_path) | 16 self.assertEqual(frame1.dep_path, frame2.dep_path) |
| 15 | 17 |
| 16 def _VerifyTwoCallStacksEqual(self, stack1, stack2): | 18 def _VerifyTwoCallStacksEqual(self, stack1, stack2): |
| 17 self.assertEqual(len(stack1), len(stack2)) | 19 self.assertIsNotNone(stack1, "the first stack is unexpectedly missing") |
| 20 self.assertIsNotNone(stack2, "the second stack is unexpectedly missing") |
| 21 self.assertEqual(len(stack1.frames), len(stack2.frames)) |
| 18 self.assertEqual(stack1.priority, stack2.priority) | 22 self.assertEqual(stack1.priority, stack2.priority) |
| 19 self.assertEqual(stack1.format_type, stack2.format_type) | 23 self.assertEqual(stack1.format_type, stack2.format_type) |
| 20 self.assertEqual(stack1.language_type, stack2.language_type) | 24 self.assertEqual(stack1.language_type, stack2.language_type) |
| 21 map(self._VerifyTwoStackFramesEqual, stack1, stack2) | 25 map(self._VerifyTwoStackFramesEqual, stack1.frames, stack2.frames) |
| 22 | 26 |
| 23 def _VerifyTwoStacktracesEqual(self, stacktrace1, stacktrace2): | 27 def _VerifyTwoStacktracesEqual(self, trace1, trace2): |
| 24 self.assertEqual(len(stacktrace1), len(stacktrace2)) | 28 self.assertIsNotNone(trace1, "the first trace is unexpectedly missing") |
| 25 map(self._VerifyTwoCallStacksEqual, stacktrace1, stacktrace2) | 29 self.assertIsNotNone(trace2, "the second trace is unexpectedly missing") |
| 30 self.assertEqual(len(trace1.stacks), len(trace2.stacks)) |
| 31 map(self._VerifyTwoCallStacksEqual, trace1.stacks, trace2.stacks) |
| OLD | NEW |