blob: 84e1c845cab939408604005e6c3e15caedc98be0 [file] [log] [blame]
peah8d2ade62016-03-22 11:05:12 -07001/*
Sam Zackrisson8c147b62018-09-28 12:40:47 +02002 * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
peah8d2ade62016-03-22 11:05:12 -07003 *
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 */
Sam Zackrisson8c147b62018-09-28 12:40:47 +020010
11#include <array>
peah8d2ade62016-03-22 11:05:12 -070012#include <vector>
13
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020014#include "modules/audio_processing/echo_control_mobile_impl.h"
Sam Zackrisson8c147b62018-09-28 12:40:47 +020015#include "modules/audio_processing/include/audio_processing.h"
Steve Anton10542f22019-01-11 09:11:00 -080016#include "rtc_base/critical_section.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "test/gtest.h"
peah8d2ade62016-03-22 11:05:12 -070018
19namespace webrtc {
Sam Zackrisson8c147b62018-09-28 12:40:47 +020020TEST(EchoControlMobileTest, InterfaceConfiguration) {
Sam Zackrissonc22f5512018-11-05 16:10:00 +010021 EchoControlMobileImpl aecm;
Sam Zackrisson8c147b62018-09-28 12:40:47 +020022 aecm.Initialize(AudioProcessing::kSampleRate16kHz, 2, 2);
peah8d2ade62016-03-22 11:05:12 -070023
Sam Zackrisson8c147b62018-09-28 12:40:47 +020024 // Toggle routing modes
25 std::array<EchoControlMobileImpl::RoutingMode, 5> routing_modes = {
26 EchoControlMobileImpl::kQuietEarpieceOrHeadset,
27 EchoControlMobileImpl::kEarpiece,
28 EchoControlMobileImpl::kLoudEarpiece,
29 EchoControlMobileImpl::kSpeakerphone,
30 EchoControlMobileImpl::kLoudSpeakerphone,
31 };
32 for (auto mode : routing_modes) {
33 EXPECT_EQ(0, aecm.set_routing_mode(mode));
34 EXPECT_EQ(mode, aecm.routing_mode());
peah8d2ade62016-03-22 11:05:12 -070035 }
36
Sam Zackrisson8c147b62018-09-28 12:40:47 +020037 // Turn comfort noise off/on
38 EXPECT_EQ(0, aecm.enable_comfort_noise(false));
39 EXPECT_FALSE(aecm.is_comfort_noise_enabled());
40 EXPECT_EQ(0, aecm.enable_comfort_noise(true));
41 EXPECT_TRUE(aecm.is_comfort_noise_enabled());
peah8d2ade62016-03-22 11:05:12 -070042}
43
44} // namespace webrtc