OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_VIDEO_MOCK_VIDEO_DECODE_ACCELERATOR_H_ |
| 6 #define MEDIA_VIDEO_MOCK_VIDEO_DECODE_ACCELERATOR_H_ |
| 7 |
| 8 #include "video_decode_accelerator.h" |
| 9 |
| 10 #include <vector> |
| 11 |
| 12 #include "base/basictypes.h" |
| 13 #include "media/base/bitstream_buffer.h" |
| 14 #include "media/base/video_decoder_config.h" |
| 15 #include "media/video/picture.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" |
| 17 |
| 18 namespace media { |
| 19 |
| 20 using ::testing::Invoke; |
| 21 |
| 22 // Remember to use the default action of Destroy() when using EXPECT_CALL. |
| 23 // Otherwise, the mock will be leaked and the test runner will complain. |
| 24 class MockVideoDecodeAccelerator : public VideoDecodeAccelerator { |
| 25 public: |
| 26 MockVideoDecodeAccelerator() { |
| 27 // Delete |this| when Destroy() is called. |
| 28 ON_CALL(*this, Destroy()) |
| 29 .WillByDefault(Invoke(this, &MockVideoDecodeAccelerator::DeleteThis)); |
| 30 } |
| 31 virtual ~MockVideoDecodeAccelerator() {} |
| 32 |
| 33 MOCK_METHOD1(Initialize, bool(VideoCodecProfile profile)); |
| 34 MOCK_METHOD1(Decode, void(const BitstreamBuffer& bitstream_buffer)); |
| 35 MOCK_METHOD1(AssignPictureBuffers, |
| 36 void(const std::vector<PictureBuffer>& buffers)); |
| 37 MOCK_METHOD1(ReusePictureBuffer, void(int32 picture_buffer_id)); |
| 38 MOCK_METHOD0(Flush, void()); |
| 39 MOCK_METHOD0(Reset, void()); |
| 40 MOCK_METHOD0(Destroy, void()); |
| 41 |
| 42 private: |
| 43 void DeleteThis() { delete this; } |
| 44 DISALLOW_COPY_AND_ASSIGN(MockVideoDecodeAccelerator); |
| 45 }; |
| 46 |
| 47 } // namespace media |
| 48 |
| 49 #endif // MEDIA_VIDEO_MOCK_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |