Rewrote the call report test.

BUG=
TEST=

Review URL: https://webrtc-codereview.appspot.com/399006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1726 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
phoglund@webrtc.org 2012-02-20 08:55:04 +00:00
parent 843c8c78ff
commit b45ceed9ef
4 changed files with 92 additions and 67 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 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
@ -56,7 +56,8 @@ public:
virtual int Release() = 0;
// Performs a combined reset of all components involved in generating
// the call report for a specified |channel|.
// the call report for a specified |channel|. Pass in -1 to reset
// all channels.
virtual int ResetCallReportStatistics(int channel) = 0;
// Gets minimum, maximum and average levels for long-term echo metrics.

View File

@ -0,0 +1,88 @@
/*
* Copyright (c) 2012 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"
#include "testsupport/fileutils.h"
class CallReportTest : public AfterStreamingFixture {
};
TEST_F(CallReportTest, ResetCallReportStatisticsFailsForBadInput) {
EXPECT_EQ(-1, voe_call_report_->ResetCallReportStatistics(-2));
EXPECT_EQ(-1, voe_call_report_->ResetCallReportStatistics(1));
}
TEST_F(CallReportTest, ResetCallReportStatisticsSucceedsWithCorrectInput) {
EXPECT_EQ(0, voe_call_report_->ResetCallReportStatistics(channel_));
EXPECT_EQ(0, voe_call_report_->ResetCallReportStatistics(-1));
}
TEST_F(CallReportTest, EchoMetricSummarySucceeds) {
EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
Sleep(1000);
webrtc::EchoStatistics echo_statistics;
EXPECT_EQ(0, voe_call_report_->GetEchoMetricSummary(echo_statistics));
}
TEST_F(CallReportTest, GetRoundTripTimeSummaryReturnsAllMinusOnesIfRtcpIsOff) {
voe_rtp_rtcp_->SetRTCPStatus(channel_, false);
webrtc::StatVal delays;
EXPECT_EQ(0, voe_call_report_->GetRoundTripTimeSummary(channel_, delays));
EXPECT_EQ(-1, delays.average);
EXPECT_EQ(-1, delays.min);
EXPECT_EQ(-1, delays.max);
}
TEST_F(CallReportTest, GetRoundTripTimesReturnsValuesIfRtcpIsOn) {
voe_rtp_rtcp_->SetRTCPStatus(channel_, true);
Sleep(1000);
webrtc::StatVal delays;
EXPECT_EQ(0, voe_call_report_->GetRoundTripTimeSummary(channel_, delays));
EXPECT_NE(-1, delays.average);
EXPECT_NE(-1, delays.min);
EXPECT_NE(-1, delays.max);
}
TEST_F(CallReportTest, DeadOrAliveSummaryFailsIfDeadOrAliveTrackingNotActive) {
int count_the_dead;
int count_the_living;
EXPECT_EQ(-1, voe_call_report_->GetDeadOrAliveSummary(channel_,
count_the_dead,
count_the_living));
}
TEST_F(CallReportTest,
DeadOrAliveSummarySucceedsIfDeadOrAliveTrackingIsActive) {
EXPECT_EQ(0, voe_network_->SetPeriodicDeadOrAliveStatus(channel_, true, 1));
Sleep(1200);
int count_the_dead;
int count_the_living;
EXPECT_EQ(0, voe_call_report_->GetDeadOrAliveSummary(channel_,
count_the_dead,
count_the_living));
EXPECT_GE(count_the_dead, 0);
EXPECT_GE(count_the_living, 0);
}
TEST_F(CallReportTest, WriteReportToFileFailsOnBadInput) {
EXPECT_EQ(-1, voe_call_report_->WriteReportToFile(NULL));
}
TEST_F(CallReportTest, WriteReportToFileSucceedsWithCorrectFilename) {
std::string output_path = webrtc::test::OutputPath();
std::string report_filename = output_path + "call_report.txt";
EXPECT_EQ(0, voe_call_report_->WriteReportToFile(report_filename.c_str()));
}

View File

@ -983,71 +983,6 @@ int VoETestManager::DoStandardTest() {
if (TestStartStreaming(channel0_transport) != 0) return -1;
if (TestStartPlaying() != 0) return -1;
////////////
// Network
///////////////
// CallReport
#ifdef _TEST_CALL_REPORT_
TEST_LOG("\n\n+++ CallReport tests +++\n\n");
#if (defined(WEBRTC_VOICE_ENGINE_ECHO) && defined(WEBRTC_VOICE_ENGINE_NR))
TEST(ResetCallReportStatistics);ANL();
TEST_MUSTPASS(!voe_call_report_->ResetCallReportStatistics(-2));
TEST_MUSTPASS(!voe_call_report_->ResetCallReportStatistics(1));
TEST_MUSTPASS(voe_call_report_->ResetCallReportStatistics(0));
TEST_MUSTPASS(voe_call_report_->ResetCallReportStatistics(-1));
bool onOff;
TEST_MUSTPASS(voe_apm_->GetEcMetricsStatus(onOff));
TEST_MUSTPASS(onOff != false);
TEST_MUSTPASS(voe_apm_->SetEcMetricsStatus(true));
SLEEP(3000);
EchoStatistics echo;
TEST(GetEchoMetricSummary);ANL();
// all outputs will be -100 in loopback (skip further tests)
TEST_MUSTPASS(voe_call_report_->GetEchoMetricSummary(echo));
StatVal delays;
TEST(GetRoundTripTimeSummary);ANL();
voe_rtp_rtcp_->SetRTCPStatus(0, false);
// All values should be -1 since RTCP is off
TEST_MUSTPASS(voe_call_report_->GetRoundTripTimeSummary(0, delays));
TEST_MUSTPASS(delays.min != -1);
TEST_MUSTPASS(delays.max != -1);
TEST_MUSTPASS(delays.average != -1);
voe_rtp_rtcp_->SetRTCPStatus(0, true);
SLEEP(5000); // gives time for RTCP
TEST_MUSTPASS(voe_call_report_->GetRoundTripTimeSummary(0, delays));
TEST_MUSTPASS(delays.min == -1);
TEST_MUSTPASS(delays.max == -1);
TEST_MUSTPASS(delays.average == -1);
voe_rtp_rtcp_->SetRTCPStatus(0, false);
int nDead = 0;
int nAlive = 0;
// -1 will be returned since dead-or-alive is not active
TEST(GetDeadOrAliveSummary);ANL();
TEST_MUSTPASS(voe_call_report_->GetDeadOrAliveSummary(0, nDead,
nAlive) != -1);
// we don't need these callbacks any longer
TEST_MUSTPASS(voe_network_->DeRegisterDeadOrAliveObserver(0));
TEST_MUSTPASS(voe_network_->SetPeriodicDeadOrAliveStatus(0, true, 1));
SLEEP(2000);
// All results should be >= 0 since dead-or-alive is active
TEST_MUSTPASS(voe_call_report_->GetDeadOrAliveSummary(0, nDead, nAlive));
TEST_MUSTPASS(nDead == -1);TEST_MUSTPASS(nAlive == -1)
TEST_MUSTPASS(voe_network_->SetPeriodicDeadOrAliveStatus(0, false));
TEST(WriteReportToFile);ANL();
TEST_MUSTPASS(!voe_call_report_->WriteReportToFile(NULL));
TEST_MUSTPASS(voe_call_report_->WriteReportToFile("call_report.txt"));
#else
TEST_LOG("Skipping CallReport tests since both EC and NS are required\n");
#endif
#else
TEST_LOG("\n\n+++ CallReport tests NOT ENABLED +++\n");
#endif // #ifdef _TEST_CALL_REPORT_
//////////////
// Video Sync

View File

@ -37,6 +37,7 @@
'auto_test/fixtures/before_initialization_fixture.cc',
'auto_test/fixtures/before_initialization_fixture.h',
'auto_test/standard/audio_processing_test.cc',
'auto_test/standard/call_report_test.cc',
'auto_test/standard/codec_before_streaming_test.cc',
'auto_test/standard/codec_test.cc',
'auto_test/standard/dtmf_test.cc',