2017-04-27 02:08:52 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2017 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_ENCODER_FACTORY_H_
|
|
|
|
|
#define TEST_MOCK_AUDIO_ENCODER_FACTORY_H_
|
2017-04-27 02:08:52 -07:00
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/audio_codecs/audio_encoder_factory.h"
|
2024-07-10 19:22:07 +02:00
|
|
|
#include "api/environment/environment.h"
|
2022-10-07 21:47:49 +00: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"
|
2017-04-27 02:08:52 -07:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2019-04-09 15:11:12 +02:00
|
|
|
class MockAudioEncoderFactory
|
|
|
|
|
: public ::testing::NiceMock<AudioEncoderFactory> {
|
2017-04-27 02:08:52 -07:00
|
|
|
public:
|
2020-05-14 19:50:01 +02:00
|
|
|
MOCK_METHOD(std::vector<AudioCodecSpec>,
|
|
|
|
|
GetSupportedEncoders,
|
|
|
|
|
(),
|
|
|
|
|
(override));
|
2024-08-29 13:00:40 +00:00
|
|
|
MOCK_METHOD(std::optional<AudioCodecInfo>,
|
2020-05-14 19:50:01 +02:00
|
|
|
QueryAudioEncoder,
|
|
|
|
|
(const SdpAudioFormat& format),
|
|
|
|
|
(override));
|
2024-07-10 19:22:07 +02:00
|
|
|
MOCK_METHOD(std::unique_ptr<AudioEncoder>,
|
|
|
|
|
Create,
|
|
|
|
|
(const Environment&, const SdpAudioFormat&, Options),
|
|
|
|
|
(override));
|
2017-04-27 02:08:52 -07:00
|
|
|
|
|
|
|
|
// Creates a MockAudioEncoderFactory with no formats and that may not be
|
|
|
|
|
// invoked to create a codec - useful for initializing a voice engine, for
|
|
|
|
|
// example.
|
2024-07-10 19:22:07 +02:00
|
|
|
static scoped_refptr<MockAudioEncoderFactory> CreateUnusedFactory() {
|
|
|
|
|
auto factory = make_ref_counted<MockAudioEncoderFactory>();
|
|
|
|
|
EXPECT_CALL(*factory, Create).Times(0);
|
2017-04-27 02:08:52 -07:00
|
|
|
return factory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Creates a MockAudioEncoderFactory 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-07-10 19:22:07 +02:00
|
|
|
static scoped_refptr<MockAudioEncoderFactory> CreateEmptyFactory() {
|
|
|
|
|
return make_ref_counted<MockAudioEncoderFactory>();
|
2017-04-27 02:08:52 -07:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // TEST_MOCK_AUDIO_ENCODER_FACTORY_H_
|