Add checks for api/test mocks to make sure they're complete
Also unifies the mock inheritance if they inherited from a ref counted interface: - it should only inherit from the interface - it should use make_ref_counted Bug: webrtc:14594 Change-Id: I7b0514b632ccd0798028b50f19812ac0a196e13c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262423 Commit-Queue: Florent Castelli <orphis@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38602}
This commit is contained in:
parent
11840ce684
commit
e87ec28b80
40
api/BUILD.gn
40
api/BUILD.gn
@ -978,6 +978,7 @@ if (rtc_include_tests) {
|
||||
sources = [ "test/mock_audio_mixer.h" ]
|
||||
|
||||
deps = [
|
||||
":make_ref_counted",
|
||||
"../test:test_support",
|
||||
"audio:audio_mixer_api",
|
||||
]
|
||||
@ -989,7 +990,7 @@ if (rtc_include_tests) {
|
||||
sources = [ "test/mock_audio_sink.h" ]
|
||||
|
||||
deps = [
|
||||
"../api:media_stream_interface",
|
||||
":media_stream_interface",
|
||||
"../test:test_support",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
@ -1002,6 +1003,7 @@ if (rtc_include_tests) {
|
||||
|
||||
deps = [
|
||||
":libjingle_peerconnection_api",
|
||||
":make_ref_counted",
|
||||
"../test:test_support",
|
||||
]
|
||||
}
|
||||
@ -1013,6 +1015,7 @@ if (rtc_include_tests) {
|
||||
|
||||
deps = [
|
||||
":libjingle_peerconnection_api",
|
||||
":make_ref_counted",
|
||||
"../test:test_support",
|
||||
]
|
||||
}
|
||||
@ -1032,8 +1035,7 @@ if (rtc_include_tests) {
|
||||
testonly = true
|
||||
sources = [ "test/mock_frame_encryptor.h" ]
|
||||
deps = [
|
||||
# For api/crypto/frame_encryptor_interface.h
|
||||
":libjingle_peerconnection_api",
|
||||
":make_ref_counted",
|
||||
"../test:test_support",
|
||||
"crypto:frame_encryptor_interface",
|
||||
]
|
||||
@ -1044,7 +1046,7 @@ if (rtc_include_tests) {
|
||||
testonly = true
|
||||
sources = [ "test/mock_frame_decryptor.h" ]
|
||||
deps = [
|
||||
":libjingle_peerconnection_api",
|
||||
":make_ref_counted",
|
||||
"../test:test_support",
|
||||
"crypto:frame_decryptor_interface",
|
||||
]
|
||||
@ -1055,9 +1057,8 @@ if (rtc_include_tests) {
|
||||
testonly = true
|
||||
sources = [ "test/mock_encoder_selector.h" ]
|
||||
deps = [
|
||||
":libjingle_peerconnection_api",
|
||||
"../api/video_codecs:video_codecs_api",
|
||||
"../test:test_support",
|
||||
"video_codecs:video_codecs_api",
|
||||
]
|
||||
}
|
||||
|
||||
@ -1070,8 +1071,6 @@ if (rtc_include_tests) {
|
||||
]
|
||||
deps = [
|
||||
":array_view",
|
||||
":libjingle_peerconnection_api",
|
||||
":make_ref_counted",
|
||||
":rtp_parameters",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:refcount",
|
||||
@ -1088,8 +1087,6 @@ if (rtc_include_tests) {
|
||||
]
|
||||
deps = [
|
||||
":array_view",
|
||||
":libjingle_peerconnection_api",
|
||||
":make_ref_counted",
|
||||
":rtp_parameters",
|
||||
"../rtc_base:checks",
|
||||
"crypto:frame_decryptor_interface",
|
||||
@ -1102,6 +1099,7 @@ if (rtc_include_tests) {
|
||||
sources = [ "test/mock_media_stream_interface.h" ]
|
||||
|
||||
deps = [
|
||||
":make_ref_counted",
|
||||
":media_stream_interface",
|
||||
"../test:test_support",
|
||||
]
|
||||
@ -1125,8 +1123,8 @@ if (rtc_include_tests) {
|
||||
|
||||
deps = [
|
||||
":libjingle_peerconnection_api",
|
||||
"../api:scoped_refptr",
|
||||
"../rtc_base:refcount",
|
||||
":make_ref_counted",
|
||||
":scoped_refptr",
|
||||
"../test:test_support",
|
||||
]
|
||||
}
|
||||
@ -1138,6 +1136,7 @@ if (rtc_include_tests) {
|
||||
|
||||
deps = [
|
||||
":libjingle_peerconnection_api",
|
||||
":make_ref_counted",
|
||||
"../test:test_support",
|
||||
]
|
||||
}
|
||||
@ -1173,6 +1172,7 @@ if (rtc_include_tests) {
|
||||
|
||||
deps = [
|
||||
":libjingle_peerconnection_api",
|
||||
":make_ref_counted",
|
||||
"../test:test_support",
|
||||
]
|
||||
}
|
||||
@ -1194,8 +1194,8 @@ if (rtc_include_tests) {
|
||||
sources = [ "test/mock_video_bitrate_allocator.h" ]
|
||||
|
||||
deps = [
|
||||
"../api/video:video_bitrate_allocator",
|
||||
"../test:test_support",
|
||||
"video:video_bitrate_allocator",
|
||||
]
|
||||
}
|
||||
|
||||
@ -1205,8 +1205,8 @@ if (rtc_include_tests) {
|
||||
sources = [ "test/mock_video_bitrate_allocator_factory.h" ]
|
||||
|
||||
deps = [
|
||||
"../api/video:video_bitrate_allocator_factory",
|
||||
"../test:test_support",
|
||||
"video:video_bitrate_allocator_factory",
|
||||
]
|
||||
}
|
||||
|
||||
@ -1219,8 +1219,8 @@ if (rtc_include_tests) {
|
||||
]
|
||||
|
||||
deps = [
|
||||
"../api/video_codecs:video_codecs_api",
|
||||
"../test:test_support",
|
||||
"video_codecs:video_codecs_api",
|
||||
]
|
||||
}
|
||||
|
||||
@ -1230,8 +1230,8 @@ if (rtc_include_tests) {
|
||||
sources = [ "test/mock_video_decoder.h" ]
|
||||
|
||||
deps = [
|
||||
"../api/video_codecs:video_codecs_api",
|
||||
"../test:test_support",
|
||||
"video_codecs:video_codecs_api",
|
||||
]
|
||||
}
|
||||
|
||||
@ -1241,8 +1241,8 @@ if (rtc_include_tests) {
|
||||
sources = [ "test/mock_video_encoder.h" ]
|
||||
|
||||
deps = [
|
||||
"../api/video_codecs:video_codecs_api",
|
||||
"../test:test_support",
|
||||
"video_codecs:video_codecs_api",
|
||||
]
|
||||
}
|
||||
|
||||
@ -1252,9 +1252,9 @@ if (rtc_include_tests) {
|
||||
sources = [ "test/mock_video_track.h" ]
|
||||
|
||||
deps = [
|
||||
"../api:media_stream_interface",
|
||||
"../api:scoped_refptr",
|
||||
"../rtc_base:refcount",
|
||||
":make_ref_counted",
|
||||
":media_stream_interface",
|
||||
":scoped_refptr",
|
||||
"../test:test_support",
|
||||
]
|
||||
}
|
||||
|
||||
8
api/DEPS
8
api/DEPS
@ -250,14 +250,6 @@ specific_include_rules = {
|
||||
"+test/gmock.h",
|
||||
],
|
||||
|
||||
"mock_peerconnectioninterface\.h": [
|
||||
"+rtc_base/ref_counted_object.h",
|
||||
],
|
||||
|
||||
"mock_video_track\.h": [
|
||||
"+rtc_base/ref_counted_object.h",
|
||||
],
|
||||
|
||||
"notifier\.h": [
|
||||
"+rtc_base/system/no_unique_address.h",
|
||||
],
|
||||
|
||||
@ -32,6 +32,8 @@ class MockTaskQueueBase : public TaskQueueBase {
|
||||
(override));
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<MockTaskQueueBase>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TASK_QUEUE_TEST_MOCK_TASK_QUEUE_BASE_H_
|
||||
|
||||
@ -28,6 +28,8 @@ class MockAsyncDnsResolverResult : public AsyncDnsResolverResult {
|
||||
MOCK_METHOD(int, GetError, (), (const, override));
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<MockAsyncDnsResolverResult>);
|
||||
|
||||
class MockAsyncDnsResolver : public AsyncDnsResolverInterface {
|
||||
public:
|
||||
MOCK_METHOD(void,
|
||||
@ -41,6 +43,8 @@ class MockAsyncDnsResolver : public AsyncDnsResolverInterface {
|
||||
MOCK_METHOD(AsyncDnsResolverResult&, result, (), (const, override));
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<MockAsyncDnsResolver>);
|
||||
|
||||
class MockAsyncDnsResolverFactory : public AsyncDnsResolverFactoryInterface {
|
||||
public:
|
||||
MOCK_METHOD(std::unique_ptr<webrtc::AsyncDnsResolverInterface>,
|
||||
@ -57,6 +61,8 @@ class MockAsyncDnsResolverFactory : public AsyncDnsResolverFactoryInterface {
|
||||
(override));
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<MockAsyncDnsResolverFactory>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_ASYNC_DNS_RESOLVER_H_
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#define API_TEST_MOCK_AUDIO_MIXER_H_
|
||||
|
||||
#include "api/audio/audio_mixer.h"
|
||||
#include "api/make_ref_counted.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -19,10 +20,20 @@ namespace test {
|
||||
|
||||
class MockAudioMixer : public AudioMixer {
|
||||
public:
|
||||
static rtc::scoped_refptr<MockAudioMixer> Create() {
|
||||
return rtc::make_ref_counted<MockAudioMixer>();
|
||||
}
|
||||
|
||||
MOCK_METHOD(bool, AddSource, (Source*), (override));
|
||||
MOCK_METHOD(void, RemoveSource, (Source*), (override));
|
||||
MOCK_METHOD(void, Mix, (size_t number_of_channels, AudioFrame*), (override));
|
||||
|
||||
protected:
|
||||
MockAudioMixer() = default;
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockAudioMixer>>);
|
||||
|
||||
} // namespace test
|
||||
} // namespace webrtc
|
||||
|
||||
|
||||
@ -39,6 +39,8 @@ class MockAudioSink final : public webrtc::AudioTrackSinkInterface {
|
||||
(override));
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<MockAudioSink>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_AUDIO_SINK_H_
|
||||
|
||||
@ -14,16 +14,15 @@
|
||||
#include <string>
|
||||
|
||||
#include "api/data_channel_interface.h"
|
||||
#include "api/make_ref_counted.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class MockDataChannelInterface final
|
||||
: public rtc::RefCountedObject<webrtc::DataChannelInterface> {
|
||||
class MockDataChannelInterface : public webrtc::DataChannelInterface {
|
||||
public:
|
||||
static rtc::scoped_refptr<MockDataChannelInterface> Create() {
|
||||
return rtc::scoped_refptr<MockDataChannelInterface>(
|
||||
new MockDataChannelInterface());
|
||||
return rtc::make_ref_counted<MockDataChannelInterface>();
|
||||
}
|
||||
|
||||
MOCK_METHOD(void,
|
||||
@ -56,6 +55,9 @@ class MockDataChannelInterface final
|
||||
MockDataChannelInterface() = default;
|
||||
};
|
||||
|
||||
static_assert(
|
||||
!std::is_abstract_v<rtc::RefCountedObject<MockDataChannelInterface>>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_DATA_CHANNEL_H_
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "api/dtmf_sender_interface.h"
|
||||
#include "api/make_ref_counted.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -27,7 +28,7 @@ class MockDtmfSenderObserver : public DtmfSenderObserverInterface {
|
||||
MOCK_METHOD(void, OnToneChange, (const std::string&), (override));
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<MockDtmfSenderObserver>, "");
|
||||
static_assert(!std::is_abstract_v<MockDtmfSenderObserver>);
|
||||
|
||||
class MockDtmfSender : public DtmfSenderInterface {
|
||||
public:
|
||||
@ -49,7 +50,7 @@ class MockDtmfSender : public DtmfSenderInterface {
|
||||
MockDtmfSender() = default;
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockDtmfSender>>, "");
|
||||
static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockDtmfSender>>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
|
||||
@ -21,6 +21,8 @@ class MockFecControllerOverride : public FecControllerOverride {
|
||||
MOCK_METHOD(void, SetFecAllowed, (bool fec_allowed), (override));
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<MockFecControllerOverride>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_FEC_CONTROLLER_OVERRIDE_H_
|
||||
|
||||
@ -14,12 +14,17 @@
|
||||
#include <vector>
|
||||
|
||||
#include "api/crypto/frame_decryptor_interface.h"
|
||||
#include "api/make_ref_counted.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class MockFrameDecryptor : public FrameDecryptorInterface {
|
||||
public:
|
||||
static rtc::scoped_refptr<MockFrameDecryptor> Create() {
|
||||
return rtc::make_ref_counted<MockFrameDecryptor>();
|
||||
}
|
||||
|
||||
MOCK_METHOD(Result,
|
||||
Decrypt,
|
||||
(cricket::MediaType,
|
||||
@ -33,8 +38,13 @@ class MockFrameDecryptor : public FrameDecryptorInterface {
|
||||
GetMaxPlaintextByteSize,
|
||||
(cricket::MediaType, size_t encrypted_frame_size),
|
||||
(override));
|
||||
|
||||
protected:
|
||||
MockFrameDecryptor() = default;
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockFrameDecryptor>>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_FRAME_DECRYPTOR_H_
|
||||
|
||||
@ -12,12 +12,17 @@
|
||||
#define API_TEST_MOCK_FRAME_ENCRYPTOR_H_
|
||||
|
||||
#include "api/crypto/frame_encryptor_interface.h"
|
||||
#include "api/make_ref_counted.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class MockFrameEncryptor : public FrameEncryptorInterface {
|
||||
public:
|
||||
static rtc::scoped_refptr<MockFrameEncryptor> Create() {
|
||||
return rtc::make_ref_counted<MockFrameEncryptor>();
|
||||
}
|
||||
|
||||
MOCK_METHOD(int,
|
||||
Encrypt,
|
||||
(cricket::MediaType,
|
||||
@ -32,8 +37,13 @@ class MockFrameEncryptor : public FrameEncryptorInterface {
|
||||
GetMaxCiphertextByteSize,
|
||||
(cricket::MediaType media_type, size_t frame_size),
|
||||
(override));
|
||||
|
||||
protected:
|
||||
MockFrameEncryptor() = default;
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockFrameEncryptor>>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_FRAME_ENCRYPTOR_H_
|
||||
|
||||
@ -13,16 +13,16 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "api/make_ref_counted.h"
|
||||
#include "api/media_stream_interface.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class MockAudioSource final
|
||||
: public rtc::RefCountedObject<AudioSourceInterface> {
|
||||
class MockAudioSource : public AudioSourceInterface {
|
||||
public:
|
||||
static rtc::scoped_refptr<MockAudioSource> Create() {
|
||||
return rtc::scoped_refptr<MockAudioSource>(new MockAudioSource());
|
||||
return rtc::make_ref_counted<MockAudioSource>();
|
||||
}
|
||||
|
||||
MOCK_METHOD(void,
|
||||
@ -48,14 +48,16 @@ class MockAudioSource final
|
||||
MOCK_METHOD(void, RemoveSink, (AudioTrackSinkInterface * sink), (override));
|
||||
MOCK_METHOD(const cricket::AudioOptions, options, (), (const, override));
|
||||
|
||||
private:
|
||||
protected:
|
||||
MockAudioSource() = default;
|
||||
};
|
||||
|
||||
class MockAudioTrack final : public rtc::RefCountedObject<AudioTrackInterface> {
|
||||
static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockAudioSource>>);
|
||||
|
||||
class MockAudioTrack : public AudioTrackInterface {
|
||||
public:
|
||||
static rtc::scoped_refptr<MockAudioTrack> Create() {
|
||||
return rtc::scoped_refptr<MockAudioTrack>(new MockAudioTrack());
|
||||
return rtc::make_ref_counted<MockAudioTrack>();
|
||||
}
|
||||
|
||||
MOCK_METHOD(void,
|
||||
@ -80,12 +82,18 @@ class MockAudioTrack final : public rtc::RefCountedObject<AudioTrackInterface> {
|
||||
(),
|
||||
(override));
|
||||
|
||||
private:
|
||||
protected:
|
||||
MockAudioTrack() = default;
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockAudioTrack>>);
|
||||
|
||||
class MockMediaStream : public MediaStreamInterface {
|
||||
public:
|
||||
static rtc::scoped_refptr<MockMediaStream> Create() {
|
||||
return rtc::make_ref_counted<MockMediaStream>();
|
||||
}
|
||||
|
||||
MOCK_METHOD(std::string, id, (), (const override));
|
||||
MOCK_METHOD(AudioTrackVector, GetAudioTracks, (), (override));
|
||||
MOCK_METHOD(VideoTrackVector, GetVideoTracks, (), (override));
|
||||
@ -128,7 +136,7 @@ class MockMediaStream : public MediaStreamInterface {
|
||||
(override));
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockMediaStream>>, "");
|
||||
static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockMediaStream>>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
|
||||
@ -14,17 +14,17 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "api/make_ref_counted.h"
|
||||
#include "api/peer_connection_interface.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class MockPeerConnectionFactoryInterface final
|
||||
: public rtc::RefCountedObject<webrtc::PeerConnectionFactoryInterface> {
|
||||
class MockPeerConnectionFactoryInterface
|
||||
: public PeerConnectionFactoryInterface {
|
||||
public:
|
||||
static rtc::scoped_refptr<MockPeerConnectionFactoryInterface> Create() {
|
||||
return rtc::scoped_refptr<MockPeerConnectionFactoryInterface>(
|
||||
new MockPeerConnectionFactoryInterface());
|
||||
return rtc::make_ref_counted<MockPeerConnectionFactoryInterface>();
|
||||
}
|
||||
|
||||
MOCK_METHOD(void, SetOptions, (const Options&), (override));
|
||||
@ -76,6 +76,9 @@ class MockPeerConnectionFactoryInterface final
|
||||
MockPeerConnectionFactoryInterface() = default;
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<
|
||||
rtc::RefCountedObject<MockPeerConnectionFactoryInterface>>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_PEER_CONNECTION_FACTORY_INTERFACE_H_
|
||||
|
||||
@ -17,10 +17,10 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "api/make_ref_counted.h"
|
||||
#include "api/peer_connection_interface.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "api/sctp_transport_interface.h"
|
||||
#include "rtc_base/ref_counted_object.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -205,8 +205,7 @@ class MockPeerConnectionInterface : public webrtc::PeerConnectionInterface {
|
||||
};
|
||||
|
||||
static_assert(
|
||||
!std::is_abstract_v<rtc::RefCountedObject<MockPeerConnectionInterface>>,
|
||||
"");
|
||||
!std::is_abstract_v<rtc::RefCountedObject<MockPeerConnectionInterface>>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "api/make_ref_counted.h"
|
||||
#include "api/rtp_transceiver_interface.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
@ -21,8 +22,6 @@ namespace webrtc {
|
||||
|
||||
class MockRtpTransceiver : public RtpTransceiverInterface {
|
||||
public:
|
||||
MockRtpTransceiver() = default;
|
||||
|
||||
static rtc::scoped_refptr<MockRtpTransceiver> Create() {
|
||||
return rtc::make_ref_counted<MockRtpTransceiver>();
|
||||
}
|
||||
@ -80,8 +79,13 @@ class MockRtpTransceiver : public RtpTransceiverInterface {
|
||||
(rtc::ArrayView<const RtpHeaderExtensionCapability>
|
||||
header_extensions_to_offer),
|
||||
(override));
|
||||
|
||||
protected:
|
||||
MockRtpTransceiver() = default;
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockRtpTransceiver>>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_RTP_TRANSCEIVER_H_
|
||||
|
||||
@ -19,8 +19,12 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class MockRtpReceiver : public rtc::RefCountedObject<RtpReceiverInterface> {
|
||||
class MockRtpReceiver : public RtpReceiverInterface {
|
||||
public:
|
||||
static rtc::scoped_refptr<MockRtpReceiver> Create() {
|
||||
return rtc::make_ref_counted<MockRtpReceiver>();
|
||||
}
|
||||
|
||||
MOCK_METHOD(rtc::scoped_refptr<MediaStreamTrackInterface>,
|
||||
track,
|
||||
(),
|
||||
@ -38,8 +42,13 @@ class MockRtpReceiver : public rtc::RefCountedObject<RtpReceiverInterface> {
|
||||
(absl::optional<double>),
|
||||
(override));
|
||||
MOCK_METHOD(std::vector<RtpSource>, GetSources, (), (const, override));
|
||||
|
||||
protected:
|
||||
MockRtpReceiver() = default;
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockRtpReceiver>>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_RTPRECEIVER_H_
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "api/make_ref_counted.h"
|
||||
#include "api/rtp_sender_interface.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
@ -68,7 +69,8 @@ class MockRtpSender : public RtpSenderInterface {
|
||||
(override));
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockRtpSender>>, "");
|
||||
static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockRtpSender>>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_RTPSENDER_H_
|
||||
|
||||
@ -18,13 +18,20 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class MockTransformableVideoFrame
|
||||
: public webrtc::TransformableVideoFrameInterface {
|
||||
class MockTransformableVideoFrame : public TransformableVideoFrameInterface {
|
||||
public:
|
||||
// TransformableFrameInterface
|
||||
MOCK_METHOD(rtc::ArrayView<const uint8_t>, GetData, (), (const, override));
|
||||
MOCK_METHOD(void, SetData, (rtc::ArrayView<const uint8_t> data), (override));
|
||||
MOCK_METHOD(uint32_t, GetTimestamp, (), (const, override));
|
||||
MOCK_METHOD(uint8_t, GetPayloadType, (), (const, override));
|
||||
MOCK_METHOD(uint32_t, GetSsrc, (), (const, override));
|
||||
MOCK_METHOD(uint32_t, GetTimestamp, (), (const, override));
|
||||
MOCK_METHOD(TransformableVideoFrameInterface::Direction,
|
||||
GetDirection,
|
||||
(),
|
||||
(const, override));
|
||||
|
||||
// TransformableVideoFrameInterface
|
||||
MOCK_METHOD(bool, IsKeyFrame, (), (const, override));
|
||||
MOCK_METHOD(std::vector<uint8_t>, GetAdditionalData, (), (const, override));
|
||||
MOCK_METHOD(const webrtc::VideoFrameMetadata&,
|
||||
@ -33,6 +40,8 @@ class MockTransformableVideoFrame
|
||||
(const, override));
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<MockTransformableVideoFrame>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_TRANSFORMABLE_VIDEO_FRAME_H_
|
||||
|
||||
@ -23,6 +23,8 @@ class MockVideoBitrateAllocator : public webrtc::VideoBitrateAllocator {
|
||||
(override));
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<MockVideoBitrateAllocator>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_VIDEO_BITRATE_ALLOCATOR_H_
|
||||
|
||||
@ -18,8 +18,7 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class MockVideoBitrateAllocatorFactory
|
||||
: public webrtc::VideoBitrateAllocatorFactory {
|
||||
class MockVideoBitrateAllocatorFactory : public VideoBitrateAllocatorFactory {
|
||||
public:
|
||||
~MockVideoBitrateAllocatorFactory() override { Die(); }
|
||||
MOCK_METHOD(std::unique_ptr<VideoBitrateAllocator>,
|
||||
@ -29,6 +28,8 @@ class MockVideoBitrateAllocatorFactory
|
||||
MOCK_METHOD(void, Die, ());
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<MockVideoBitrateAllocatorFactory>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_VIDEO_BITRATE_ALLOCATOR_FACTORY_H_
|
||||
|
||||
@ -37,6 +37,8 @@ class MockDecodedImageCallback : public DecodedImageCallback {
|
||||
(override));
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<MockDecodedImageCallback>);
|
||||
|
||||
class MockVideoDecoder : public VideoDecoder {
|
||||
public:
|
||||
MockVideoDecoder() {
|
||||
@ -65,6 +67,8 @@ class MockVideoDecoder : public VideoDecoder {
|
||||
MOCK_METHOD(void, Destruct, (), ());
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<MockVideoDecoder>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_VIDEO_DECODER_H_
|
||||
|
||||
@ -35,6 +35,9 @@ class MockVideoDecoderFactory : public webrtc::VideoDecoderFactory {
|
||||
(override));
|
||||
MOCK_METHOD(void, Die, ());
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<MockVideoDecoderFactory>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_VIDEO_DECODER_FACTORY_H_
|
||||
|
||||
@ -27,6 +27,8 @@ class MockEncodedImageCallback : public EncodedImageCallback {
|
||||
MOCK_METHOD(void, OnDroppedFrame, (DropReason reason), (override));
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<MockEncodedImageCallback>);
|
||||
|
||||
class MockVideoEncoder : public VideoEncoder {
|
||||
public:
|
||||
MOCK_METHOD(void,
|
||||
@ -68,6 +70,8 @@ class MockVideoEncoder : public VideoEncoder {
|
||||
MOCK_METHOD(EncoderInfo, GetEncoderInfo, (), (const, override));
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<MockVideoEncoder>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_VIDEO_ENCODER_H_
|
||||
|
||||
@ -37,6 +37,8 @@ class MockVideoEncoderFactory : public webrtc::VideoEncoderFactory {
|
||||
MOCK_METHOD(void, Die, ());
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<MockVideoEncoderFactory>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_VIDEO_ENCODER_FACTORY_H_
|
||||
|
||||
@ -13,18 +13,17 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "api/make_ref_counted.h"
|
||||
#include "api/media_stream_interface.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "rtc_base/ref_counted_object.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class MockVideoTrack final
|
||||
: public rtc::RefCountedObject<webrtc::VideoTrackInterface> {
|
||||
class MockVideoTrack : public webrtc::VideoTrackInterface {
|
||||
public:
|
||||
static rtc::scoped_refptr<MockVideoTrack> Create() {
|
||||
return rtc::scoped_refptr<MockVideoTrack>(new MockVideoTrack());
|
||||
return rtc::make_ref_counted<MockVideoTrack>();
|
||||
}
|
||||
|
||||
// NotifierInterface
|
||||
@ -62,8 +61,13 @@ class MockVideoTrack final
|
||||
|
||||
MOCK_METHOD(ContentHint, content_hint, (), (const, override));
|
||||
MOCK_METHOD(void, set_content_hint, (ContentHint hint), (override));
|
||||
|
||||
protected:
|
||||
MockVideoTrack() = default;
|
||||
};
|
||||
|
||||
static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockVideoTrack>>);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_TEST_MOCK_VIDEO_TRACK_H_
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user