chromium/media/webrtc/helpers_unittests.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "media/webrtc/helpers.h"

#include "base/logging.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "media/webrtc/webrtc_features.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace media {
namespace {

constexpr webrtc::AudioProcessing::Config kDefaultApmConfig{};

webrtc::AudioProcessing::Config CreateApmGetConfig(
    const AudioProcessingSettings& settings) {}

// TODO(b/260315490): Add missing tests with different `AudioProcessingSettings`
// values.

// Verify that the default settings in AudioProcessingSettings are applied
// correctly by `CreateWebRtcAudioProcessingModule()`.
TEST(CreateWebRtcAudioProcessingModuleTest, CheckDefaultAudioProcessingConfig) {}

TEST(CreateWebRtcAudioProcessingModuleTest,
     Agc2ConfigUnchangedIfAgcSettingsDisabled) {}

#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
    BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
TEST(CreateWebRtcAudioProcessingModuleTest,
     InputVolumeAdjustmentEnabledWithAgc2) {}
#endif  // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
        // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)

#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
TEST(CreateWebRtcAudioProcessingModuleTest,
     CanDisableInputVolumeAdjustmentWithAgc2) {}
#endif  // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)

#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
    BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
TEST(CreateWebRtcAudioProcessingModuleTest,
     OnlyOneInputVolumeControllerEnabledOnDesktopPlatforms) {}
#else
TEST(CreateWebRtcAudioProcessingModuleTest,
     InputVolumeControllerDisabledOnNonDesktopPlatforms) {
  auto config = CreateApmGetConfig(
      /*settings=*/{.automatic_gain_control = true});
  if (!config.gain_controller1.enabled && !config.gain_controller2.enabled) {
    GTEST_SUCCEED() << "AGC is altogether disabled.";
  }
  if (config.gain_controller1.enabled) {
    EXPECT_NE(config.gain_controller1.mode,
              webrtc::AudioProcessing::Config::GainController1::Mode::
                  kAdaptiveAnalog);
    EXPECT_FALSE(config.gain_controller1.analog_gain_controller.enabled);
  }
  if (config.gain_controller2.enabled) {
    EXPECT_FALSE(config.gain_controller2.input_volume_controller.enabled);
  }
}
#endif

TEST(CreateWebRtcAudioProcessingModuleTest, VerifyNoiseSuppressionSettings) {}

TEST(CreateWebRtcAudioProcessingModuleTest, VerifyEchoCancellerSettings) {}

TEST(CreateWebRtcAudioProcessingModuleTest, ToggleHighPassFilter) {}

}  // namespace
}  // namespace media