| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 #include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h" | 11 #include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h" |
| 12 | 12 |
| 13 class AgcConfigTest : public AfterStreamingFixture { | 13 class AgcConfigTest : public AfterStreamingFixture { |
| 14 protected: | 14 protected: |
| 15 void SetUp() { | 15 void SetUp() { |
| 16 // These should be defaults for the AGC config. | 16 // These should be defaults for the AGC config. |
| 17 default_agc_config_.digitalCompressionGaindB = 9; | 17 default_agc_config_.digitalCompressionGaindB = 9; |
| 18 default_agc_config_.limiterEnable = true; | 18 default_agc_config_.limiterEnable = true; |
| 19 default_agc_config_.targetLeveldBOv = 3; | 19 default_agc_config_.targetLeveldBOv = 3; |
| 20 } | 20 } |
| 21 | 21 |
| 22 webrtc::AgcConfig default_agc_config_; | 22 webrtc::AgcConfig default_agc_config_; |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 // Duplicated in apm_helpers_unittest.cc. |
| 25 TEST_F(AgcConfigTest, HasCorrectDefaultConfiguration) { | 26 TEST_F(AgcConfigTest, HasCorrectDefaultConfiguration) { |
| 26 webrtc::AgcConfig agc_config; | 27 webrtc::AgcConfig agc_config; |
| 27 | 28 |
| 28 EXPECT_EQ(0, voe_apm_->GetAgcConfig(agc_config)); | 29 EXPECT_EQ(0, voe_apm_->GetAgcConfig(agc_config)); |
| 29 | 30 |
| 30 EXPECT_EQ(default_agc_config_.targetLeveldBOv, agc_config.targetLeveldBOv); | 31 EXPECT_EQ(default_agc_config_.targetLeveldBOv, agc_config.targetLeveldBOv); |
| 31 EXPECT_EQ(default_agc_config_.digitalCompressionGaindB, | 32 EXPECT_EQ(default_agc_config_.digitalCompressionGaindB, |
| 32 agc_config.digitalCompressionGaindB); | 33 agc_config.digitalCompressionGaindB); |
| 33 EXPECT_EQ(default_agc_config_.limiterEnable, agc_config.limiterEnable); | 34 EXPECT_EQ(default_agc_config_.limiterEnable, agc_config.limiterEnable); |
| 34 } | 35 } |
| 35 | 36 |
| 37 // Not needed anymore - we're not returning errors anymore, just logging. |
| 36 TEST_F(AgcConfigTest, DealsWithInvalidParameters) { | 38 TEST_F(AgcConfigTest, DealsWithInvalidParameters) { |
| 37 webrtc::AgcConfig agc_config = default_agc_config_; | 39 webrtc::AgcConfig agc_config = default_agc_config_; |
| 38 agc_config.digitalCompressionGaindB = 91; | 40 agc_config.digitalCompressionGaindB = 91; |
| 39 EXPECT_EQ(-1, voe_apm_->SetAgcConfig(agc_config)) << "Should not be able " | 41 EXPECT_EQ(-1, voe_apm_->SetAgcConfig(agc_config)) << "Should not be able " |
| 40 "to set gain to more than 90 dB."; | 42 "to set gain to more than 90 dB."; |
| 41 EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError()); | 43 EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError()); |
| 42 | 44 |
| 43 agc_config = default_agc_config_; | 45 agc_config = default_agc_config_; |
| 44 agc_config.targetLeveldBOv = 32; | 46 agc_config.targetLeveldBOv = 32; |
| 45 EXPECT_EQ(-1, voe_apm_->SetAgcConfig(agc_config)) << "Should not be able " | 47 EXPECT_EQ(-1, voe_apm_->SetAgcConfig(agc_config)) << "Should not be able " |
| 46 "to set target level to more than 31."; | 48 "to set target level to more than 31."; |
| 47 EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError()); | 49 EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError()); |
| 48 } | 50 } |
| 49 | 51 |
| 52 // Duplicated in apm_helpers_unittest.cc. |
| 50 TEST_F(AgcConfigTest, CanGetAndSetAgcStatus) { | 53 TEST_F(AgcConfigTest, CanGetAndSetAgcStatus) { |
| 51 webrtc::AgcConfig agc_config; | 54 webrtc::AgcConfig agc_config; |
| 52 agc_config.digitalCompressionGaindB = 17; | 55 agc_config.digitalCompressionGaindB = 17; |
| 53 agc_config.targetLeveldBOv = 11; | 56 agc_config.targetLeveldBOv = 11; |
| 54 agc_config.limiterEnable = false; | 57 agc_config.limiterEnable = false; |
| 55 | 58 |
| 56 webrtc::AgcConfig actual_config; | 59 webrtc::AgcConfig actual_config; |
| 57 EXPECT_EQ(0, voe_apm_->SetAgcConfig(agc_config)); | 60 EXPECT_EQ(0, voe_apm_->SetAgcConfig(agc_config)); |
| 58 EXPECT_EQ(0, voe_apm_->GetAgcConfig(actual_config)); | 61 EXPECT_EQ(0, voe_apm_->GetAgcConfig(actual_config)); |
| 59 | 62 |
| 60 EXPECT_EQ(agc_config.digitalCompressionGaindB, | 63 EXPECT_EQ(agc_config.digitalCompressionGaindB, |
| 61 actual_config.digitalCompressionGaindB); | 64 actual_config.digitalCompressionGaindB); |
| 62 EXPECT_EQ(agc_config.limiterEnable, | 65 EXPECT_EQ(agc_config.limiterEnable, |
| 63 actual_config.limiterEnable); | 66 actual_config.limiterEnable); |
| 64 EXPECT_EQ(agc_config.targetLeveldBOv, | 67 EXPECT_EQ(agc_config.targetLeveldBOv, |
| 65 actual_config.targetLeveldBOv); | 68 actual_config.targetLeveldBOv); |
| 66 } | 69 } |
| OLD | NEW |