def testDoNothingIfV8InTopFrames(self): """Tests that filter does nothing if there is v8 frame in top frames.""" frame_list = [ StackFrame(0, 'src/v8', 'func', 'a.cc', 'a.cc', [1]), StackFrame(1, 'src', 'func', 'b.cc', 'b.cc', [1]), StackFrame(2, 'src', 'func', 'c.cc', 'c.cc', [2, 3]), StackFrame(3, 'src/v8', 'func', 'd.cc', 'd.cc', [1]), ] stack_buffer = CallStackBuffer(0, frame_list=frame_list) self._VerifyTwoCallStacksEqual( callstack_filters.FilterV8FramesIfV8NotInTopFrames(2)( stack_buffer), stack_buffer)
def testFilterV8FrameIfV8notInTopFrames(self): """Tests filtering all v8 frames when condition met. If there is no v8 frame in top n frames, the crash should not be caused by v8 cls, filter all the remaining v8 frames in the stack.""" frame_list = [ StackFrame(0, 'src', 'func', 'a.cc', 'a.cc', [1]), StackFrame(1, 'src', 'func', 'b.cc', 'b.cc', [1]), StackFrame(2, 'src', 'func', 'c.cc', 'c.cc', [2, 3]), StackFrame(3, 'src/v8', 'func', 'd.cc', 'd.cc', [1]), ] stack_buffer = CallStackBuffer(0, frame_list=frame_list) expected_stack_buffer = CallStackBuffer(0, frame_list=frame_list[:3]) self._VerifyTwoCallStacksEqual( callstack_filters.FilterV8FramesIfV8NotInTopFrames(2)( stack_buffer), expected_stack_buffer)
def testDoNothingForEmptyStackBuffer(self): """Tests that filter does nothing for empty stack buffer.""" stack_buffer = CallStackBuffer(0, frame_list=[]) self._VerifyTwoCallStacksEqual( callstack_filters.FilterV8FramesIfV8NotInTopFrames(2)( stack_buffer), stack_buffer)