Rewrote NetEQ test, made standard suite run googletestified tests too.
The standard suite will now also run the googletestified tests. Removed NetEQ tests from the standard test. Initial version of new neteq test. Moved fixtures to own folder. BUG= TEST= Review URL: http://webrtc-codereview.appspot.com/328010 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1242 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
5efcad1758
commit
fda17c2b00
82
src/voice_engine/main/test/auto_test/standard/neteq_test.cc
Normal file
82
src/voice_engine/main/test/auto_test/standard/neteq_test.cc
Normal file
@ -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);
|
||||||
|
}
|
@ -971,75 +971,6 @@ int VoETestManager::TestStartPlaying() {
|
|||||||
return 0;
|
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() {
|
int VoETestManager::TestCodecs() {
|
||||||
|
|
||||||
#ifdef _TEST_CODEC_
|
#ifdef _TEST_CODEC_
|
||||||
@ -1347,7 +1278,6 @@ int VoETestManager::DoStandardTest() {
|
|||||||
if (TestStartStreaming(channel0_transport) != 0) return -1;
|
if (TestStartStreaming(channel0_transport) != 0) return -1;
|
||||||
|
|
||||||
if (TestStartPlaying() != 0) return -1;
|
if (TestStartPlaying() != 0) return -1;
|
||||||
if (TestNetEq() != 0) return -1;
|
|
||||||
if (TestCodecs() != 0) return -1;
|
if (TestCodecs() != 0) return -1;
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
@ -3660,7 +3590,7 @@ unsigned int WINAPI mainTest::StartSend()
|
|||||||
|
|
||||||
} // namespace voetest
|
} // namespace voetest
|
||||||
|
|
||||||
int RunInManualMode() {
|
int RunInManualMode(int argc, char** argv) {
|
||||||
using namespace voetest;
|
using namespace voetest;
|
||||||
|
|
||||||
SubAPIManager apiMgr;
|
SubAPIManager apiMgr;
|
||||||
@ -3709,6 +3639,15 @@ int RunInManualMode() {
|
|||||||
return 0;
|
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.
|
// Function that can be called from other entry functions.
|
||||||
return runAutoTest(testType, extendedSel);
|
return runAutoTest(testType, extendedSel);
|
||||||
}
|
}
|
||||||
@ -3725,6 +3664,6 @@ int main(int argc, char** argv) {
|
|||||||
return RunInAutomatedMode(argc, argv);
|
return RunInAutomatedMode(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
return RunInManualMode();
|
return RunInManualMode(argc, argv);
|
||||||
}
|
}
|
||||||
#endif //#if !defined(MAC_IPHONE)
|
#endif //#if !defined(MAC_IPHONE)
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
],
|
],
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
'auto_test',
|
'auto_test',
|
||||||
|
'auto_test/fixtures',
|
||||||
'<(webrtc_root)/modules/interface',
|
'<(webrtc_root)/modules/interface',
|
||||||
# TODO(phoglund): We only depend on voice_engine_defines.h here -
|
# TODO(phoglund): We only depend on voice_engine_defines.h here -
|
||||||
# move that file to interface and then remove this dependency.
|
# move that file to interface and then remove this dependency.
|
||||||
@ -29,13 +30,17 @@
|
|||||||
],
|
],
|
||||||
'sources': [
|
'sources': [
|
||||||
'auto_test/automated_mode.cc',
|
'auto_test/automated_mode.cc',
|
||||||
'auto_test/standard/after_initialization_fixture.cc',
|
'auto_test/fixtures/after_initialization_fixture.cc',
|
||||||
'auto_test/standard/after_streaming_fixture.cc',
|
'auto_test/fixtures/after_initialization_fixture.h',
|
||||||
'auto_test/standard/before_initialization_fixture.cc',
|
'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/codec_before_streaming_test.cc',
|
||||||
'auto_test/standard/hardware_before_initializing_test.cc',
|
'auto_test/standard/hardware_before_initializing_test.cc',
|
||||||
'auto_test/standard/hardware_before_streaming_test.cc',
|
'auto_test/standard/hardware_before_streaming_test.cc',
|
||||||
'auto_test/standard/manual_hold_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/network_before_streaming_test.cc',
|
||||||
'auto_test/standard/rtp_rtcp_before_streaming_test.cc',
|
'auto_test/standard/rtp_rtcp_before_streaming_test.cc',
|
||||||
'auto_test/standard/voe_base_misc_test.cc',
|
'auto_test/standard/voe_base_misc_test.cc',
|
||||||
|
Loading…
Reference in New Issue
Block a user