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