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

Side by Side Diff: webrtc/video/receive_statistics_proxy_unittest.cc

Issue 2992043002: Renamed fields in common_types.h/RtcpStatistics. (Closed)
Patch Set: Rebase on new master Created 3 years, 4 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 unified diff | Download patch
« no previous file with comments | « webrtc/video/end_to_end_tests.cc ('k') | webrtc/video/report_block_stats.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 } 238 }
239 239
240 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsRtcpStats) { 240 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsRtcpStats) {
241 const uint8_t kFracLost = 0; 241 const uint8_t kFracLost = 0;
242 const uint32_t kCumLost = 1; 242 const uint32_t kCumLost = 1;
243 const uint32_t kExtSeqNum = 10; 243 const uint32_t kExtSeqNum = 10;
244 const uint32_t kJitter = 4; 244 const uint32_t kJitter = 4;
245 245
246 RtcpStatistics rtcp_stats; 246 RtcpStatistics rtcp_stats;
247 rtcp_stats.fraction_lost = kFracLost; 247 rtcp_stats.fraction_lost = kFracLost;
248 rtcp_stats.cumulative_lost = kCumLost; 248 rtcp_stats.packets_lost = kCumLost;
249 rtcp_stats.extended_max_sequence_number = kExtSeqNum; 249 rtcp_stats.extended_highest_sequence_number = kExtSeqNum;
250 rtcp_stats.jitter = kJitter; 250 rtcp_stats.jitter = kJitter;
251 statistics_proxy_->StatisticsUpdated(rtcp_stats, kRemoteSsrc); 251 statistics_proxy_->StatisticsUpdated(rtcp_stats, kRemoteSsrc);
252 252
253 VideoReceiveStream::Stats stats = statistics_proxy_->GetStats(); 253 VideoReceiveStream::Stats stats = statistics_proxy_->GetStats();
254 EXPECT_EQ(kFracLost, stats.rtcp_stats.fraction_lost); 254 EXPECT_EQ(kFracLost, stats.rtcp_stats.fraction_lost);
255 EXPECT_EQ(kCumLost, stats.rtcp_stats.cumulative_lost); 255 EXPECT_EQ(kCumLost, stats.rtcp_stats.packets_lost);
256 EXPECT_EQ(kExtSeqNum, stats.rtcp_stats.extended_max_sequence_number); 256 EXPECT_EQ(kExtSeqNum, stats.rtcp_stats.extended_highest_sequence_number);
257 EXPECT_EQ(kJitter, stats.rtcp_stats.jitter); 257 EXPECT_EQ(kJitter, stats.rtcp_stats.jitter);
258 } 258 }
259 259
260 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsCName) { 260 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsCName) {
261 const char* kName = "cName"; 261 const char* kName = "cName";
262 statistics_proxy_->CNameChanged(kName, kRemoteSsrc); 262 statistics_proxy_->CNameChanged(kName, kRemoteSsrc);
263 EXPECT_STREQ(kName, statistics_proxy_->GetStats().c_name.c_str()); 263 EXPECT_STREQ(kName, statistics_proxy_->GetStats().c_name.c_str());
264 } 264 }
265 265
266 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsNoCNameForUnknownSsrc) { 266 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsNoCNameForUnknownSsrc) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 } 352 }
353 353
354 TEST_F(ReceiveStatisticsProxyTest, PacketLossHistogramIsUpdated) { 354 TEST_F(ReceiveStatisticsProxyTest, PacketLossHistogramIsUpdated) {
355 const uint32_t kCumLost1 = 1; 355 const uint32_t kCumLost1 = 1;
356 const uint32_t kExtSeqNum1 = 10; 356 const uint32_t kExtSeqNum1 = 10;
357 const uint32_t kCumLost2 = 2; 357 const uint32_t kCumLost2 = 2;
358 const uint32_t kExtSeqNum2 = 20; 358 const uint32_t kExtSeqNum2 = 20;
359 359
360 // One report block received. 360 // One report block received.
361 RtcpStatistics rtcp_stats1; 361 RtcpStatistics rtcp_stats1;
362 rtcp_stats1.cumulative_lost = kCumLost1; 362 rtcp_stats1.packets_lost = kCumLost1;
363 rtcp_stats1.extended_max_sequence_number = kExtSeqNum1; 363 rtcp_stats1.extended_highest_sequence_number = kExtSeqNum1;
364 statistics_proxy_->StatisticsUpdated(rtcp_stats1, kRemoteSsrc); 364 statistics_proxy_->StatisticsUpdated(rtcp_stats1, kRemoteSsrc);
365 365
366 // Two report blocks received. 366 // Two report blocks received.
367 RtcpStatistics rtcp_stats2; 367 RtcpStatistics rtcp_stats2;
368 rtcp_stats2.cumulative_lost = kCumLost2; 368 rtcp_stats2.packets_lost = kCumLost2;
369 rtcp_stats2.extended_max_sequence_number = kExtSeqNum2; 369 rtcp_stats2.extended_highest_sequence_number = kExtSeqNum2;
370 statistics_proxy_->StatisticsUpdated(rtcp_stats2, kRemoteSsrc); 370 statistics_proxy_->StatisticsUpdated(rtcp_stats2, kRemoteSsrc);
371 371
372 // Two received report blocks but min run time has not passed. 372 // Two received report blocks but min run time has not passed.
373 fake_clock_.AdvanceTimeMilliseconds(metrics::kMinRunTimeInSeconds * 1000 - 1); 373 fake_clock_.AdvanceTimeMilliseconds(metrics::kMinRunTimeInSeconds * 1000 - 1);
374 SetUp(); // Reset stat proxy causes histograms to be updated. 374 SetUp(); // Reset stat proxy causes histograms to be updated.
375 EXPECT_EQ(0, 375 EXPECT_EQ(0,
376 metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent")); 376 metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent"));
377 377
378 // Two report blocks received. 378 // Two report blocks received.
379 statistics_proxy_->StatisticsUpdated(rtcp_stats1, kRemoteSsrc); 379 statistics_proxy_->StatisticsUpdated(rtcp_stats1, kRemoteSsrc);
380 statistics_proxy_->StatisticsUpdated(rtcp_stats2, kRemoteSsrc); 380 statistics_proxy_->StatisticsUpdated(rtcp_stats2, kRemoteSsrc);
381 381
382 // Two received report blocks and min run time has passed. 382 // Two received report blocks and min run time has passed.
383 fake_clock_.AdvanceTimeMilliseconds(metrics::kMinRunTimeInSeconds * 1000); 383 fake_clock_.AdvanceTimeMilliseconds(metrics::kMinRunTimeInSeconds * 1000);
384 SetUp(); 384 SetUp();
385 EXPECT_EQ(1, 385 EXPECT_EQ(1,
386 metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent")); 386 metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent"));
387 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.ReceivedPacketsLostInPercent", 387 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.ReceivedPacketsLostInPercent",
388 (kCumLost2 - kCumLost1) * 100 / 388 (kCumLost2 - kCumLost1) * 100 /
389 (kExtSeqNum2 - kExtSeqNum1))); 389 (kExtSeqNum2 - kExtSeqNum1)));
390 } 390 }
391 391
392 TEST_F(ReceiveStatisticsProxyTest, 392 TEST_F(ReceiveStatisticsProxyTest,
393 PacketLossHistogramIsNotUpdatedIfLessThanTwoReportBlocksAreReceived) { 393 PacketLossHistogramIsNotUpdatedIfLessThanTwoReportBlocksAreReceived) {
394 RtcpStatistics rtcp_stats1; 394 RtcpStatistics rtcp_stats1;
395 rtcp_stats1.cumulative_lost = 1; 395 rtcp_stats1.packets_lost = 1;
396 rtcp_stats1.extended_max_sequence_number = 10; 396 rtcp_stats1.extended_highest_sequence_number = 10;
397 397
398 // Min run time has passed but no received report block. 398 // Min run time has passed but no received report block.
399 fake_clock_.AdvanceTimeMilliseconds(metrics::kMinRunTimeInSeconds * 1000); 399 fake_clock_.AdvanceTimeMilliseconds(metrics::kMinRunTimeInSeconds * 1000);
400 SetUp(); // Reset stat proxy causes histograms to be updated. 400 SetUp(); // Reset stat proxy causes histograms to be updated.
401 EXPECT_EQ(0, 401 EXPECT_EQ(0,
402 metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent")); 402 metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent"));
403 403
404 // Min run time has passed but only one received report block. 404 // Min run time has passed but only one received report block.
405 statistics_proxy_->StatisticsUpdated(rtcp_stats1, kRemoteSsrc); 405 statistics_proxy_->StatisticsUpdated(rtcp_stats1, kRemoteSsrc);
406 fake_clock_.AdvanceTimeMilliseconds(metrics::kMinRunTimeInSeconds * 1000); 406 fake_clock_.AdvanceTimeMilliseconds(metrics::kMinRunTimeInSeconds * 1000);
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 kFirPackets * 60 / metrics::kMinRunTimeInSeconds)); 712 kFirPackets * 60 / metrics::kMinRunTimeInSeconds));
713 EXPECT_EQ( 713 EXPECT_EQ(
714 1, metrics::NumEvents("WebRTC.Video.PliPacketsSentPerMinute", 714 1, metrics::NumEvents("WebRTC.Video.PliPacketsSentPerMinute",
715 kPliPackets * 60 / metrics::kMinRunTimeInSeconds)); 715 kPliPackets * 60 / metrics::kMinRunTimeInSeconds));
716 EXPECT_EQ( 716 EXPECT_EQ(
717 1, metrics::NumEvents("WebRTC.Video.NackPacketsSentPerMinute", 717 1, metrics::NumEvents("WebRTC.Video.NackPacketsSentPerMinute",
718 kNackPackets * 60 / metrics::kMinRunTimeInSeconds)); 718 kNackPackets * 60 / metrics::kMinRunTimeInSeconds));
719 } 719 }
720 720
721 } // namespace webrtc 721 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/end_to_end_tests.cc ('k') | webrtc/video/report_block_stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698