Move AudioDecoder and AudioDecoderFactory mocks to webrtc/test/

AudioDecoder and AudioDecoderFactory are in webrtc/api/ now, so move
their mocks to someplace central where tests from all over WebRTC are
allowed to #include them.

BUG=webrtc:5805

Review-Url: https://codereview.webrtc.org/2798063004
Cr-Commit-Position: refs/heads/master@{#17619}
This commit is contained in:
kwiberg
2017-04-10 05:15:48 -07:00
committed by Commit bot
parent 2fa97fdbe5
commit 37e99fd3fa
16 changed files with 34 additions and 24 deletions

View File

@ -16,11 +16,11 @@
#include "webrtc/audio/audio_receive_stream.h" #include "webrtc/audio/audio_receive_stream.h"
#include "webrtc/audio/conversion.h" #include "webrtc/audio/conversion.h"
#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h" #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
#include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h"
#include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller.h" #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller.h"
#include "webrtc/modules/pacing/packet_router.h" #include "webrtc/modules/pacing/packet_router.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h" #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
#include "webrtc/test/gtest.h" #include "webrtc/test/gtest.h"
#include "webrtc/test/mock_audio_decoder_factory.h"
#include "webrtc/test/mock_voe_channel_proxy.h" #include "webrtc/test/mock_voe_channel_proxy.h"
#include "webrtc/test/mock_voice_engine.h" #include "webrtc/test/mock_voice_engine.h"

View File

@ -86,6 +86,7 @@ if (rtc_include_tests) {
"../modules/pacing", "../modules/pacing",
"../modules/rtp_rtcp", "../modules/rtp_rtcp",
"../system_wrappers", "../system_wrappers",
"../test:audio_codec_mocks",
"../test:direct_transport", "../test:direct_transport",
"../test:test_common", "../test:test_common",
"../test:test_support", "../test:test_support",

View File

@ -15,9 +15,9 @@
#include "webrtc/call/audio_state.h" #include "webrtc/call/audio_state.h"
#include "webrtc/call/call.h" #include "webrtc/call/call.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log.h" #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
#include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h"
#include "webrtc/modules/audio_mixer/audio_mixer_impl.h" #include "webrtc/modules/audio_mixer/audio_mixer_impl.h"
#include "webrtc/test/gtest.h" #include "webrtc/test/gtest.h"
#include "webrtc/test/mock_audio_decoder_factory.h"
#include "webrtc/test/mock_transport.h" #include "webrtc/test/mock_transport.h"
#include "webrtc/test/mock_voice_engine.h" #include "webrtc/test/mock_voice_engine.h"

View File

@ -454,6 +454,7 @@ if (rtc_include_tests) {
"../modules/video_coding:webrtc_vp8", "../modules/video_coding:webrtc_vp8",
"../p2p:rtc_p2p_unittests", "../p2p:rtc_p2p_unittests",
"../system_wrappers:metrics_default", "../system_wrappers:metrics_default",
"../test:audio_codec_mocks",
"../test:test_support", "../test:test_support",
"../voice_engine:voice_engine", "../voice_engine:voice_engine",
] ]

View File

@ -11,11 +11,11 @@
#include "webrtc/media/engine/apm_helpers.h" #include "webrtc/media/engine/apm_helpers.h"
#include "webrtc/media/engine/webrtcvoe.h" #include "webrtc/media/engine/webrtcvoe.h"
#include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h"
#include "webrtc/modules/audio_device/include/mock_audio_device.h" #include "webrtc/modules/audio_device/include/mock_audio_device.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h" #include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/test/gmock.h" #include "webrtc/test/gmock.h"
#include "webrtc/test/gtest.h" #include "webrtc/test/gtest.h"
#include "webrtc/test/mock_audio_decoder_factory.h"
#include "webrtc/voice_engine/transmit_mixer.h" #include "webrtc/voice_engine/transmit_mixer.h"
namespace webrtc { namespace webrtc {

View File

@ -10,8 +10,8 @@
#include "webrtc/media/engine/nullwebrtcvideoengine.h" #include "webrtc/media/engine/nullwebrtcvideoengine.h"
#include "webrtc/media/engine/webrtcvoiceengine.h" #include "webrtc/media/engine/webrtcvoiceengine.h"
#include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h"
#include "webrtc/test/gtest.h" #include "webrtc/test/gtest.h"
#include "webrtc/test/mock_audio_decoder_factory.h"
namespace cricket { namespace cricket {

View File

@ -23,12 +23,12 @@
#include "webrtc/media/engine/fakewebrtccall.h" #include "webrtc/media/engine/fakewebrtccall.h"
#include "webrtc/media/engine/fakewebrtcvoiceengine.h" #include "webrtc/media/engine/fakewebrtcvoiceengine.h"
#include "webrtc/media/engine/webrtcvoiceengine.h" #include "webrtc/media/engine/webrtcvoiceengine.h"
#include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h"
#include "webrtc/modules/audio_device/include/mock_audio_device.h" #include "webrtc/modules/audio_device/include/mock_audio_device.h"
#include "webrtc/modules/audio_processing/include/mock_audio_processing.h" #include "webrtc/modules/audio_processing/include/mock_audio_processing.h"
#include "webrtc/pc/channel.h" #include "webrtc/pc/channel.h"
#include "webrtc/test/field_trial.h" #include "webrtc/test/field_trial.h"
#include "webrtc/test/gtest.h" #include "webrtc/test/gtest.h"
#include "webrtc/test/mock_audio_decoder_factory.h"
#include "webrtc/voice_engine/transmit_mixer.h" #include "webrtc/voice_engine/transmit_mixer.h"
using testing::ContainerEq; using testing::ContainerEq;

View File

@ -2064,7 +2064,6 @@ if (rtc_include_tests) {
"neteq/dtmf_tone_generator_unittest.cc", "neteq/dtmf_tone_generator_unittest.cc",
"neteq/expand_unittest.cc", "neteq/expand_unittest.cc",
"neteq/merge_unittest.cc", "neteq/merge_unittest.cc",
"neteq/mock/mock_audio_decoder.h",
"neteq/mock/mock_buffer_level_filter.h", "neteq/mock/mock_buffer_level_filter.h",
"neteq/mock/mock_decoder_database.h", "neteq/mock/mock_decoder_database.h",
"neteq/mock/mock_delay_manager.h", "neteq/mock/mock_delay_manager.h",
@ -2126,6 +2125,7 @@ if (rtc_include_tests) {
"../../base:rtc_base_tests_utils", "../../base:rtc_base_tests_utils",
"../../common_audio", "../../common_audio",
"../../system_wrappers:system_wrappers", "../../system_wrappers:system_wrappers",
"../../test:audio_codec_mocks",
"../../test:field_trial", "../../test:field_trial",
"../../test:rtp_test_utils", "../../test:rtp_test_utils",
"../../test:test_common", "../../test:test_common",

View File

@ -30,7 +30,6 @@
#include "webrtc/modules/audio_coding/include/audio_coding_module.h" #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h" #include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h"
#include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h" #include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h"
#include "webrtc/modules/audio_coding/neteq/mock/mock_audio_decoder.h"
#include "webrtc/modules/audio_coding/neteq/tools/audio_checksum.h" #include "webrtc/modules/audio_coding/neteq/tools/audio_checksum.h"
#include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h" #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h"
#include "webrtc/modules/audio_coding/neteq/tools/constant_pcm_packet_source.h" #include "webrtc/modules/audio_coding/neteq/tools/constant_pcm_packet_source.h"
@ -44,6 +43,7 @@
#include "webrtc/system_wrappers/include/event_wrapper.h" #include "webrtc/system_wrappers/include/event_wrapper.h"
#include "webrtc/system_wrappers/include/sleep.h" #include "webrtc/system_wrappers/include/sleep.h"
#include "webrtc/test/gtest.h" #include "webrtc/test/gtest.h"
#include "webrtc/test/mock_audio_decoder.h"
#include "webrtc/test/testsupport/fileutils.h" #include "webrtc/test/testsupport/fileutils.h"
using ::testing::AtLeast; using ::testing::AtLeast;

View File

@ -10,15 +10,15 @@
// Unit tests for DecisionLogic class and derived classes. // Unit tests for DecisionLogic class and derived classes.
#include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h"
#include "webrtc/modules/audio_coding/neteq/buffer_level_filter.h"
#include "webrtc/modules/audio_coding/neteq/decision_logic.h" #include "webrtc/modules/audio_coding/neteq/decision_logic.h"
#include "webrtc/modules/audio_coding/neteq/buffer_level_filter.h"
#include "webrtc/modules/audio_coding/neteq/decoder_database.h" #include "webrtc/modules/audio_coding/neteq/decoder_database.h"
#include "webrtc/modules/audio_coding/neteq/delay_manager.h" #include "webrtc/modules/audio_coding/neteq/delay_manager.h"
#include "webrtc/modules/audio_coding/neteq/delay_peak_detector.h" #include "webrtc/modules/audio_coding/neteq/delay_peak_detector.h"
#include "webrtc/modules/audio_coding/neteq/packet_buffer.h" #include "webrtc/modules/audio_coding/neteq/packet_buffer.h"
#include "webrtc/modules/audio_coding/neteq/tick_timer.h" #include "webrtc/modules/audio_coding/neteq/tick_timer.h"
#include "webrtc/test/gtest.h" #include "webrtc/test/gtest.h"
#include "webrtc/test/mock_audio_decoder_factory.h"
namespace webrtc { namespace webrtc {

View File

@ -16,10 +16,10 @@
#include <string> #include <string>
#include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
#include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h"
#include "webrtc/modules/audio_coding/neteq/mock/mock_audio_decoder.h"
#include "webrtc/test/gmock.h" #include "webrtc/test/gmock.h"
#include "webrtc/test/gtest.h" #include "webrtc/test/gtest.h"
#include "webrtc/test/mock_audio_decoder.h"
#include "webrtc/test/mock_audio_decoder_factory.h"
using testing::_; using testing::_;
using testing::Invoke; using testing::Invoke;

View File

@ -12,11 +12,9 @@
#include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
#include "webrtc/base/safe_conversions.h" #include "webrtc/base/safe_conversions.h"
#include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h"
#include "webrtc/modules/audio_coding/neteq/accelerate.h" #include "webrtc/modules/audio_coding/neteq/accelerate.h"
#include "webrtc/modules/audio_coding/neteq/expand.h" #include "webrtc/modules/audio_coding/neteq/expand.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h" #include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/modules/audio_coding/neteq/mock/mock_audio_decoder.h"
#include "webrtc/modules/audio_coding/neteq/mock/mock_buffer_level_filter.h" #include "webrtc/modules/audio_coding/neteq/mock/mock_buffer_level_filter.h"
#include "webrtc/modules/audio_coding/neteq/mock/mock_decoder_database.h" #include "webrtc/modules/audio_coding/neteq/mock/mock_decoder_database.h"
#include "webrtc/modules/audio_coding/neteq/mock/mock_delay_manager.h" #include "webrtc/modules/audio_coding/neteq/mock/mock_delay_manager.h"
@ -32,6 +30,8 @@
#include "webrtc/modules/include/module_common_types.h" #include "webrtc/modules/include/module_common_types.h"
#include "webrtc/test/gmock.h" #include "webrtc/test/gmock.h"
#include "webrtc/test/gtest.h" #include "webrtc/test/gtest.h"
#include "webrtc/test/mock_audio_decoder.h"
#include "webrtc/test/mock_audio_decoder_factory.h"
using ::testing::AtLeast; using ::testing::AtLeast;
using ::testing::Return; using ::testing::Return;

View File

@ -18,10 +18,10 @@
#include <utility> // pair #include <utility> // pair
#include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
#include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h"
#include "webrtc/modules/audio_coding/neteq/mock/mock_decoder_database.h" #include "webrtc/modules/audio_coding/neteq/mock/mock_decoder_database.h"
#include "webrtc/modules/audio_coding/neteq/packet.h" #include "webrtc/modules/audio_coding/neteq/packet.h"
#include "webrtc/test/gtest.h" #include "webrtc/test/gtest.h"
#include "webrtc/test/mock_audio_decoder_factory.h"
using ::testing::Return; using ::testing::Return;
using ::testing::ReturnNull; using ::testing::ReturnNull;

View File

@ -489,3 +489,11 @@ rtc_source_set("test_renderer") {
"//testing/gtest", "//testing/gtest",
] ]
} }
rtc_source_set("audio_codec_mocks") {
testonly = true
sources = [
"mock_audio_decoder.h",
"mock_audio_decoder_factory.h",
]
}

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_AUDIO_DECODER_H_ #ifndef WEBRTC_TEST_MOCK_AUDIO_DECODER_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_AUDIO_DECODER_H_ #define WEBRTC_TEST_MOCK_AUDIO_DECODER_H_
#include "webrtc/api/audio_codecs/audio_decoder.h" #include "webrtc/api/audio_codecs/audio_decoder.h"
#include "webrtc/test/gmock.h" #include "webrtc/test/gmock.h"
@ -26,8 +26,8 @@ class MockAudioDecoder : public AudioDecoder {
MOCK_CONST_METHOD0(HasDecodePlc, bool()); MOCK_CONST_METHOD0(HasDecodePlc, bool());
MOCK_METHOD2(DecodePlc, size_t(size_t, int16_t*)); MOCK_METHOD2(DecodePlc, size_t(size_t, int16_t*));
MOCK_METHOD0(Reset, void()); MOCK_METHOD0(Reset, void());
MOCK_METHOD5(IncomingPacket, int(const uint8_t*, size_t, uint16_t, uint32_t, MOCK_METHOD5(IncomingPacket,
uint32_t)); int(const uint8_t*, size_t, uint16_t, uint32_t, uint32_t));
MOCK_METHOD0(ErrorCode, int()); MOCK_METHOD0(ErrorCode, int());
MOCK_CONST_METHOD2(PacketDuration, int(const uint8_t*, size_t)); MOCK_CONST_METHOD2(PacketDuration, int(const uint8_t*, size_t));
MOCK_CONST_METHOD0(Channels, size_t()); MOCK_CONST_METHOD0(Channels, size_t());
@ -35,4 +35,4 @@ class MockAudioDecoder : public AudioDecoder {
}; };
} // namespace webrtc } // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_AUDIO_DECODER_H_ #endif // WEBRTC_TEST_MOCK_AUDIO_DECODER_H_

View File

@ -8,9 +8,10 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_MOCK_MOCK_AUDIO_DECODER_FACTORY_H_ #ifndef WEBRTC_TEST_MOCK_AUDIO_DECODER_FACTORY_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_MOCK_MOCK_AUDIO_DECODER_FACTORY_H_ #define WEBRTC_TEST_MOCK_AUDIO_DECODER_FACTORY_H_
#include <memory>
#include <vector> #include <vector>
#include "webrtc/api/audio_codecs/audio_decoder_factory.h" #include "webrtc/api/audio_codecs/audio_decoder_factory.h"
@ -24,8 +25,7 @@ class MockAudioDecoderFactory : public AudioDecoderFactory {
public: public:
MOCK_METHOD0(GetSupportedDecoders, std::vector<AudioCodecSpec>()); MOCK_METHOD0(GetSupportedDecoders, std::vector<AudioCodecSpec>());
MOCK_METHOD1(IsSupportedDecoder, bool(const SdpAudioFormat&)); MOCK_METHOD1(IsSupportedDecoder, bool(const SdpAudioFormat&));
std::unique_ptr<AudioDecoder> MakeAudioDecoder( std::unique_ptr<AudioDecoder> MakeAudioDecoder(const SdpAudioFormat& format) {
const SdpAudioFormat& format) {
std::unique_ptr<AudioDecoder> return_value; std::unique_ptr<AudioDecoder> return_value;
MakeAudioDecoderMock(format, &return_value); MakeAudioDecoderMock(format, &return_value);
return return_value; return return_value;
@ -80,4 +80,4 @@ class MockAudioDecoderFactory : public AudioDecoderFactory {
} // namespace webrtc } // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_MOCK_MOCK_AUDIO_DECODER_FACTORY_H_ #endif // WEBRTC_TEST_MOCK_AUDIO_DECODER_FACTORY_H_