tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

builtin_audio_processing_builder_unittest.cc (1661B)


      1 /*
      2 *  Copyright (c) 2024 The WebRTC project authors. All Rights Reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 
     11 #include "api/audio/builtin_audio_processing_builder.h"
     12 
     13 #include "api/audio/audio_processing.h"
     14 #include "api/environment/environment.h"
     15 #include "api/environment/environment_factory.h"
     16 #include "api/scoped_refptr.h"
     17 #include "test/gmock.h"
     18 #include "test/gtest.h"
     19 
     20 namespace webrtc {
     21 
     22 using ::testing::NotNull;
     23 
     24 TEST(BuiltinAudioProcessingBuilderTest, CreatesWithDefaults) {
     25  EXPECT_THAT(BuiltinAudioProcessingBuilder().Build(CreateEnvironment()),
     26              NotNull());
     27 }
     28 
     29 TEST(BuiltinAudioProcessingBuilderTest, CreatesWithConfig) {
     30  const Environment env = CreateEnvironment();
     31  AudioProcessing::Config config;
     32  // Change a field to make config different to default one.
     33  config.gain_controller1.enabled = !config.gain_controller1.enabled;
     34 
     35  scoped_refptr<AudioProcessing> ap1 =
     36      BuiltinAudioProcessingBuilder(config).Build(env);
     37  ASSERT_THAT(ap1, NotNull());
     38  EXPECT_EQ(ap1->GetConfig().gain_controller1.enabled,
     39            config.gain_controller1.enabled);
     40 
     41  scoped_refptr<AudioProcessing> ap2 =
     42      BuiltinAudioProcessingBuilder().SetConfig(config).Build(env);
     43  ASSERT_THAT(ap2, NotNull());
     44  EXPECT_EQ(ap2->GetConfig().gain_controller1.enabled,
     45            config.gain_controller1.enabled);
     46 }
     47 
     48 }  // namespace webrtc