diff --git a/api/BUILD.gn b/api/BUILD.gn index de839adeb1..7e78edd014 100644 --- a/api/BUILD.gn +++ b/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", ] } diff --git a/api/DEPS b/api/DEPS index 5f01204068..484588e280 100644 --- a/api/DEPS +++ b/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", ], diff --git a/api/task_queue/test/mock_task_queue_base.h b/api/task_queue/test/mock_task_queue_base.h index 2e99be7e82..4b73d8fe41 100644 --- a/api/task_queue/test/mock_task_queue_base.h +++ b/api/task_queue/test/mock_task_queue_base.h @@ -32,6 +32,8 @@ class MockTaskQueueBase : public TaskQueueBase { (override)); }; +static_assert(!std::is_abstract_v); + } // namespace webrtc #endif // API_TASK_QUEUE_TEST_MOCK_TASK_QUEUE_BASE_H_ diff --git a/api/test/mock_async_dns_resolver.h b/api/test/mock_async_dns_resolver.h index 81132c96a5..c5048c8429 100644 --- a/api/test/mock_async_dns_resolver.h +++ b/api/test/mock_async_dns_resolver.h @@ -28,6 +28,8 @@ class MockAsyncDnsResolverResult : public AsyncDnsResolverResult { MOCK_METHOD(int, GetError, (), (const, override)); }; +static_assert(!std::is_abstract_v); + 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); + class MockAsyncDnsResolverFactory : public AsyncDnsResolverFactoryInterface { public: MOCK_METHOD(std::unique_ptr, @@ -57,6 +61,8 @@ class MockAsyncDnsResolverFactory : public AsyncDnsResolverFactoryInterface { (override)); }; +static_assert(!std::is_abstract_v); + } // namespace webrtc #endif // API_TEST_MOCK_ASYNC_DNS_RESOLVER_H_ diff --git a/api/test/mock_audio_mixer.h b/api/test/mock_audio_mixer.h index 88dc108ca3..8747356a73 100644 --- a/api/test/mock_audio_mixer.h +++ b/api/test/mock_audio_mixer.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 Create() { + return rtc::make_ref_counted(); + } + 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>); + } // namespace test } // namespace webrtc diff --git a/api/test/mock_audio_sink.h b/api/test/mock_audio_sink.h index 0c17dc45ca..ae8c856b53 100644 --- a/api/test/mock_audio_sink.h +++ b/api/test/mock_audio_sink.h @@ -39,6 +39,8 @@ class MockAudioSink final : public webrtc::AudioTrackSinkInterface { (override)); }; +static_assert(!std::is_abstract_v); + } // namespace webrtc #endif // API_TEST_MOCK_AUDIO_SINK_H_ diff --git a/api/test/mock_data_channel.h b/api/test/mock_data_channel.h index 40f7edb08a..afdf05b137 100644 --- a/api/test/mock_data_channel.h +++ b/api/test/mock_data_channel.h @@ -14,16 +14,15 @@ #include #include "api/data_channel_interface.h" +#include "api/make_ref_counted.h" #include "test/gmock.h" namespace webrtc { -class MockDataChannelInterface final - : public rtc::RefCountedObject { +class MockDataChannelInterface : public webrtc::DataChannelInterface { public: static rtc::scoped_refptr Create() { - return rtc::scoped_refptr( - new MockDataChannelInterface()); + return rtc::make_ref_counted(); } MOCK_METHOD(void, @@ -56,6 +55,9 @@ class MockDataChannelInterface final MockDataChannelInterface() = default; }; +static_assert( + !std::is_abstract_v>); + } // namespace webrtc #endif // API_TEST_MOCK_DATA_CHANNEL_H_ diff --git a/api/test/mock_dtmf_sender.h b/api/test/mock_dtmf_sender.h index 9029195025..78ae475beb 100644 --- a/api/test/mock_dtmf_sender.h +++ b/api/test/mock_dtmf_sender.h @@ -14,6 +14,7 @@ #include #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, ""); +static_assert(!std::is_abstract_v); class MockDtmfSender : public DtmfSenderInterface { public: @@ -49,7 +50,7 @@ class MockDtmfSender : public DtmfSenderInterface { MockDtmfSender() = default; }; -static_assert(!std::is_abstract_v>, ""); +static_assert(!std::is_abstract_v>); } // namespace webrtc diff --git a/api/test/mock_fec_controller_override.h b/api/test/mock_fec_controller_override.h index 8f3accbc03..4fff228e13 100644 --- a/api/test/mock_fec_controller_override.h +++ b/api/test/mock_fec_controller_override.h @@ -21,6 +21,8 @@ class MockFecControllerOverride : public FecControllerOverride { MOCK_METHOD(void, SetFecAllowed, (bool fec_allowed), (override)); }; +static_assert(!std::is_abstract_v); + } // namespace webrtc #endif // API_TEST_MOCK_FEC_CONTROLLER_OVERRIDE_H_ diff --git a/api/test/mock_frame_decryptor.h b/api/test/mock_frame_decryptor.h index 9604b96cc2..c4320a4874 100644 --- a/api/test/mock_frame_decryptor.h +++ b/api/test/mock_frame_decryptor.h @@ -14,12 +14,17 @@ #include #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 Create() { + return rtc::make_ref_counted(); + } + 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>); + } // namespace webrtc #endif // API_TEST_MOCK_FRAME_DECRYPTOR_H_ diff --git a/api/test/mock_frame_encryptor.h b/api/test/mock_frame_encryptor.h index e47321f801..cb20f62ff1 100644 --- a/api/test/mock_frame_encryptor.h +++ b/api/test/mock_frame_encryptor.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 Create() { + return rtc::make_ref_counted(); + } + 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>); + } // namespace webrtc #endif // API_TEST_MOCK_FRAME_ENCRYPTOR_H_ diff --git a/api/test/mock_media_stream_interface.h b/api/test/mock_media_stream_interface.h index 209962358d..6baf02f2a0 100644 --- a/api/test/mock_media_stream_interface.h +++ b/api/test/mock_media_stream_interface.h @@ -13,16 +13,16 @@ #include +#include "api/make_ref_counted.h" #include "api/media_stream_interface.h" #include "test/gmock.h" namespace webrtc { -class MockAudioSource final - : public rtc::RefCountedObject { +class MockAudioSource : public AudioSourceInterface { public: static rtc::scoped_refptr Create() { - return rtc::scoped_refptr(new MockAudioSource()); + return rtc::make_ref_counted(); } 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 { +static_assert(!std::is_abstract_v>); + +class MockAudioTrack : public AudioTrackInterface { public: static rtc::scoped_refptr Create() { - return rtc::scoped_refptr(new MockAudioTrack()); + return rtc::make_ref_counted(); } MOCK_METHOD(void, @@ -80,12 +82,18 @@ class MockAudioTrack final : public rtc::RefCountedObject { (), (override)); - private: + protected: MockAudioTrack() = default; }; +static_assert(!std::is_abstract_v>); + class MockMediaStream : public MediaStreamInterface { public: + static rtc::scoped_refptr Create() { + return rtc::make_ref_counted(); + } + 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>, ""); +static_assert(!std::is_abstract_v>); } // namespace webrtc diff --git a/api/test/mock_peer_connection_factory_interface.h b/api/test/mock_peer_connection_factory_interface.h index 6bab595b5a..5ba2c830cc 100644 --- a/api/test/mock_peer_connection_factory_interface.h +++ b/api/test/mock_peer_connection_factory_interface.h @@ -14,17 +14,17 @@ #include #include +#include "api/make_ref_counted.h" #include "api/peer_connection_interface.h" #include "test/gmock.h" namespace webrtc { -class MockPeerConnectionFactoryInterface final - : public rtc::RefCountedObject { +class MockPeerConnectionFactoryInterface + : public PeerConnectionFactoryInterface { public: static rtc::scoped_refptr Create() { - return rtc::scoped_refptr( - new MockPeerConnectionFactoryInterface()); + return rtc::make_ref_counted(); } MOCK_METHOD(void, SetOptions, (const Options&), (override)); @@ -76,6 +76,9 @@ class MockPeerConnectionFactoryInterface final MockPeerConnectionFactoryInterface() = default; }; +static_assert(!std::is_abstract_v< + rtc::RefCountedObject>); + } // namespace webrtc #endif // API_TEST_MOCK_PEER_CONNECTION_FACTORY_INTERFACE_H_ diff --git a/api/test/mock_peerconnectioninterface.h b/api/test/mock_peerconnectioninterface.h index ccc6ce46b1..b779f19f59 100644 --- a/api/test/mock_peerconnectioninterface.h +++ b/api/test/mock_peerconnectioninterface.h @@ -17,10 +17,10 @@ #include #include +#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>, - ""); + !std::is_abstract_v>); } // namespace webrtc diff --git a/api/test/mock_rtp_transceiver.h b/api/test/mock_rtp_transceiver.h index 1d21bce5eb..39c8773e03 100644 --- a/api/test/mock_rtp_transceiver.h +++ b/api/test/mock_rtp_transceiver.h @@ -14,6 +14,7 @@ #include #include +#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 Create() { return rtc::make_ref_counted(); } @@ -80,8 +79,13 @@ class MockRtpTransceiver : public RtpTransceiverInterface { (rtc::ArrayView header_extensions_to_offer), (override)); + + protected: + MockRtpTransceiver() = default; }; +static_assert(!std::is_abstract_v>); + } // namespace webrtc #endif // API_TEST_MOCK_RTP_TRANSCEIVER_H_ diff --git a/api/test/mock_rtpreceiver.h b/api/test/mock_rtpreceiver.h index 4bcf064b2a..5adc1aa94c 100644 --- a/api/test/mock_rtpreceiver.h +++ b/api/test/mock_rtpreceiver.h @@ -19,8 +19,12 @@ namespace webrtc { -class MockRtpReceiver : public rtc::RefCountedObject { +class MockRtpReceiver : public RtpReceiverInterface { public: + static rtc::scoped_refptr Create() { + return rtc::make_ref_counted(); + } + MOCK_METHOD(rtc::scoped_refptr, track, (), @@ -38,8 +42,13 @@ class MockRtpReceiver : public rtc::RefCountedObject { (absl::optional), (override)); MOCK_METHOD(std::vector, GetSources, (), (const, override)); + + protected: + MockRtpReceiver() = default; }; +static_assert(!std::is_abstract_v>); + } // namespace webrtc #endif // API_TEST_MOCK_RTPRECEIVER_H_ diff --git a/api/test/mock_rtpsender.h b/api/test/mock_rtpsender.h index e2351f87fe..1a71d8b15f 100644 --- a/api/test/mock_rtpsender.h +++ b/api/test/mock_rtpsender.h @@ -15,6 +15,7 @@ #include #include +#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>, ""); +static_assert(!std::is_abstract_v>); + } // namespace webrtc #endif // API_TEST_MOCK_RTPSENDER_H_ diff --git a/api/test/mock_transformable_video_frame.h b/api/test/mock_transformable_video_frame.h index 5cebcaba80..c85b05d3a9 100644 --- a/api/test/mock_transformable_video_frame.h +++ b/api/test/mock_transformable_video_frame.h @@ -18,13 +18,20 @@ namespace webrtc { -class MockTransformableVideoFrame - : public webrtc::TransformableVideoFrameInterface { +class MockTransformableVideoFrame : public TransformableVideoFrameInterface { public: + // TransformableFrameInterface MOCK_METHOD(rtc::ArrayView, GetData, (), (const, override)); MOCK_METHOD(void, SetData, (rtc::ArrayView 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, GetAdditionalData, (), (const, override)); MOCK_METHOD(const webrtc::VideoFrameMetadata&, @@ -33,6 +40,8 @@ class MockTransformableVideoFrame (const, override)); }; +static_assert(!std::is_abstract_v); + } // namespace webrtc #endif // API_TEST_MOCK_TRANSFORMABLE_VIDEO_FRAME_H_ diff --git a/api/test/mock_video_bitrate_allocator.h b/api/test/mock_video_bitrate_allocator.h index 76cf49e955..8f86ba08f6 100644 --- a/api/test/mock_video_bitrate_allocator.h +++ b/api/test/mock_video_bitrate_allocator.h @@ -23,6 +23,8 @@ class MockVideoBitrateAllocator : public webrtc::VideoBitrateAllocator { (override)); }; +static_assert(!std::is_abstract_v); + } // namespace webrtc #endif // API_TEST_MOCK_VIDEO_BITRATE_ALLOCATOR_H_ diff --git a/api/test/mock_video_bitrate_allocator_factory.h b/api/test/mock_video_bitrate_allocator_factory.h index 16af191970..562efd78fe 100644 --- a/api/test/mock_video_bitrate_allocator_factory.h +++ b/api/test/mock_video_bitrate_allocator_factory.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, @@ -29,6 +28,8 @@ class MockVideoBitrateAllocatorFactory MOCK_METHOD(void, Die, ()); }; +static_assert(!std::is_abstract_v); + } // namespace webrtc #endif // API_TEST_MOCK_VIDEO_BITRATE_ALLOCATOR_FACTORY_H_ diff --git a/api/test/mock_video_decoder.h b/api/test/mock_video_decoder.h index 34f732ca4d..ddef1b4f27 100644 --- a/api/test/mock_video_decoder.h +++ b/api/test/mock_video_decoder.h @@ -37,6 +37,8 @@ class MockDecodedImageCallback : public DecodedImageCallback { (override)); }; +static_assert(!std::is_abstract_v); + class MockVideoDecoder : public VideoDecoder { public: MockVideoDecoder() { @@ -65,6 +67,8 @@ class MockVideoDecoder : public VideoDecoder { MOCK_METHOD(void, Destruct, (), ()); }; +static_assert(!std::is_abstract_v); + } // namespace webrtc #endif // API_TEST_MOCK_VIDEO_DECODER_H_ diff --git a/api/test/mock_video_decoder_factory.h b/api/test/mock_video_decoder_factory.h index 6150d9f8b5..e61892f7e3 100644 --- a/api/test/mock_video_decoder_factory.h +++ b/api/test/mock_video_decoder_factory.h @@ -35,6 +35,9 @@ class MockVideoDecoderFactory : public webrtc::VideoDecoderFactory { (override)); MOCK_METHOD(void, Die, ()); }; + +static_assert(!std::is_abstract_v); + } // namespace webrtc #endif // API_TEST_MOCK_VIDEO_DECODER_FACTORY_H_ diff --git a/api/test/mock_video_encoder.h b/api/test/mock_video_encoder.h index 11e0f64b3f..c6276a5fd0 100644 --- a/api/test/mock_video_encoder.h +++ b/api/test/mock_video_encoder.h @@ -27,6 +27,8 @@ class MockEncodedImageCallback : public EncodedImageCallback { MOCK_METHOD(void, OnDroppedFrame, (DropReason reason), (override)); }; +static_assert(!std::is_abstract_v); + 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); + } // namespace webrtc #endif // API_TEST_MOCK_VIDEO_ENCODER_H_ diff --git a/api/test/mock_video_encoder_factory.h b/api/test/mock_video_encoder_factory.h index 02ee7aa15e..427c6a08a2 100644 --- a/api/test/mock_video_encoder_factory.h +++ b/api/test/mock_video_encoder_factory.h @@ -37,6 +37,8 @@ class MockVideoEncoderFactory : public webrtc::VideoEncoderFactory { MOCK_METHOD(void, Die, ()); }; +static_assert(!std::is_abstract_v); + } // namespace webrtc #endif // API_TEST_MOCK_VIDEO_ENCODER_FACTORY_H_ diff --git a/api/test/mock_video_track.h b/api/test/mock_video_track.h index 705d13509b..99247f1065 100644 --- a/api/test/mock_video_track.h +++ b/api/test/mock_video_track.h @@ -13,18 +13,17 @@ #include +#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 { +class MockVideoTrack : public webrtc::VideoTrackInterface { public: static rtc::scoped_refptr Create() { - return rtc::scoped_refptr(new MockVideoTrack()); + return rtc::make_ref_counted(); } // 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>); + } // namespace webrtc #endif // API_TEST_MOCK_VIDEO_TRACK_H_