blob: b9c89fd9e9c37adc69e4a7f34012d5524b27a657 [file] [log] [blame]
bjornv@webrtc.org132c15d2013-02-27 21:03:41 +00001/*
2 * Copyright (c) 2013 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// TODO(bjornv): Make this a comprehensive test.
12
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020013#include "modules/audio_processing/aec/echo_cancellation.h"
bjornv@webrtc.org132c15d2013-02-27 21:03:41 +000014
pbos@webrtc.org12dc1a32013-08-05 16:22:53 +000015#include <stdlib.h>
16#include <time.h>
bjornv@webrtc.org132c15d2013-02-27 21:03:41 +000017
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020018#include "modules/audio_processing/aec/aec_core.h"
19#include "rtc_base/checks.h"
20#include "test/gtest.h"
bjornv@webrtc.org132c15d2013-02-27 21:03:41 +000021
22namespace webrtc {
23
Bjorn Volckerf6a99e62015-04-10 07:56:57 +020024TEST(EchoCancellationTest, CreateAndFreeHasExpectedBehavior) {
Bjorn Volcker9345e862015-06-10 21:43:36 +020025 void* handle = WebRtcAec_Create();
26 ASSERT_TRUE(handle);
Bjorn Volckerf6a99e62015-04-10 07:56:57 +020027 WebRtcAec_Free(nullptr);
28 WebRtcAec_Free(handle);
bjornv@webrtc.org132c15d2013-02-27 21:03:41 +000029}
30
31TEST(EchoCancellationTest, ApplyAecCoreHandle) {
Bjorn Volcker9345e862015-06-10 21:43:36 +020032 void* handle = WebRtcAec_Create();
33 ASSERT_TRUE(handle);
bjornv@webrtc.org132c15d2013-02-27 21:03:41 +000034 EXPECT_TRUE(WebRtcAec_aec_core(NULL) == NULL);
35 AecCore* aec_core = WebRtcAec_aec_core(handle);
36 EXPECT_TRUE(aec_core != NULL);
37 // A simple test to verify that we can set and get a value from the lower
38 // level |aec_core| handle.
39 int delay = 111;
40 WebRtcAec_SetSystemDelay(aec_core, delay);
41 EXPECT_EQ(delay, WebRtcAec_system_delay(aec_core));
Bjorn Volckerf6a99e62015-04-10 07:56:57 +020042 WebRtcAec_Free(handle);
bjornv@webrtc.org132c15d2013-02-27 21:03:41 +000043}
44
45} // namespace webrtc