1 /*
2 * Copyright (c) 2017 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 "modules/audio_processing/aec3/echo_path_variability.h"
12
13 #include "test/gtest.h"
14
15 namespace webrtc {
16
TEST(EchoPathVariability,CorrectBehavior)17 TEST(EchoPathVariability, CorrectBehavior) {
18 // Test correct passing and reporting of the gain change information.
19 EchoPathVariability v(
20 true, EchoPathVariability::DelayAdjustment::kNewDetectedDelay, false);
21 EXPECT_TRUE(v.gain_change);
22 EXPECT_TRUE(v.delay_change ==
23 EchoPathVariability::DelayAdjustment::kNewDetectedDelay);
24 EXPECT_TRUE(v.AudioPathChanged());
25 EXPECT_FALSE(v.clock_drift);
26
27 v = EchoPathVariability(true, EchoPathVariability::DelayAdjustment::kNone,
28 false);
29 EXPECT_TRUE(v.gain_change);
30 EXPECT_TRUE(v.delay_change == EchoPathVariability::DelayAdjustment::kNone);
31 EXPECT_TRUE(v.AudioPathChanged());
32 EXPECT_FALSE(v.clock_drift);
33
34 v = EchoPathVariability(
35 false, EchoPathVariability::DelayAdjustment::kNewDetectedDelay, false);
36 EXPECT_FALSE(v.gain_change);
37 EXPECT_TRUE(v.delay_change ==
38 EchoPathVariability::DelayAdjustment::kNewDetectedDelay);
39 EXPECT_TRUE(v.AudioPathChanged());
40 EXPECT_FALSE(v.clock_drift);
41
42 v = EchoPathVariability(false, EchoPathVariability::DelayAdjustment::kNone,
43 false);
44 EXPECT_FALSE(v.gain_change);
45 EXPECT_TRUE(v.delay_change == EchoPathVariability::DelayAdjustment::kNone);
46 EXPECT_FALSE(v.AudioPathChanged());
47 EXPECT_FALSE(v.clock_drift);
48 }
49
50 } // namespace webrtc
51