| OLD | NEW |
| (Empty) |
| 1 // Copyright 2017 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_CAPTURE_VIDEO_CHROMEOS_MOCK_VIDEO_CAPTURE_CLIENT_H_ | |
| 6 #define MEDIA_CAPTURE_VIDEO_CHROMEOS_MOCK_VIDEO_CAPTURE_CLIENT_H_ | |
| 7 | |
| 8 #include "media/capture/video/video_capture_device.h" | |
| 9 #include "testing/gmock/include/gmock/gmock.h" | |
| 10 | |
| 11 namespace media { | |
| 12 namespace unittest_internal { | |
| 13 | |
| 14 class MockVideoCaptureClient : public VideoCaptureDevice::Client { | |
| 15 public: | |
| 16 MOCK_METHOD0(DoReserveOutputBuffer, void(void)); | |
| 17 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); | |
| 18 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void)); | |
| 19 MOCK_METHOD0(DoResurrectLastOutputBuffer, void(void)); | |
| 20 MOCK_METHOD2(OnError, | |
| 21 void(const tracked_objects::Location& from_here, | |
| 22 const std::string& reason)); | |
| 23 MOCK_CONST_METHOD0(GetBufferPoolUtilization, double(void)); | |
| 24 MOCK_METHOD0(OnStarted, void(void)); | |
| 25 | |
| 26 explicit MockVideoCaptureClient(); | |
| 27 | |
| 28 ~MockVideoCaptureClient(); | |
| 29 | |
| 30 void SetFrameCb(base::OnceClosure frame_cb); | |
| 31 | |
| 32 void SetQuitCb(base::OnceClosure quit_cb); | |
| 33 | |
| 34 void DumpError(const tracked_objects::Location& location, | |
| 35 const std::string& message); | |
| 36 | |
| 37 void OnIncomingCapturedData(const uint8_t* data, | |
| 38 int length, | |
| 39 const VideoCaptureFormat& format, | |
| 40 int rotation, | |
| 41 base::TimeTicks reference_time, | |
| 42 base::TimeDelta timestamp, | |
| 43 int frame_feedback_id) override; | |
| 44 // Trampoline methods to workaround GMOCK problems with std::unique_ptr<>. | |
| 45 Buffer ReserveOutputBuffer(const gfx::Size& dimensions, | |
| 46 media::VideoPixelFormat format, | |
| 47 media::VideoPixelStorage storage, | |
| 48 int frame_feedback_id) override; | |
| 49 void OnIncomingCapturedBuffer(Buffer buffer, | |
| 50 const VideoCaptureFormat& format, | |
| 51 base::TimeTicks reference_time, | |
| 52 base::TimeDelta timestamp) override; | |
| 53 void OnIncomingCapturedBufferExt( | |
| 54 Buffer buffer, | |
| 55 const VideoCaptureFormat& format, | |
| 56 base::TimeTicks reference_time, | |
| 57 base::TimeDelta timestamp, | |
| 58 gfx::Rect visible_rect, | |
| 59 const VideoFrameMetadata& additional_metadata) override; | |
| 60 Buffer ResurrectLastOutputBuffer(const gfx::Size& dimensions, | |
| 61 media::VideoPixelFormat format, | |
| 62 media::VideoPixelStorage storage, | |
| 63 int frame_feedback_id) override; | |
| 64 | |
| 65 private: | |
| 66 base::OnceClosure frame_cb_; | |
| 67 base::OnceClosure quit_cb_; | |
| 68 }; | |
| 69 | |
| 70 } // namespace unittest_internal | |
| 71 } // namespace media | |
| 72 | |
| 73 #endif // MEDIA_CAPTURE_VIDEO_CHROMEOS_MOCK_VIDEO_CAPTURE_CLIENT_H_ | |
| OLD | NEW |