mock_video_track.h (2359B)
1 /* 2 * Copyright 2021 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef API_TEST_MOCK_VIDEO_TRACK_H_ 12 #define API_TEST_MOCK_VIDEO_TRACK_H_ 13 14 #include <string> 15 16 #include "api/media_stream_interface.h" 17 #include "api/scoped_refptr.h" 18 #include "api/video/video_frame.h" 19 #include "api/video/video_sink_interface.h" 20 #include "api/video/video_source_interface.h" 21 #include "rtc_base/ref_counted_object.h" 22 #include "test/gmock.h" 23 24 namespace webrtc { 25 26 class MockVideoTrack : public RefCountedObject<VideoTrackInterface> { 27 public: 28 static scoped_refptr<MockVideoTrack> Create() { 29 return scoped_refptr<MockVideoTrack>(new MockVideoTrack()); 30 } 31 32 // NotifierInterface 33 MOCK_METHOD(void, 34 RegisterObserver, 35 (ObserverInterface * observer), 36 (override)); 37 MOCK_METHOD(void, 38 UnregisterObserver, 39 (ObserverInterface * observer), 40 (override)); 41 42 // MediaStreamTrackInterface 43 MOCK_METHOD(std::string, kind, (), (const, override)); 44 MOCK_METHOD(std::string, id, (), (const, override)); 45 MOCK_METHOD(bool, enabled, (), (const, override)); 46 MOCK_METHOD(bool, set_enabled, (bool enable), (override)); 47 MOCK_METHOD(TrackState, state, (), (const, override)); 48 49 // VideoSourceInterface 50 MOCK_METHOD(void, 51 AddOrUpdateSink, 52 (VideoSinkInterface<VideoFrame> * sink, 53 const VideoSinkWants& wants), 54 (override)); 55 // RemoveSink must guarantee that at the time the method returns, 56 // there is no current and no future calls to VideoSinkInterface::OnFrame. 57 MOCK_METHOD(void, 58 RemoveSink, 59 (VideoSinkInterface<VideoFrame> * sink), 60 (override)); 61 62 // VideoTrackInterface 63 MOCK_METHOD(VideoTrackSourceInterface*, GetSource, (), (const, override)); 64 65 MOCK_METHOD(ContentHint, content_hint, (), (const, override)); 66 MOCK_METHOD(void, set_content_hint, (ContentHint hint), (override)); 67 }; 68 69 } // namespace webrtc 70 71 #endif // API_TEST_MOCK_VIDEO_TRACK_H_