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 <herre@google.com>
Commit-Queue: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41622}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 08e33ca..dce687e 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -1151,6 +1151,16 @@
]
}
+ 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 617cda8..8f438bd 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 <memory>
#include <vector>
@@ -42,4 +42,4 @@
} // 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 7ece107..8679790 100644
--- a/audio/BUILD.gn
+++ b/audio/BUILD.gn
@@ -167,6 +167,8 @@
"../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 @@
"../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 @@
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 @@
"../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 8bdf217..a206a09 100644
--- a/audio/channel_receive_frame_transformer_delegate_unittest.cc
+++ b/audio/channel_receive_frame_transformer_delegate_unittest.cc
@@ -13,11 +13,11 @@
#include <memory>
#include <utility>
+#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 aab8a95..8ca1e9e 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 483a2cc..5295e26 100644
--- a/audio/channel_send_frame_transformer_delegate_unittest.cc
+++ b/audio/channel_send_frame_transformer_delegate_unittest.cc
@@ -15,11 +15,11 @@
#include <vector>
#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 c86dcef..77d8479 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 32ebc2e..8af3eac 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -481,6 +481,7 @@
"../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 @@
"../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 72234aa..cd525f0 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 b471c2f..2c0a19e 100644
--- a/modules/rtp_rtcp/BUILD.gn
+++ b/modules/rtp_rtcp/BUILD.gn
@@ -652,6 +652,7 @@
"../../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 @@
"../../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 @@
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 a61179e..788052d 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 6790fc3..586836a 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 <utility>
+#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 9641d61..112a297 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 cf30626..192e239 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 d6b2b98..185f12c 100644
--- a/test/BUILD.gn
+++ b/test/BUILD.gn
@@ -1101,28 +1101,6 @@
}
}
-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 26eb6b7..0000000
--- 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<const uint8_t>, GetData, (), (const, override));
- MOCK_METHOD(rtc::ArrayView<const uint32_t>,
- GetContributingSources,
- (),
- (const, override));
- MOCK_METHOD(absl::optional<uint64_t>,
- AbsoluteCaptureTimestamp,
- (),
- (const, override));
- MOCK_METHOD(void, SetData, (rtc::ArrayView<const uint8_t>), (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 0891a31..5a114c5 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -830,6 +830,7 @@
"../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 @@
"../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 f039bf2..6962540 100644
--- a/video/rtp_video_stream_receiver2_unittest.cc
+++ b/video/rtp_video_stream_receiver2_unittest.cc
@@ -14,6 +14,7 @@
#include <utility>
#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"