#include "modules/audio_processing/capture_levels_adjuster/capture_levels_adjuster.h"
#include <algorithm>
#include <tuple>
#include "modules/audio_processing/test/audio_buffer_tools.h"
#include "rtc_base/strings/string_builder.h"
#include "test/gtest.h"
namespace webrtc {
namespace {
float SampleValueForChannel(int channel) { … }
void PopulateBuffer(AudioBuffer& audio_buffer) { … }
float ComputeExpectedSignalGainAfterApplyPreLevelAdjustment(
bool emulated_analog_mic_gain_enabled,
int emulated_analog_mic_gain_level,
float pre_gain) { … }
float ComputeExpectedSignalGainAfterApplyPostLevelAdjustment(
bool emulated_analog_mic_gain_enabled,
int emulated_analog_mic_gain_level,
float pre_gain,
float post_gain) { … }
constexpr int kNumFramesToProcess = …;
class CaptureLevelsAdjusterTest
: public ::testing::Test,
public ::testing::WithParamInterface<
std::tuple<int, int, bool, int, float, float>> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(CaptureLevelsAdjusterTest, InitialGainIsInstantlyAchieved) { … }
TEST_P(CaptureLevelsAdjusterTest, NewGainsAreAchieved) { … }
}
}