xref: /aosp_15_r20/external/webrtc/api/test/mock_rtp_transceiver.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright 2020 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_RTP_TRANSCEIVER_H_
12 #define API_TEST_MOCK_RTP_TRANSCEIVER_H_
13 
14 #include <string>
15 #include <vector>
16 
17 #include "api/rtp_transceiver_interface.h"
18 #include "test/gmock.h"
19 
20 namespace webrtc {
21 
22 class MockRtpTransceiver : public RtpTransceiverInterface {
23  public:
24   MockRtpTransceiver() = default;
25 
Create()26   static rtc::scoped_refptr<MockRtpTransceiver> Create() {
27     return rtc::make_ref_counted<MockRtpTransceiver>();
28   }
29 
30   MOCK_METHOD(cricket::MediaType, media_type, (), (const, override));
31   MOCK_METHOD(absl::optional<std::string>, mid, (), (const, override));
32   MOCK_METHOD(rtc::scoped_refptr<RtpSenderInterface>,
33               sender,
34               (),
35               (const, override));
36   MOCK_METHOD(rtc::scoped_refptr<RtpReceiverInterface>,
37               receiver,
38               (),
39               (const, override));
40   MOCK_METHOD(bool, stopped, (), (const, override));
41   MOCK_METHOD(bool, stopping, (), (const, override));
42   MOCK_METHOD(RtpTransceiverDirection, direction, (), (const, override));
43   MOCK_METHOD(void,
44               SetDirection,
45               (RtpTransceiverDirection new_direction),
46               (override));
47   MOCK_METHOD(RTCError,
48               SetDirectionWithError,
49               (RtpTransceiverDirection new_direction),
50               (override));
51   MOCK_METHOD(absl::optional<RtpTransceiverDirection>,
52               current_direction,
53               (),
54               (const, override));
55   MOCK_METHOD(absl::optional<RtpTransceiverDirection>,
56               fired_direction,
57               (),
58               (const, override));
59   MOCK_METHOD(RTCError, StopStandard, (), (override));
60   MOCK_METHOD(void, StopInternal, (), (override));
61   MOCK_METHOD(void, Stop, (), (override));
62   MOCK_METHOD(RTCError,
63               SetCodecPreferences,
64               (rtc::ArrayView<RtpCodecCapability> codecs),
65               (override));
66   MOCK_METHOD(std::vector<RtpCodecCapability>,
67               codec_preferences,
68               (),
69               (const, override));
70   MOCK_METHOD(std::vector<RtpHeaderExtensionCapability>,
71               HeaderExtensionsToOffer,
72               (),
73               (const, override));
74   MOCK_METHOD(std::vector<RtpHeaderExtensionCapability>,
75               HeaderExtensionsNegotiated,
76               (),
77               (const, override));
78   MOCK_METHOD(webrtc::RTCError,
79               SetOfferedRtpHeaderExtensions,
80               (rtc::ArrayView<const RtpHeaderExtensionCapability>
81                    header_extensions_to_offer),
82               (override));
83 };
84 
85 }  // namespace webrtc
86 
87 #endif  // API_TEST_MOCK_RTP_TRANSCEIVER_H_
88