OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 // TODO(bjornv): Make this a comprehensive test. | 11 // TODO(bjornv): Make this a comprehensive test. |
12 | 12 |
13 #include "webrtc/modules/audio_processing/aec/include/echo_cancellation.h" | 13 #include "webrtc/modules/audio_processing/aec/include/echo_cancellation.h" |
14 | 14 |
15 #include <stdlib.h> | 15 #include <stdlib.h> |
16 #include <time.h> | 16 #include <time.h> |
17 | 17 |
18 extern "C" { | 18 extern "C" { |
19 #include "webrtc/modules/audio_processing/aec/aec_core.h" | 19 #include "webrtc/modules/audio_processing/aec/aec_core.h" |
20 } | 20 } |
21 | 21 |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 #include "webrtc/base/checks.h" |
23 | 24 |
24 namespace webrtc { | 25 namespace webrtc { |
25 | 26 |
26 TEST(EchoCancellationTest, CreateAndFreeHasExpectedBehavior) { | 27 TEST(EchoCancellationTest, CreateAndFreeHasExpectedBehavior) { |
27 EXPECT_EQ(-1, WebRtcAec_Create(NULL)); | 28 void* handle = WebRtcAec_Create(); |
28 void* handle = NULL; | 29 ASSERT_TRUE(handle); |
29 ASSERT_EQ(0, WebRtcAec_Create(&handle)); | |
30 EXPECT_TRUE(handle != NULL); | |
31 WebRtcAec_Free(nullptr); | 30 WebRtcAec_Free(nullptr); |
32 WebRtcAec_Free(handle); | 31 WebRtcAec_Free(handle); |
33 } | 32 } |
34 | 33 |
35 TEST(EchoCancellationTest, ApplyAecCoreHandle) { | 34 TEST(EchoCancellationTest, ApplyAecCoreHandle) { |
36 void* handle = NULL; | 35 void* handle = WebRtcAec_Create(); |
37 ASSERT_EQ(0, WebRtcAec_Create(&handle)); | 36 ASSERT_TRUE(handle); |
38 EXPECT_TRUE(handle != NULL); | |
39 EXPECT_TRUE(WebRtcAec_aec_core(NULL) == NULL); | 37 EXPECT_TRUE(WebRtcAec_aec_core(NULL) == NULL); |
40 AecCore* aec_core = WebRtcAec_aec_core(handle); | 38 AecCore* aec_core = WebRtcAec_aec_core(handle); |
41 EXPECT_TRUE(aec_core != NULL); | 39 EXPECT_TRUE(aec_core != NULL); |
42 // A simple test to verify that we can set and get a value from the lower | 40 // A simple test to verify that we can set and get a value from the lower |
43 // level |aec_core| handle. | 41 // level |aec_core| handle. |
44 int delay = 111; | 42 int delay = 111; |
45 WebRtcAec_SetSystemDelay(aec_core, delay); | 43 WebRtcAec_SetSystemDelay(aec_core, delay); |
46 EXPECT_EQ(delay, WebRtcAec_system_delay(aec_core)); | 44 EXPECT_EQ(delay, WebRtcAec_system_delay(aec_core)); |
47 WebRtcAec_Free(handle); | 45 WebRtcAec_Free(handle); |
48 } | 46 } |
49 | 47 |
50 } // namespace webrtc | 48 } // namespace webrtc |
OLD | NEW |