audio_processing_unittest.cc (1399B)
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/audio_processing.h" 12 13 #include <memory> 14 15 #include "api/environment/environment_factory.h" 16 #include "api/make_ref_counted.h" 17 #include "api/scoped_refptr.h" 18 #include "modules/audio_processing/include/mock_audio_processing.h" 19 #include "test/gmock.h" 20 #include "test/gtest.h" 21 22 namespace webrtc { 23 24 using ::testing::_; 25 using ::testing::NotNull; 26 27 TEST(CustomAudioProcessingTest, ReturnsPassedAudioProcessing) { 28 scoped_refptr<AudioProcessing> ap = 29 make_ref_counted<test::MockAudioProcessing>(); 30 31 std::unique_ptr<AudioProcessingBuilderInterface> builder = 32 CustomAudioProcessing(ap); 33 34 ASSERT_THAT(builder, NotNull()); 35 EXPECT_EQ(builder->Build(CreateEnvironment()), ap); 36 } 37 38 #if GTEST_HAS_DEATH_TEST 39 TEST(CustomAudioProcessingTest, NullptrAudioProcessingIsUnsupported) { 40 #pragma clang diagnostic push 41 #pragma clang diagnostic ignored "-Wnonnull" 42 EXPECT_DEATH(CustomAudioProcessing(nullptr), _); 43 #pragma clang diagnostic pop 44 } 45 #endif 46 47 } // namespace webrtc