2016-05-03 01:39:01 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2016 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef TEST_MOCK_AUDIO_DECODER_FACTORY_H_
|
|
|
|
|
#define TEST_MOCK_AUDIO_DECODER_FACTORY_H_
|
2016-05-03 01:39:01 -07:00
|
|
|
|
2017-04-10 05:15:48 -07:00
|
|
|
#include <memory>
|
2016-05-03 01:39:01 -07:00
|
|
|
#include <vector>
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/audio_codecs/audio_decoder_factory.h"
|
|
|
|
|
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
2024-08-14 19:17:05 +02:00
|
|
|
#include "api/environment/environment.h"
|
2022-06-14 15:48:26 +02:00
|
|
|
#include "api/make_ref_counted.h"
|
2019-01-25 20:26:48 +01:00
|
|
|
#include "api/scoped_refptr.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "test/gmock.h"
|
2016-05-03 01:39:01 -07:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
class MockAudioDecoderFactory : public AudioDecoderFactory {
|
|
|
|
|
public:
|
2016-08-17 02:45:41 -07:00
|
|
|
// Creates a MockAudioDecoderFactory with no formats and that may not be
|
|
|
|
|
// invoked to create a codec - useful for initializing a voice engine, for
|
|
|
|
|
// example.
|
2024-08-14 19:17:05 +02:00
|
|
|
static scoped_refptr<AudioDecoderFactory> CreateUnusedFactory() {
|
|
|
|
|
auto factory =
|
|
|
|
|
make_ref_counted<testing::NiceMock<MockAudioDecoderFactory>>();
|
|
|
|
|
EXPECT_CALL(*factory, Create).Times(0);
|
2016-08-17 02:45:41 -07:00
|
|
|
return factory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Creates a MockAudioDecoderFactory with no formats that may be invoked to
|
|
|
|
|
// create a codec any number of times. It will, though, return nullptr on each
|
|
|
|
|
// call, since it supports no codecs.
|
2024-08-14 19:17:05 +02:00
|
|
|
static scoped_refptr<AudioDecoderFactory> CreateEmptyFactory() {
|
|
|
|
|
return make_ref_counted<testing::NiceMock<MockAudioDecoderFactory>>();
|
2016-08-17 02:45:41 -07:00
|
|
|
}
|
2024-08-14 19:17:05 +02:00
|
|
|
|
|
|
|
|
MOCK_METHOD(std::vector<AudioCodecSpec>,
|
|
|
|
|
GetSupportedDecoders,
|
|
|
|
|
(),
|
|
|
|
|
(override));
|
|
|
|
|
MOCK_METHOD(bool, IsSupportedDecoder, (const SdpAudioFormat&), (override));
|
|
|
|
|
MOCK_METHOD(std::unique_ptr<AudioDecoder>,
|
|
|
|
|
Create,
|
|
|
|
|
(const Environment&,
|
|
|
|
|
const SdpAudioFormat&,
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<AudioCodecPairId>),
|
2024-08-14 19:17:05 +02:00
|
|
|
(override));
|
2016-05-03 01:39:01 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // TEST_MOCK_AUDIO_DECODER_FACTORY_H_
|