diff --git a/src/voice_engine/main/test/auto_test/standard/after_initialization_fixture.cc b/src/voice_engine/main/test/auto_test/fixtures/after_initialization_fixture.cc similarity index 100% rename from src/voice_engine/main/test/auto_test/standard/after_initialization_fixture.cc rename to src/voice_engine/main/test/auto_test/fixtures/after_initialization_fixture.cc diff --git a/src/voice_engine/main/test/auto_test/standard/after_initialization_fixture.h b/src/voice_engine/main/test/auto_test/fixtures/after_initialization_fixture.h similarity index 100% rename from src/voice_engine/main/test/auto_test/standard/after_initialization_fixture.h rename to src/voice_engine/main/test/auto_test/fixtures/after_initialization_fixture.h diff --git a/src/voice_engine/main/test/auto_test/standard/after_streaming_fixture.cc b/src/voice_engine/main/test/auto_test/fixtures/after_streaming_fixture.cc similarity index 100% rename from src/voice_engine/main/test/auto_test/standard/after_streaming_fixture.cc rename to src/voice_engine/main/test/auto_test/fixtures/after_streaming_fixture.cc diff --git a/src/voice_engine/main/test/auto_test/standard/after_streaming_fixture.h b/src/voice_engine/main/test/auto_test/fixtures/after_streaming_fixture.h similarity index 100% rename from src/voice_engine/main/test/auto_test/standard/after_streaming_fixture.h rename to src/voice_engine/main/test/auto_test/fixtures/after_streaming_fixture.h diff --git a/src/voice_engine/main/test/auto_test/standard/before_initialization_fixture.cc b/src/voice_engine/main/test/auto_test/fixtures/before_initialization_fixture.cc similarity index 100% rename from src/voice_engine/main/test/auto_test/standard/before_initialization_fixture.cc rename to src/voice_engine/main/test/auto_test/fixtures/before_initialization_fixture.cc diff --git a/src/voice_engine/main/test/auto_test/standard/before_initialization_fixture.h b/src/voice_engine/main/test/auto_test/fixtures/before_initialization_fixture.h similarity index 100% rename from src/voice_engine/main/test/auto_test/standard/before_initialization_fixture.h rename to src/voice_engine/main/test/auto_test/fixtures/before_initialization_fixture.h diff --git a/src/voice_engine/main/test/auto_test/standard/neteq_test.cc b/src/voice_engine/main/test/auto_test/standard/neteq_test.cc new file mode 100644 index 000000000..8184535d6 --- /dev/null +++ b/src/voice_engine/main/test/auto_test/standard/neteq_test.cc @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#include "after_streaming_fixture.h" + +class NetEQTest : public AfterStreamingFixture { + protected: + void SetUp() { + additional_channel_ = voe_base_->CreateChannel(); + } + + void TearDown() { + voe_base_->DeleteChannel(additional_channel_); + } + + int additional_channel_; +}; + +TEST_F(NetEQTest, GetNetEQPlayoutModeReturnsDefaultModeByDefault) { + webrtc::NetEqModes mode; + EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(channel_, mode)); + EXPECT_EQ(webrtc::kNetEqDefault, mode); +} + +TEST_F(NetEQTest, SetNetEQPlayoutModeActuallySetsTheModeForTheChannel) { + webrtc::NetEqModes mode; + // Set for the first channel but leave the second. + EXPECT_EQ(0, voe_base_->SetNetEQPlayoutMode(channel_, webrtc::kNetEqFax)); + EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(channel_, mode)); + EXPECT_EQ(webrtc::kNetEqFax, mode); + + EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(additional_channel_, mode)); + EXPECT_EQ(webrtc::kNetEqDefault, mode); + + // Set the second channel, leave the first. + EXPECT_EQ(0, voe_base_->SetNetEQPlayoutMode( + additional_channel_, webrtc::kNetEqStreaming)); + EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(additional_channel_, mode)); + EXPECT_EQ(webrtc::kNetEqStreaming, mode); + + EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(channel_, mode)); + EXPECT_EQ(webrtc::kNetEqFax, mode); +} + +TEST_F(NetEQTest, GetNetEQBgnModeReturnsBgnOnByDefault) { + webrtc::NetEqBgnModes bgn_mode; + EXPECT_EQ(0, voe_base_->GetNetEQBGNMode(channel_, bgn_mode)); + EXPECT_EQ(webrtc::kBgnOn, bgn_mode); +} + +TEST_F(NetEQTest, SetNetEQBgnModeActuallySetsTheBgnMode) { + webrtc::NetEqBgnModes bgn_mode; + EXPECT_EQ(0, voe_base_->SetNetEQBGNMode(channel_, webrtc::kBgnOff)); + EXPECT_EQ(0, voe_base_->GetNetEQBGNMode(channel_, bgn_mode)); + EXPECT_EQ(webrtc::kBgnOff, bgn_mode); + + EXPECT_EQ(0, voe_base_->SetNetEQBGNMode(channel_, webrtc::kBgnFade)); + EXPECT_EQ(0, voe_base_->GetNetEQBGNMode(channel_, bgn_mode)); + EXPECT_EQ(webrtc::kBgnFade, bgn_mode); +} + +TEST_F(NetEQTest, ManualSetEQPlayoutModeStillProducesOkAudio) { + EXPECT_EQ(0, voe_base_->SetNetEQPlayoutMode(channel_, webrtc::kNetEqDefault)); + TEST_LOG("NetEQ default playout mode enabled => should hear OK audio.\n"); + Sleep(2000); + + EXPECT_EQ(0, voe_base_->SetNetEQPlayoutMode( + channel_, webrtc::kNetEqStreaming)); + TEST_LOG("NetEQ streaming playout mode enabled => should hear OK audio.\n"); + Sleep(2000); + + EXPECT_EQ(0, voe_base_->SetNetEQPlayoutMode(channel_, webrtc::kNetEqFax)); + TEST_LOG("NetEQ fax playout mode enabled => should hear OK audio.\n"); + Sleep(2000); +} diff --git a/src/voice_engine/main/test/auto_test/voe_standard_test.cc b/src/voice_engine/main/test/auto_test/voe_standard_test.cc index 41ed4569f..637973196 100644 --- a/src/voice_engine/main/test/auto_test/voe_standard_test.cc +++ b/src/voice_engine/main/test/auto_test/voe_standard_test.cc @@ -971,75 +971,6 @@ int VoETestManager::TestStartPlaying() { return 0; } -int VoETestManager::TestNetEq() { -#ifdef _TEST_BASE_ - NetEqModes mode; - TEST_MUSTPASS(voe_base_->GetNetEQPlayoutMode(0, mode)); - TEST_MUSTPASS(mode != kNetEqDefault); - TEST_LOG("NetEQ DEFAULT playout mode enabled => should hear OK audio \n"); - TEST_MUSTPASS(voe_base_->SetNetEQPlayoutMode(0, kNetEqDefault)); - SLEEP(3000); - TEST_LOG("NetEQ STREAMING playout mode enabled => should hear OK audio \n"); - TEST_MUSTPASS(voe_base_->SetNetEQPlayoutMode(0, kNetEqStreaming)); - SLEEP(3000); - TEST_LOG("NetEQ FAX playout mode enabled => should hear OK audio \n"); - TEST_MUSTPASS(voe_base_->SetNetEQPlayoutMode(0, kNetEqFax)); - SLEEP(3000); - TEST_LOG("NetEQ default mode is restored \n"); - TEST_MUSTPASS(voe_base_->SetNetEQPlayoutMode(0, kNetEqDefault)); - TEST_MUSTPASS(voe_base_->GetNetEQPlayoutMode(0, mode)); - TEST_MUSTPASS(mode != kNetEqDefault); - TEST_MUSTPASS(voe_base_->GetNetEQPlayoutMode(0, mode)); - TEST_MUSTPASS(mode != kNetEqDefault); - TEST_LOG("NetEQ DEFAULT playout mode enabled => should hear OK audio \n"); - TEST_MUSTPASS(voe_base_->SetNetEQPlayoutMode(0, kNetEqDefault)); - SLEEP(3000); - TEST_LOG("NetEQ STREAMING playout mode enabled => should hear OK audio \n"); - TEST_MUSTPASS(voe_base_->SetNetEQPlayoutMode(0, kNetEqStreaming)); - SLEEP(3000); - TEST_LOG("NetEQ FAX playout mode enabled => should hear OK audio \n"); - TEST_MUSTPASS(voe_base_->SetNetEQPlayoutMode(0, kNetEqFax)); - SLEEP(3000); - TEST_LOG("NetEQ default mode is restored \n"); - TEST_MUSTPASS(voe_base_->SetNetEQPlayoutMode(0, kNetEqDefault)); - TEST_MUSTPASS(voe_base_->GetNetEQPlayoutMode(0, mode)); - TEST_MUSTPASS(mode != kNetEqDefault); - TEST_MUSTPASS(voe_base_->GetNetEQPlayoutMode(0, mode)); - TEST_MUSTPASS(mode != kNetEqDefault); - TEST_LOG("NetEQ DEFAULT playout mode enabled => should hear OK audio \n"); - TEST_MUSTPASS(voe_base_->SetNetEQPlayoutMode(0, kNetEqDefault)); - SLEEP(3000); - TEST_LOG("NetEQ STREAMING playout mode enabled => should hear OK audio \n"); - TEST_MUSTPASS(voe_base_->SetNetEQPlayoutMode(0, kNetEqStreaming)); - SLEEP(3000); - TEST_LOG("NetEQ FAX playout mode enabled => should hear OK audio \n"); - TEST_MUSTPASS(voe_base_->SetNetEQPlayoutMode(0, kNetEqFax)); - SLEEP(3000); - TEST_LOG("NetEQ default mode is restored \n"); - TEST_MUSTPASS(voe_base_->SetNetEQPlayoutMode(0, kNetEqDefault)); - TEST_MUSTPASS(voe_base_->GetNetEQPlayoutMode(0, mode)); - TEST_MUSTPASS(mode != kNetEqDefault); - - TEST_LOG("Scan all possible NetEQ BGN modes\n"); // skip listening test - enum NetEqBgnModes neteq_bgn_mode; - TEST_MUSTPASS(voe_base_->GetNetEQBGNMode(0, neteq_bgn_mode)); - TEST_MUSTPASS(neteq_bgn_mode != kBgnOn); - TEST_MUSTPASS(voe_base_->SetNetEQBGNMode(0, kBgnOn)); - TEST_MUSTPASS(voe_base_->GetNetEQBGNMode(0, neteq_bgn_mode)); - TEST_MUSTPASS(neteq_bgn_mode != kBgnOn); - TEST_MUSTPASS(voe_base_->SetNetEQBGNMode(0, kBgnFade)); - TEST_MUSTPASS(voe_base_->GetNetEQBGNMode(0, neteq_bgn_mode)); - TEST_MUSTPASS(neteq_bgn_mode != kBgnFade); - TEST_MUSTPASS(voe_base_->SetNetEQBGNMode(0, kBgnOff)); - TEST_MUSTPASS(voe_base_->GetNetEQBGNMode(0, neteq_bgn_mode)); - TEST_MUSTPASS(neteq_bgn_mode != kBgnOff); -#else - TEST_LOG("Skipping on hold and NetEQ playout tests -" - "Base tests are not enabled \n"); -#endif // #ifdef _TEST_BASE_ - return 0; -} - int VoETestManager::TestCodecs() { #ifdef _TEST_CODEC_ @@ -1347,7 +1278,6 @@ int VoETestManager::DoStandardTest() { if (TestStartStreaming(channel0_transport) != 0) return -1; if (TestStartPlaying() != 0) return -1; - if (TestNetEq() != 0) return -1; if (TestCodecs() != 0) return -1; ///////////////////////// @@ -3660,7 +3590,7 @@ unsigned int WINAPI mainTest::StartSend() } // namespace voetest -int RunInManualMode() { +int RunInManualMode(int argc, char** argv) { using namespace voetest; SubAPIManager apiMgr; @@ -3709,6 +3639,15 @@ int RunInManualMode() { return 0; } + if (testType == Standard) { + TEST_LOG("\n\n+++ Running gtest-rewritten standard tests first +++\n\n"); + + // Run the automated tests too in standard mode since we are gradually + // rewriting the standard test to be automated. Running this will give + // the standard suite the same completeness. + RunInAutomatedMode(argc, argv); + } + // Function that can be called from other entry functions. return runAutoTest(testType, extendedSel); } @@ -3725,6 +3664,6 @@ int main(int argc, char** argv) { return RunInAutomatedMode(argc, argv); } - return RunInManualMode(); + return RunInManualMode(argc, argv); } #endif //#if !defined(MAC_IPHONE) diff --git a/src/voice_engine/main/test/voice_engine_tests.gypi b/src/voice_engine/main/test/voice_engine_tests.gypi index 15c72296f..1ce7e1a48 100644 --- a/src/voice_engine/main/test/voice_engine_tests.gypi +++ b/src/voice_engine/main/test/voice_engine_tests.gypi @@ -21,6 +21,7 @@ ], 'include_dirs': [ 'auto_test', + 'auto_test/fixtures', '<(webrtc_root)/modules/interface', # TODO(phoglund): We only depend on voice_engine_defines.h here - # move that file to interface and then remove this dependency. @@ -29,13 +30,17 @@ ], 'sources': [ 'auto_test/automated_mode.cc', - 'auto_test/standard/after_initialization_fixture.cc', - 'auto_test/standard/after_streaming_fixture.cc', - 'auto_test/standard/before_initialization_fixture.cc', + 'auto_test/fixtures/after_initialization_fixture.cc', + 'auto_test/fixtures/after_initialization_fixture.h', + 'auto_test/fixtures/after_streaming_fixture.cc', + 'auto_test/fixtures/after_streaming_fixture.h', + 'auto_test/fixtures/before_initialization_fixture.cc', + 'auto_test/fixtures/before_initialization_fixture.h', 'auto_test/standard/codec_before_streaming_test.cc', 'auto_test/standard/hardware_before_initializing_test.cc', 'auto_test/standard/hardware_before_streaming_test.cc', 'auto_test/standard/manual_hold_test.cc', + 'auto_test/standard/neteq_test.cc', 'auto_test/standard/network_before_streaming_test.cc', 'auto_test/standard/rtp_rtcp_before_streaming_test.cc', 'auto_test/standard/voe_base_misc_test.cc',