Upstream version 7.35.144.0
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / voice_engine / test / auto_test / standard / call_report_test.cc
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/test/testsupport/fileutils.h"
12 #include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h"
13
14 class CallReportTest : public AfterStreamingFixture {
15 };
16
17 TEST_F(CallReportTest, ResetCallReportStatisticsFailsForBadInput) {
18   EXPECT_EQ(-1, voe_call_report_->ResetCallReportStatistics(-2));
19   EXPECT_EQ(-1, voe_call_report_->ResetCallReportStatistics(1));
20 }
21
22 TEST_F(CallReportTest, ResetCallReportStatisticsSucceedsWithCorrectInput) {
23   EXPECT_EQ(0, voe_call_report_->ResetCallReportStatistics(channel_));
24   EXPECT_EQ(0, voe_call_report_->ResetCallReportStatistics(-1));
25 }
26
27 TEST_F(CallReportTest, EchoMetricSummarySucceeds) {
28   EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
29   Sleep(1000);
30
31   webrtc::EchoStatistics echo_statistics;
32   EXPECT_EQ(0, voe_call_report_->GetEchoMetricSummary(echo_statistics));
33 }
34
35 TEST_F(CallReportTest, GetRoundTripTimeSummaryReturnsAllMinusOnesIfRtcpIsOff) {
36   voe_rtp_rtcp_->SetRTCPStatus(channel_, false);
37
38   webrtc::StatVal delays;
39   EXPECT_EQ(0, voe_call_report_->GetRoundTripTimeSummary(channel_, delays));
40   EXPECT_EQ(-1, delays.average);
41   EXPECT_EQ(-1, delays.min);
42   EXPECT_EQ(-1, delays.max);
43 }
44
45 // Flaky: https://code.google.com/p/webrtc/issues/detail?id=1719
46 TEST_F(CallReportTest, DISABLED_GetRoundTripTimesReturnsValuesIfRtcpIsOn) {
47   voe_rtp_rtcp_->SetRTCPStatus(channel_, true);
48   Sleep(1000);
49
50   webrtc::StatVal delays;
51   EXPECT_EQ(0, voe_call_report_->GetRoundTripTimeSummary(channel_, delays));
52   EXPECT_NE(-1, delays.average);
53   EXPECT_NE(-1, delays.min);
54   EXPECT_NE(-1, delays.max);
55 }
56
57 TEST_F(CallReportTest, WriteReportToFileFailsOnBadInput) {
58   EXPECT_EQ(-1, voe_call_report_->WriteReportToFile(NULL));
59 }
60
61 TEST_F(CallReportTest, WriteReportToFileSucceedsWithCorrectFilename) {
62   std::string output_path = webrtc::test::OutputPath();
63   std::string report_filename = output_path + "call_report.txt";
64
65   EXPECT_EQ(0, voe_call_report_->WriteReportToFile(report_filename.c_str()));
66 }