diff options
Diffstat (limited to 'media/base/mock_callback.cc')
-rw-r--r-- | media/base/mock_callback.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/media/base/mock_callback.cc b/media/base/mock_callback.cc index e948368..03ed896 100644 --- a/media/base/mock_callback.cc +++ b/media/base/mock_callback.cc @@ -20,10 +20,35 @@ void MockCallback::ExpectRunAndDelete() { EXPECT_CALL(*this, Destructor()); } +MockStatusCallback::MockStatusCallback() {} + +MockStatusCallback::~MockStatusCallback() { + Destructor(); +} + +// Required by GMock to allow the RunWithParams() expectation +// in ExpectRunAndDelete() to compile. +bool operator==(const Tuple1<PipelineError>& lhs, + const Tuple1<PipelineError>& rhs) { + return lhs.a == rhs.a; +} + +void MockStatusCallback::ExpectRunAndDelete(PipelineError error) { + EXPECT_CALL(*this, RunWithParams(Tuple1<PipelineError>(error))); + EXPECT_CALL(*this, Destructor()); +} + MockCallback* NewExpectedCallback() { StrictMock<MockCallback>* callback = new StrictMock<MockCallback>(); callback->ExpectRunAndDelete(); return callback; } +MockStatusCallback* NewExpectedStatusCallback(PipelineError error) { + StrictMock<MockStatusCallback>* callback = + new StrictMock<MockStatusCallback>(); + callback->ExpectRunAndDelete(error); + return callback; +} + } // namespace media |