From 9c6874607aec46ed9c8ebe2af130a35f1ca36fb6 Mon Sep 17 00:00:00 2001 From: Tony Herre Date: Fri, 26 Jan 2024 11:16:45 +0100 Subject: [PATCH] Consolidate encoded transform mocks into api/test/ Includes removing the duplicate MockTransformableAudioFrame definition in test/ in favour of the existing one in api/test/ Bug: webrtc:15802 Change-Id: Ib5f86b8b2095dd4e580cd9ff0038134f8a43cd93 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/336340 Auto-Submit: Tony Herre Commit-Queue: Stefan Holmer Reviewed-by: Stefan Holmer Cr-Commit-Position: refs/heads/main@{#41622} --- api/BUILD.gn | 10 +++++ {test => api/test}/mock_frame_transformer.h | 6 +-- audio/BUILD.gn | 6 +-- ...ive_frame_transformer_delegate_unittest.cc | 4 +- audio/channel_receive_unittest.cc | 2 +- ...end_frame_transformer_delegate_unittest.cc | 4 +- audio/channel_send_unittest.cc | 2 +- call/BUILD.gn | 2 +- call/rtp_video_sender_unittest.cc | 2 +- modules/rtp_rtcp/BUILD.gn | 4 +- .../frame_transformer_factory_unittest.cc | 2 +- ...deo_frame_transformer_delegate_unittest.cc | 2 +- .../source/rtp_sender_video_unittest.cc | 2 +- ...ver_frame_transformer_delegate_unittest.cc | 2 +- test/BUILD.gn | 22 ---------- test/mock_transformable_frame.h | 41 ------------------- video/BUILD.gn | 2 +- video/rtp_video_stream_receiver2_unittest.cc | 2 +- 18 files changed, 32 insertions(+), 85 deletions(-) rename {test => api/test}/mock_frame_transformer.h (90%) delete mode 100644 test/mock_transformable_frame.h diff --git a/api/BUILD.gn b/api/BUILD.gn index 08e33ca92e..dce687e76b 100644 --- a/api/BUILD.gn +++ b/api/BUILD.gn @@ -1151,6 +1151,16 @@ if (rtc_include_tests) { ] } + rtc_library("mock_frame_transformer") { + visibility = [ "*" ] + testonly = true + sources = [ "test/mock_frame_transformer.h" ] + deps = [ + ":frame_transformer_interface", + "../test:test_support", + ] + } + rtc_library("mock_encoder_selector") { visibility = [ "*" ] testonly = true diff --git a/test/mock_frame_transformer.h b/api/test/mock_frame_transformer.h similarity index 90% rename from test/mock_frame_transformer.h rename to api/test/mock_frame_transformer.h index 617cda8a43..8f438bdf9e 100644 --- a/test/mock_frame_transformer.h +++ b/api/test/mock_frame_transformer.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef TEST_MOCK_FRAME_TRANSFORMER_H_ -#define TEST_MOCK_FRAME_TRANSFORMER_H_ +#ifndef API_TEST_MOCK_FRAME_TRANSFORMER_H_ +#define API_TEST_MOCK_FRAME_TRANSFORMER_H_ #include #include @@ -42,4 +42,4 @@ class MockFrameTransformer : public FrameTransformerInterface { } // namespace webrtc -#endif // TEST_MOCK_FRAME_TRANSFORMER_H_ +#endif // API_TEST_MOCK_FRAME_TRANSFORMER_H_ diff --git a/audio/BUILD.gn b/audio/BUILD.gn index 7ece107407..8679790903 100644 --- a/audio/BUILD.gn +++ b/audio/BUILD.gn @@ -167,6 +167,8 @@ if (rtc_include_tests) { "../api:mock_audio_mixer", "../api:mock_frame_decryptor", "../api:mock_frame_encryptor", + "../api:mock_frame_transformer", + "../api:mock_transformable_audio_frame", "../api:scoped_refptr", "../api/audio:audio_frame_api", "../api/audio_codecs:audio_codecs_api", @@ -210,8 +212,6 @@ if (rtc_include_tests) { "../system_wrappers", "../test:audio_codec_mocks", "../test:field_trial", - "../test:mock_frame_transformer", - "../test:mock_transformable_frame", "../test:mock_transport", "../test:rtp_test_utils", "../test:run_loop", @@ -234,6 +234,7 @@ if (rtc_include_tests) { sources = [ "channel_receive_unittest.cc" ] deps = [ ":audio", + "../api:mock_frame_transformer", "../api/audio_codecs:builtin_audio_decoder_factory", "../api/crypto:frame_decryptor_interface", "../api/task_queue:default_task_queue_factory", @@ -245,7 +246,6 @@ if (rtc_include_tests) { "../rtc_base:logging", "../rtc_base:threading", "../test:audio_codec_mocks", - "../test:mock_frame_transformer", "../test:mock_transport", "../test:test_support", "../test/time_controller", diff --git a/audio/channel_receive_frame_transformer_delegate_unittest.cc b/audio/channel_receive_frame_transformer_delegate_unittest.cc index 8bdf217d5a..a206a09f99 100644 --- a/audio/channel_receive_frame_transformer_delegate_unittest.cc +++ b/audio/channel_receive_frame_transformer_delegate_unittest.cc @@ -13,11 +13,11 @@ #include #include +#include "api/test/mock_frame_transformer.h" +#include "api/test/mock_transformable_audio_frame.h" #include "audio/channel_send_frame_transformer_delegate.h" #include "test/gmock.h" #include "test/gtest.h" -#include "test/mock_frame_transformer.h" -#include "test/mock_transformable_frame.h" namespace webrtc { namespace { diff --git a/audio/channel_receive_unittest.cc b/audio/channel_receive_unittest.cc index aab8a95d8b..8ca1e9e32b 100644 --- a/audio/channel_receive_unittest.cc +++ b/audio/channel_receive_unittest.cc @@ -14,6 +14,7 @@ #include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/crypto/frame_decryptor_interface.h" #include "api/task_queue/default_task_queue_factory.h" +#include "api/test/mock_frame_transformer.h" #include "logging/rtc_event_log/mock/mock_rtc_event_log.h" #include "modules/audio_device/include/audio_device.h" #include "modules/audio_device/include/mock_audio_device.h" @@ -29,7 +30,6 @@ #include "test/gmock.h" #include "test/gtest.h" #include "test/mock_audio_decoder_factory.h" -#include "test/mock_frame_transformer.h" #include "test/mock_transport.h" #include "test/time_controller/simulated_time_controller.h" diff --git a/audio/channel_send_frame_transformer_delegate_unittest.cc b/audio/channel_send_frame_transformer_delegate_unittest.cc index 483a2cce78..5295e2657f 100644 --- a/audio/channel_send_frame_transformer_delegate_unittest.cc +++ b/audio/channel_send_frame_transformer_delegate_unittest.cc @@ -15,11 +15,11 @@ #include #include "absl/memory/memory.h" +#include "api/test/mock_frame_transformer.h" +#include "api/test/mock_transformable_audio_frame.h" #include "rtc_base/task_queue_for_test.h" #include "test/gmock.h" #include "test/gtest.h" -#include "test/mock_frame_transformer.h" -#include "test/mock_transformable_frame.h" namespace webrtc { namespace { diff --git a/audio/channel_send_unittest.cc b/audio/channel_send_unittest.cc index c86dcefadc..77d8479519 100644 --- a/audio/channel_send_unittest.cc +++ b/audio/channel_send_unittest.cc @@ -17,12 +17,12 @@ #include "api/environment/environment.h" #include "api/environment/environment_factory.h" #include "api/scoped_refptr.h" +#include "api/test/mock_frame_transformer.h" #include "api/units/time_delta.h" #include "api/units/timestamp.h" #include "call/rtp_transport_controller_send.h" #include "rtc_base/gunit.h" #include "test/gtest.h" -#include "test/mock_frame_transformer.h" #include "test/mock_transport.h" #include "test/scoped_key_value_config.h" #include "test/time_controller/simulated_time_controller.h" diff --git a/call/BUILD.gn b/call/BUILD.gn index 32ebc2e9cf..8af3eac754 100644 --- a/call/BUILD.gn +++ b/call/BUILD.gn @@ -481,6 +481,7 @@ if (rtc_include_tests) { "../api:array_view", "../api:create_frame_generator", "../api:mock_audio_mixer", + "../api:mock_frame_transformer", "../api:rtp_headers", "../api:rtp_parameters", "../api:transport_api", @@ -525,7 +526,6 @@ if (rtc_include_tests) { "../test:fake_video_codecs", "../test:field_trial", "../test:frame_generator_capturer", - "../test:mock_frame_transformer", "../test:mock_transport", "../test:run_loop", "../test:scoped_key_value_config", diff --git a/call/rtp_video_sender_unittest.cc b/call/rtp_video_sender_unittest.cc index 72234aa409..cd525f0d61 100644 --- a/call/rtp_video_sender_unittest.cc +++ b/call/rtp_video_sender_unittest.cc @@ -18,6 +18,7 @@ #include "absl/functional/any_invocable.h" #include "api/environment/environment.h" #include "api/environment/environment_factory.h" +#include "api/test/mock_frame_transformer.h" #include "call/rtp_transport_controller_send.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "modules/rtp_rtcp/source/byte_io.h" @@ -29,7 +30,6 @@ #include "rtc_base/rate_limiter.h" #include "test/gmock.h" #include "test/gtest.h" -#include "test/mock_frame_transformer.h" #include "test/mock_transport.h" #include "test/scenario/scenario.h" #include "test/scoped_key_value_config.h" diff --git a/modules/rtp_rtcp/BUILD.gn b/modules/rtp_rtcp/BUILD.gn index b471c2fa76..2c0a19e995 100644 --- a/modules/rtp_rtcp/BUILD.gn +++ b/modules/rtp_rtcp/BUILD.gn @@ -652,6 +652,7 @@ if (rtc_include_tests) { "../../api:frame_transformer_factory", "../../api:make_ref_counted", "../../api:mock_frame_encryptor", + "../../api:mock_frame_transformer", "../../api:mock_transformable_video_frame", "../../api:rtp_headers", "../../api:rtp_packet_info", @@ -698,7 +699,6 @@ if (rtc_include_tests) { "../../rtc_base:timeutils", "../../system_wrappers", "../../test:explicit_key_value_config", - "../../test:mock_frame_transformer", "../../test:mock_transport", "../../test:rtp_test_utils", "../../test:run_loop", @@ -720,13 +720,13 @@ if (rtc_include_tests) { sources = [ "source/frame_transformer_factory_unittest.cc" ] deps = [ "../../api:frame_transformer_factory", + "../../api:mock_frame_transformer", "../../api:mock_transformable_audio_frame", "../../api:mock_transformable_video_frame", "../../api:transport_api", "../../call:video_stream_api", "../../modules/rtp_rtcp", "../../rtc_base:rtc_event", - "../../test:mock_frame_transformer", "../../test:test_support", "../../video", ] diff --git a/modules/rtp_rtcp/source/frame_transformer_factory_unittest.cc b/modules/rtp_rtcp/source/frame_transformer_factory_unittest.cc index a61179e9d3..788052da39 100644 --- a/modules/rtp_rtcp/source/frame_transformer_factory_unittest.cc +++ b/modules/rtp_rtcp/source/frame_transformer_factory_unittest.cc @@ -17,6 +17,7 @@ #include "absl/memory/memory.h" #include "api/call/transport.h" +#include "api/test/mock_frame_transformer.h" #include "api/test/mock_transformable_audio_frame.h" #include "api/test/mock_transformable_video_frame.h" #include "call/video_receive_stream.h" @@ -24,7 +25,6 @@ #include "rtc_base/event.h" #include "test/gmock.h" #include "test/gtest.h" -#include "test/mock_frame_transformer.h" namespace webrtc { namespace { diff --git a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate_unittest.cc b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate_unittest.cc index 6790fc3a71..586836a90e 100644 --- a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate_unittest.cc @@ -12,11 +12,11 @@ #include +#include "api/test/mock_frame_transformer.h" #include "api/test/mock_transformable_video_frame.h" #include "rtc_base/event.h" #include "test/gmock.h" #include "test/gtest.h" -#include "test/mock_frame_transformer.h" #include "test/time_controller/simulated_time_controller.h" namespace webrtc { diff --git a/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc b/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc index 9641d617d9..112a2979fd 100644 --- a/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc @@ -21,6 +21,7 @@ #include "api/task_queue/task_queue_base.h" #include "api/task_queue/task_queue_factory.h" #include "api/test/mock_frame_encryptor.h" +#include "api/test/mock_frame_transformer.h" #include "api/transport/rtp/dependency_descriptor.h" #include "api/units/timestamp.h" #include "api/video/video_codec_constants.h" @@ -46,7 +47,6 @@ #include "test/explicit_key_value_config.h" #include "test/gmock.h" #include "test/gtest.h" -#include "test/mock_frame_transformer.h" #include "test/time_controller/simulated_time_controller.h" namespace webrtc { diff --git a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate_unittest.cc b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate_unittest.cc index cf3062610f..192e239535 100644 --- a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate_unittest.cc @@ -17,6 +17,7 @@ #include "absl/memory/memory.h" #include "api/call/transport.h" +#include "api/test/mock_frame_transformer.h" #include "api/test/mock_transformable_video_frame.h" #include "api/units/timestamp.h" #include "call/video_receive_stream.h" @@ -24,7 +25,6 @@ #include "rtc_base/event.h" #include "test/gmock.h" #include "test/gtest.h" -#include "test/mock_frame_transformer.h" namespace webrtc { namespace { diff --git a/test/BUILD.gn b/test/BUILD.gn index d6b2b989ad..185f12c3ed 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -1101,28 +1101,6 @@ rtc_source_set("test_renderer") { } } -rtc_library("mock_frame_transformer") { - visibility = [ "*" ] - testonly = true - sources = [ "mock_frame_transformer.h" ] - deps = [ - "../api:frame_transformer_interface", - "../test:test_support", - ] -} - -rtc_library("mock_transformable_frame") { - visibility = [ "*" ] - - testonly = true - sources = [ "mock_transformable_frame.h" ] - - deps = [ - "../api:frame_transformer_interface", - "../test:test_support", - ] -} - if (is_mac) { rtc_library("test_renderer_objc") { testonly = true diff --git a/test/mock_transformable_frame.h b/test/mock_transformable_frame.h deleted file mode 100644 index 26eb6b7030..0000000000 --- a/test/mock_transformable_frame.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2020 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef TEST_MOCK_TRANSFORMABLE_FRAME_H_ -#define TEST_MOCK_TRANSFORMABLE_FRAME_H_ - -#include "api/frame_transformer_interface.h" -#include "test/gmock.h" - -namespace webrtc { - -class MockTransformableAudioFrame : public TransformableAudioFrameInterface { - public: - MOCK_METHOD(rtc::ArrayView, GetData, (), (const, override)); - MOCK_METHOD(rtc::ArrayView, - GetContributingSources, - (), - (const, override)); - MOCK_METHOD(absl::optional, - AbsoluteCaptureTimestamp, - (), - (const, override)); - MOCK_METHOD(void, SetData, (rtc::ArrayView), (override)); - MOCK_METHOD(uint8_t, GetPayloadType, (), (const, override)); - MOCK_METHOD(uint32_t, GetSsrc, (), (const, override)); - MOCK_METHOD(uint32_t, GetTimestamp, (), (const, override)); - MOCK_METHOD(void, SetRTPTimestamp, (uint32_t), (override)); - MOCK_METHOD(Direction, GetDirection, (), (const, override)); - MOCK_METHOD(std::string, GetMimeType, (), (const, override)); -}; - -} // namespace webrtc - -#endif // TEST_MOCK_TRANSFORMABLE_FRAME_H_ diff --git a/video/BUILD.gn b/video/BUILD.gn index 0891a31f7b..5a114c5fb7 100644 --- a/video/BUILD.gn +++ b/video/BUILD.gn @@ -830,6 +830,7 @@ if (rtc_include_tests) { "../api:libjingle_peerconnection_api", "../api:mock_fec_controller_override", "../api:mock_frame_decryptor", + "../api:mock_frame_transformer", "../api:mock_video_codec_factory", "../api:mock_video_decoder", "../api:mock_video_encoder", @@ -947,7 +948,6 @@ if (rtc_include_tests) { "../test:fileutils", "../test:frame_generator_capturer", "../test:frame_utils", - "../test:mock_frame_transformer", "../test:mock_transport", "../test:null_transport", "../test:rtp_test_utils", diff --git a/video/rtp_video_stream_receiver2_unittest.cc b/video/rtp_video_stream_receiver2_unittest.cc index f039bf29b1..6962540152 100644 --- a/video/rtp_video_stream_receiver2_unittest.cc +++ b/video/rtp_video_stream_receiver2_unittest.cc @@ -14,6 +14,7 @@ #include #include "api/task_queue/task_queue_base.h" +#include "api/test/mock_frame_transformer.h" #include "api/video/video_codec_type.h" #include "api/video/video_frame_type.h" #include "call/test/mock_rtp_packet_sink_interface.h" @@ -35,7 +36,6 @@ #include "system_wrappers/include/clock.h" #include "test/gmock.h" #include "test/gtest.h" -#include "test/mock_frame_transformer.h" #include "test/mock_transport.h" #include "test/rtcp_packet_parser.h" #include "test/scoped_key_value_config.h"