Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(944)

Unified Diff: webrtc/video/call_stats_unittest.cc

Issue 1669623004: Use CallStats for RTT in Call, rather than VideoSendStream::GetRtt() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comment, rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/video/call_stats.cc ('k') | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/call_stats_unittest.cc
diff --git a/webrtc/video/call_stats_unittest.cc b/webrtc/video/call_stats_unittest.cc
index 6226a5bf6e751cbc798de4b80fb2f207b665075e..2421cc7148a6d36f5972f0fe17eec19ce63037f9 100644
--- a/webrtc/video/call_stats_unittest.cc
+++ b/webrtc/video/call_stats_unittest.cc
@@ -13,7 +13,9 @@
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
+#include "webrtc/system_wrappers/include/metrics.h"
#include "webrtc/system_wrappers/include/tick_util.h"
+#include "webrtc/test/histogram.h"
#include "webrtc/video/call_stats.h"
using ::testing::_;
@@ -45,7 +47,7 @@ TEST_F(CallStatsTest, AddAndTriggerCallback) {
RtcpRttStats* rtcp_rtt_stats = call_stats_->rtcp_rtt_stats();
call_stats_->RegisterStatsObserver(&stats_observer);
fake_clock_.AdvanceTimeMilliseconds(1000);
- EXPECT_EQ(0, rtcp_rtt_stats->LastProcessedRtt());
+ EXPECT_EQ(-1, rtcp_rtt_stats->LastProcessedRtt());
const int64_t kRtt = 25;
rtcp_rtt_stats->OnRttUpdate(kRtt);
@@ -57,7 +59,7 @@ TEST_F(CallStatsTest, AddAndTriggerCallback) {
fake_clock_.AdvanceTimeMilliseconds(kRttTimeOutMs);
EXPECT_CALL(stats_observer, OnRttUpdate(_, _)).Times(0);
call_stats_->Process();
- EXPECT_EQ(0, rtcp_rtt_stats->LastProcessedRtt());
+ EXPECT_EQ(-1, rtcp_rtt_stats->LastProcessedRtt());
call_stats_->DeregisterStatsObserver(&stats_observer);
}
@@ -201,4 +203,19 @@ TEST_F(CallStatsTest, LastProcessedRtt) {
call_stats_->DeregisterStatsObserver(&stats_observer);
}
+TEST_F(CallStatsTest, ProducesHistogramMetrics) {
+ const int64_t kRtt = 123;
+ RtcpRttStats* rtcp_rtt_stats = call_stats_->rtcp_rtt_stats();
+ rtcp_rtt_stats->OnRttUpdate(kRtt);
+ fake_clock_.AdvanceTimeMilliseconds(metrics::kMinRunTimeInSeconds * 1000);
+ rtcp_rtt_stats->OnRttUpdate(kRtt);
+ call_stats_->Process();
+ call_stats_.reset();
+
+ EXPECT_EQ(1, test::NumHistogramSamples(
+ "WebRTC.Video.AverageRoundTripTimeInMilliseconds"));
+ EXPECT_EQ(kRtt, test::LastHistogramSample(
+ "WebRTC.Video.AverageRoundTripTimeInMilliseconds"));
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/video/call_stats.cc ('k') | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698