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