From 123a0ed6044f1c6f68dd8720dca6378169fd5aa1 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Thu, 10 Nov 2022 13:28:42 +0000 Subject: [PATCH] Revert "Add checks for api/test mocks to make sure they're complete" This reverts commit e87ec28b807f84babe228f54690c686fcf86a0fb. Reason for revert: Breaks upstream. Original change's description: > 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 > Reviewed-by: Harald Alvestrand > Cr-Commit-Position: refs/heads/main@{#38602} Bug: webrtc:14594 Change-Id: I9f2d9c3656b43e3006ec03ae7d792d0a53f47ebd No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/282940 Auto-Submit: Florent Castelli Commit-Queue: Harald Alvestrand Reviewed-by: Harald Alvestrand Bot-Commit: rubber-stamper@appspot.gserviceaccount.com Cr-Commit-Position: refs/heads/main@{#38604} --- api/BUILD.gn | 40 +++++++++---------- api/DEPS | 8 ++++ api/task_queue/test/mock_task_queue_base.h | 2 - api/test/mock_async_dns_resolver.h | 6 --- api/test/mock_audio_mixer.h | 11 ----- api/test/mock_audio_sink.h | 2 - api/test/mock_data_channel.h | 10 ++--- api/test/mock_dtmf_sender.h | 5 +-- api/test/mock_fec_controller_override.h | 2 - api/test/mock_frame_decryptor.h | 10 ----- api/test/mock_frame_encryptor.h | 10 ----- api/test/mock_media_stream_interface.h | 24 ++++------- .../mock_peer_connection_factory_interface.h | 11 ++--- api/test/mock_peerconnectioninterface.h | 5 ++- api/test/mock_rtp_transceiver.h | 8 +--- api/test/mock_rtpreceiver.h | 11 +---- api/test/mock_rtpsender.h | 4 +- api/test/mock_transformable_video_frame.h | 15 ++----- api/test/mock_video_bitrate_allocator.h | 2 - .../mock_video_bitrate_allocator_factory.h | 5 +-- api/test/mock_video_decoder.h | 4 -- api/test/mock_video_decoder_factory.h | 3 -- api/test/mock_video_encoder.h | 4 -- api/test/mock_video_encoder_factory.h | 2 - api/test/mock_video_track.h | 12 ++---- 25 files changed, 62 insertions(+), 154 deletions(-) diff --git a/api/BUILD.gn b/api/BUILD.gn index 3360cfd1f9..d6745c998e 100644 --- a/api/BUILD.gn +++ b/api/BUILD.gn @@ -979,7 +979,6 @@ if (rtc_include_tests) { sources = [ "test/mock_audio_mixer.h" ] deps = [ - ":make_ref_counted", "../test:test_support", "audio:audio_mixer_api", ] @@ -991,7 +990,7 @@ if (rtc_include_tests) { sources = [ "test/mock_audio_sink.h" ] deps = [ - ":media_stream_interface", + "../api:media_stream_interface", "../test:test_support", ] absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] @@ -1004,7 +1003,6 @@ if (rtc_include_tests) { deps = [ ":libjingle_peerconnection_api", - ":make_ref_counted", "../test:test_support", ] } @@ -1016,7 +1014,6 @@ if (rtc_include_tests) { deps = [ ":libjingle_peerconnection_api", - ":make_ref_counted", "../test:test_support", ] } @@ -1036,7 +1033,8 @@ if (rtc_include_tests) { testonly = true sources = [ "test/mock_frame_encryptor.h" ] deps = [ - ":make_ref_counted", + # For api/crypto/frame_encryptor_interface.h + ":libjingle_peerconnection_api", "../test:test_support", "crypto:frame_encryptor_interface", ] @@ -1047,7 +1045,7 @@ if (rtc_include_tests) { testonly = true sources = [ "test/mock_frame_decryptor.h" ] deps = [ - ":make_ref_counted", + ":libjingle_peerconnection_api", "../test:test_support", "crypto:frame_decryptor_interface", ] @@ -1058,8 +1056,9 @@ 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", ] } @@ -1072,6 +1071,8 @@ if (rtc_include_tests) { ] deps = [ ":array_view", + ":libjingle_peerconnection_api", + ":make_ref_counted", ":rtp_parameters", "../rtc_base:checks", "../rtc_base:refcount", @@ -1088,6 +1089,8 @@ if (rtc_include_tests) { ] deps = [ ":array_view", + ":libjingle_peerconnection_api", + ":make_ref_counted", ":rtp_parameters", "../rtc_base:checks", "crypto:frame_decryptor_interface", @@ -1100,7 +1103,6 @@ if (rtc_include_tests) { sources = [ "test/mock_media_stream_interface.h" ] deps = [ - ":make_ref_counted", ":media_stream_interface", "../test:test_support", ] @@ -1124,8 +1126,8 @@ if (rtc_include_tests) { deps = [ ":libjingle_peerconnection_api", - ":make_ref_counted", - ":scoped_refptr", + "../api:scoped_refptr", + "../rtc_base:refcount", "../test:test_support", ] } @@ -1137,7 +1139,6 @@ if (rtc_include_tests) { deps = [ ":libjingle_peerconnection_api", - ":make_ref_counted", "../test:test_support", ] } @@ -1173,7 +1174,6 @@ if (rtc_include_tests) { deps = [ ":libjingle_peerconnection_api", - ":make_ref_counted", "../test:test_support", ] } @@ -1195,8 +1195,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", ] } @@ -1206,8 +1206,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", ] } @@ -1220,8 +1220,8 @@ if (rtc_include_tests) { ] deps = [ + "../api/video_codecs:video_codecs_api", "../test:test_support", - "video_codecs:video_codecs_api", ] } @@ -1231,8 +1231,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", ] } @@ -1242,8 +1242,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", ] } @@ -1253,9 +1253,9 @@ if (rtc_include_tests) { sources = [ "test/mock_video_track.h" ] deps = [ - ":make_ref_counted", - ":media_stream_interface", - ":scoped_refptr", + "../api:media_stream_interface", + "../api:scoped_refptr", + "../rtc_base:refcount", "../test:test_support", ] } diff --git a/api/DEPS b/api/DEPS index 484588e280..5f01204068 100644 --- a/api/DEPS +++ b/api/DEPS @@ -250,6 +250,14 @@ 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 4b73d8fe41..2e99be7e82 100644 --- a/api/task_queue/test/mock_task_queue_base.h +++ b/api/task_queue/test/mock_task_queue_base.h @@ -32,8 +32,6 @@ 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 c5048c8429..81132c96a5 100644 --- a/api/test/mock_async_dns_resolver.h +++ b/api/test/mock_async_dns_resolver.h @@ -28,8 +28,6 @@ class MockAsyncDnsResolverResult : public AsyncDnsResolverResult { MOCK_METHOD(int, GetError, (), (const, override)); }; -static_assert(!std::is_abstract_v); - class MockAsyncDnsResolver : public AsyncDnsResolverInterface { public: MOCK_METHOD(void, @@ -43,8 +41,6 @@ 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, @@ -61,8 +57,6 @@ 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 8747356a73..88dc108ca3 100644 --- a/api/test/mock_audio_mixer.h +++ b/api/test/mock_audio_mixer.h @@ -12,7 +12,6 @@ #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 { @@ -20,20 +19,10 @@ 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 ae8c856b53..0c17dc45ca 100644 --- a/api/test/mock_audio_sink.h +++ b/api/test/mock_audio_sink.h @@ -39,8 +39,6 @@ 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 afdf05b137..40f7edb08a 100644 --- a/api/test/mock_data_channel.h +++ b/api/test/mock_data_channel.h @@ -14,15 +14,16 @@ #include #include "api/data_channel_interface.h" -#include "api/make_ref_counted.h" #include "test/gmock.h" namespace webrtc { -class MockDataChannelInterface : public webrtc::DataChannelInterface { +class MockDataChannelInterface final + : public rtc::RefCountedObject { public: static rtc::scoped_refptr Create() { - return rtc::make_ref_counted(); + return rtc::scoped_refptr( + new MockDataChannelInterface()); } MOCK_METHOD(void, @@ -55,9 +56,6 @@ class MockDataChannelInterface : public webrtc::DataChannelInterface { 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 78ae475beb..9029195025 100644 --- a/api/test/mock_dtmf_sender.h +++ b/api/test/mock_dtmf_sender.h @@ -14,7 +14,6 @@ #include #include "api/dtmf_sender_interface.h" -#include "api/make_ref_counted.h" #include "test/gmock.h" namespace webrtc { @@ -28,7 +27,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: @@ -50,7 +49,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 4fff228e13..8f3accbc03 100644 --- a/api/test/mock_fec_controller_override.h +++ b/api/test/mock_fec_controller_override.h @@ -21,8 +21,6 @@ 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 c4320a4874..9604b96cc2 100644 --- a/api/test/mock_frame_decryptor.h +++ b/api/test/mock_frame_decryptor.h @@ -14,17 +14,12 @@ #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, @@ -38,13 +33,8 @@ 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 cb20f62ff1..e47321f801 100644 --- a/api/test/mock_frame_encryptor.h +++ b/api/test/mock_frame_encryptor.h @@ -12,17 +12,12 @@ #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, @@ -37,13 +32,8 @@ 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 6baf02f2a0..209962358d 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 : public AudioSourceInterface { +class MockAudioSource final + : public rtc::RefCountedObject { public: static rtc::scoped_refptr Create() { - return rtc::make_ref_counted(); + return rtc::scoped_refptr(new MockAudioSource()); } MOCK_METHOD(void, @@ -48,16 +48,14 @@ class MockAudioSource : public AudioSourceInterface { MOCK_METHOD(void, RemoveSink, (AudioTrackSinkInterface * sink), (override)); MOCK_METHOD(const cricket::AudioOptions, options, (), (const, override)); - protected: + private: MockAudioSource() = default; }; -static_assert(!std::is_abstract_v>); - -class MockAudioTrack : public AudioTrackInterface { +class MockAudioTrack final : public rtc::RefCountedObject { public: static rtc::scoped_refptr Create() { - return rtc::make_ref_counted(); + return rtc::scoped_refptr(new MockAudioTrack()); } MOCK_METHOD(void, @@ -82,18 +80,12 @@ class MockAudioTrack : public AudioTrackInterface { (), (override)); - protected: + private: 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)); @@ -136,7 +128,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 5ba2c830cc..6bab595b5a 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 - : public PeerConnectionFactoryInterface { +class MockPeerConnectionFactoryInterface final + : public rtc::RefCountedObject { public: static rtc::scoped_refptr Create() { - return rtc::make_ref_counted(); + return rtc::scoped_refptr( + new MockPeerConnectionFactoryInterface()); } MOCK_METHOD(void, SetOptions, (const Options&), (override)); @@ -76,9 +76,6 @@ class MockPeerConnectionFactoryInterface 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 b779f19f59..ccc6ce46b1 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,7 +205,8 @@ 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 39c8773e03..1d21bce5eb 100644 --- a/api/test/mock_rtp_transceiver.h +++ b/api/test/mock_rtp_transceiver.h @@ -14,7 +14,6 @@ #include #include -#include "api/make_ref_counted.h" #include "api/rtp_transceiver_interface.h" #include "test/gmock.h" @@ -22,6 +21,8 @@ namespace webrtc { class MockRtpTransceiver : public RtpTransceiverInterface { public: + MockRtpTransceiver() = default; + static rtc::scoped_refptr Create() { return rtc::make_ref_counted(); } @@ -79,13 +80,8 @@ 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 5adc1aa94c..4bcf064b2a 100644 --- a/api/test/mock_rtpreceiver.h +++ b/api/test/mock_rtpreceiver.h @@ -19,12 +19,8 @@ namespace webrtc { -class MockRtpReceiver : public RtpReceiverInterface { +class MockRtpReceiver : public rtc::RefCountedObject { public: - static rtc::scoped_refptr Create() { - return rtc::make_ref_counted(); - } - MOCK_METHOD(rtc::scoped_refptr, track, (), @@ -42,13 +38,8 @@ class MockRtpReceiver : public RtpReceiverInterface { (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 1a71d8b15f..e2351f87fe 100644 --- a/api/test/mock_rtpsender.h +++ b/api/test/mock_rtpsender.h @@ -15,7 +15,6 @@ #include #include -#include "api/make_ref_counted.h" #include "api/rtp_sender_interface.h" #include "test/gmock.h" @@ -69,8 +68,7 @@ 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 c85b05d3a9..5cebcaba80 100644 --- a/api/test/mock_transformable_video_frame.h +++ b/api/test/mock_transformable_video_frame.h @@ -18,20 +18,13 @@ namespace webrtc { -class MockTransformableVideoFrame : public TransformableVideoFrameInterface { +class MockTransformableVideoFrame + : public webrtc::TransformableVideoFrameInterface { public: - // TransformableFrameInterface MOCK_METHOD(rtc::ArrayView, GetData, (), (const, override)); MOCK_METHOD(void, SetData, (rtc::ArrayView data), (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(uint32_t, GetSsrc, (), (const, override)); MOCK_METHOD(bool, IsKeyFrame, (), (const, override)); MOCK_METHOD(std::vector, GetAdditionalData, (), (const, override)); MOCK_METHOD(const webrtc::VideoFrameMetadata&, @@ -40,8 +33,6 @@ class MockTransformableVideoFrame : public TransformableVideoFrameInterface { (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 8f86ba08f6..76cf49e955 100644 --- a/api/test/mock_video_bitrate_allocator.h +++ b/api/test/mock_video_bitrate_allocator.h @@ -23,8 +23,6 @@ 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 562efd78fe..16af191970 100644 --- a/api/test/mock_video_bitrate_allocator_factory.h +++ b/api/test/mock_video_bitrate_allocator_factory.h @@ -18,7 +18,8 @@ namespace webrtc { -class MockVideoBitrateAllocatorFactory : public VideoBitrateAllocatorFactory { +class MockVideoBitrateAllocatorFactory + : public webrtc::VideoBitrateAllocatorFactory { public: ~MockVideoBitrateAllocatorFactory() override { Die(); } MOCK_METHOD(std::unique_ptr, @@ -28,8 +29,6 @@ class MockVideoBitrateAllocatorFactory : public VideoBitrateAllocatorFactory { 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 ddef1b4f27..34f732ca4d 100644 --- a/api/test/mock_video_decoder.h +++ b/api/test/mock_video_decoder.h @@ -37,8 +37,6 @@ class MockDecodedImageCallback : public DecodedImageCallback { (override)); }; -static_assert(!std::is_abstract_v); - class MockVideoDecoder : public VideoDecoder { public: MockVideoDecoder() { @@ -67,8 +65,6 @@ 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 e61892f7e3..6150d9f8b5 100644 --- a/api/test/mock_video_decoder_factory.h +++ b/api/test/mock_video_decoder_factory.h @@ -35,9 +35,6 @@ 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 c6276a5fd0..11e0f64b3f 100644 --- a/api/test/mock_video_encoder.h +++ b/api/test/mock_video_encoder.h @@ -27,8 +27,6 @@ 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, @@ -70,8 +68,6 @@ 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 427c6a08a2..02ee7aa15e 100644 --- a/api/test/mock_video_encoder_factory.h +++ b/api/test/mock_video_encoder_factory.h @@ -37,8 +37,6 @@ 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 99247f1065..705d13509b 100644 --- a/api/test/mock_video_track.h +++ b/api/test/mock_video_track.h @@ -13,17 +13,18 @@ #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 : public webrtc::VideoTrackInterface { +class MockVideoTrack final + : public rtc::RefCountedObject { public: static rtc::scoped_refptr Create() { - return rtc::make_ref_counted(); + return rtc::scoped_refptr(new MockVideoTrack()); } // NotifierInterface @@ -61,13 +62,8 @@ class MockVideoTrack : public webrtc::VideoTrackInterface { 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_