echo_control_mobile_unittest.cc (1438B)
1 /* 2 * Copyright (c) 2018 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 <array> 12 13 #include "api/audio/audio_processing.h" 14 #include "modules/audio_processing/echo_control_mobile_impl.h" 15 #include "test/gtest.h" 16 17 namespace webrtc { 18 TEST(EchoControlMobileTest, InterfaceConfiguration) { 19 EchoControlMobileImpl aecm; 20 aecm.Initialize(AudioProcessing::kSampleRate16kHz, 2, 2); 21 22 // Toggle routing modes 23 std::array<EchoControlMobileImpl::RoutingMode, 5> routing_modes = { 24 EchoControlMobileImpl::kQuietEarpieceOrHeadset, 25 EchoControlMobileImpl::kEarpiece, 26 EchoControlMobileImpl::kLoudEarpiece, 27 EchoControlMobileImpl::kSpeakerphone, 28 EchoControlMobileImpl::kLoudSpeakerphone, 29 }; 30 for (auto mode : routing_modes) { 31 EXPECT_EQ(0, aecm.set_routing_mode(mode)); 32 EXPECT_EQ(mode, aecm.routing_mode()); 33 } 34 35 // Turn comfort noise off/on 36 EXPECT_EQ(0, aecm.enable_comfort_noise(false)); 37 EXPECT_FALSE(aecm.is_comfort_noise_enabled()); 38 EXPECT_EQ(0, aecm.enable_comfort_noise(true)); 39 EXPECT_TRUE(aecm.is_comfort_noise_enabled()); 40 } 41 42 } // namespace webrtc