bjornv@webrtc.org | 132c15d | 2013-02-27 21:03:41 +0000 | [diff] [blame] | 1 | /* |
| 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 Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 13 | #include "modules/audio_processing/aec/echo_cancellation.h" |
bjornv@webrtc.org | 132c15d | 2013-02-27 21:03:41 +0000 | [diff] [blame] | 14 | |
pbos@webrtc.org | 12dc1a3 | 2013-08-05 16:22:53 +0000 | [diff] [blame] | 15 | #include <stdlib.h> |
| 16 | #include <time.h> |
bjornv@webrtc.org | 132c15d | 2013-02-27 21:03:41 +0000 | [diff] [blame] | 17 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 18 | #include "modules/audio_processing/aec/aec_core.h" |
| 19 | #include "rtc_base/checks.h" |
| 20 | #include "test/gtest.h" |
bjornv@webrtc.org | 132c15d | 2013-02-27 21:03:41 +0000 | [diff] [blame] | 21 | |
| 22 | namespace webrtc { |
| 23 | |
Bjorn Volcker | f6a99e6 | 2015-04-10 07:56:57 +0200 | [diff] [blame] | 24 | TEST(EchoCancellationTest, CreateAndFreeHasExpectedBehavior) { |
Bjorn Volcker | 9345e86 | 2015-06-10 21:43:36 +0200 | [diff] [blame] | 25 | void* handle = WebRtcAec_Create(); |
| 26 | ASSERT_TRUE(handle); |
Bjorn Volcker | f6a99e6 | 2015-04-10 07:56:57 +0200 | [diff] [blame] | 27 | WebRtcAec_Free(nullptr); |
| 28 | WebRtcAec_Free(handle); |
bjornv@webrtc.org | 132c15d | 2013-02-27 21:03:41 +0000 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | TEST(EchoCancellationTest, ApplyAecCoreHandle) { |
Bjorn Volcker | 9345e86 | 2015-06-10 21:43:36 +0200 | [diff] [blame] | 32 | void* handle = WebRtcAec_Create(); |
| 33 | ASSERT_TRUE(handle); |
bjornv@webrtc.org | 132c15d | 2013-02-27 21:03:41 +0000 | [diff] [blame] | 34 | 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 Volcker | f6a99e6 | 2015-04-10 07:56:57 +0200 | [diff] [blame] | 42 | WebRtcAec_Free(handle); |
bjornv@webrtc.org | 132c15d | 2013-02-27 21:03:41 +0000 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | } // namespace webrtc |