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

Side by Side Diff: webrtc/pc/rtcstats_integrationtest.cc

Issue 2675923002: RTCIceCandidatePairStats.available[Outgoing/Incoming]Bitrate collected. (Closed)
Patch Set: Rebase with master Created 3 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 unified diff | Download patch
« no previous file with comments | « webrtc/api/stats/rtcstats_objects.h ('k') | webrtc/pc/rtcstatscollector.h » ('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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 return stats_types; 252 return stats_types;
253 } 253 }
254 254
255 explicit RTCStatsReportVerifier(const RTCStatsReport* report) 255 explicit RTCStatsReportVerifier(const RTCStatsReport* report)
256 : report_(report) { 256 : report_(report) {
257 } 257 }
258 258
259 void VerifyReport() { 259 void VerifyReport() {
260 std::set<const char*> missing_stats = StatsTypes(); 260 std::set<const char*> missing_stats = StatsTypes();
261 bool verify_successful = true; 261 bool verify_successful = true;
262 std::vector<const RTCTransportStats*> transport_stats =
263 report_->GetStatsOfType<RTCTransportStats>();
264 EXPECT_EQ(transport_stats.size(), 1);
265 std::string selected_candidate_pair_id =
266 *transport_stats[0]->selected_candidate_pair_id;
262 for (const RTCStats& stats : *report_) { 267 for (const RTCStats& stats : *report_) {
263 missing_stats.erase(stats.type()); 268 missing_stats.erase(stats.type());
264 if (stats.type() == RTCCertificateStats::kType) { 269 if (stats.type() == RTCCertificateStats::kType) {
265 verify_successful &= VerifyRTCCertificateStats( 270 verify_successful &= VerifyRTCCertificateStats(
266 stats.cast_to<RTCCertificateStats>()); 271 stats.cast_to<RTCCertificateStats>());
267 } else if (stats.type() == RTCCodecStats::kType) { 272 } else if (stats.type() == RTCCodecStats::kType) {
268 verify_successful &= VerifyRTCCodecStats( 273 verify_successful &= VerifyRTCCodecStats(
269 stats.cast_to<RTCCodecStats>()); 274 stats.cast_to<RTCCodecStats>());
270 } else if (stats.type() == RTCDataChannelStats::kType) { 275 } else if (stats.type() == RTCDataChannelStats::kType) {
271 verify_successful &= VerifyRTCDataChannelStats( 276 verify_successful &= VerifyRTCDataChannelStats(
272 stats.cast_to<RTCDataChannelStats>()); 277 stats.cast_to<RTCDataChannelStats>());
273 } else if (stats.type() == RTCIceCandidatePairStats::kType) { 278 } else if (stats.type() == RTCIceCandidatePairStats::kType) {
274 verify_successful &= VerifyRTCIceCandidatePairStats( 279 verify_successful &= VerifyRTCIceCandidatePairStats(
275 stats.cast_to<RTCIceCandidatePairStats>()); 280 stats.cast_to<RTCIceCandidatePairStats>(),
281 stats.id() == selected_candidate_pair_id);
276 } else if (stats.type() == RTCLocalIceCandidateStats::kType) { 282 } else if (stats.type() == RTCLocalIceCandidateStats::kType) {
277 verify_successful &= VerifyRTCLocalIceCandidateStats( 283 verify_successful &= VerifyRTCLocalIceCandidateStats(
278 stats.cast_to<RTCLocalIceCandidateStats>()); 284 stats.cast_to<RTCLocalIceCandidateStats>());
279 } else if (stats.type() == RTCRemoteIceCandidateStats::kType) { 285 } else if (stats.type() == RTCRemoteIceCandidateStats::kType) {
280 verify_successful &= VerifyRTCRemoteIceCandidateStats( 286 verify_successful &= VerifyRTCRemoteIceCandidateStats(
281 stats.cast_to<RTCRemoteIceCandidateStats>()); 287 stats.cast_to<RTCRemoteIceCandidateStats>());
282 } else if (stats.type() == RTCMediaStreamStats::kType) { 288 } else if (stats.type() == RTCMediaStreamStats::kType) {
283 verify_successful &= VerifyRTCMediaStreamStats( 289 verify_successful &= VerifyRTCMediaStreamStats(
284 stats.cast_to<RTCMediaStreamStats>()); 290 stats.cast_to<RTCMediaStreamStats>());
285 } else if (stats.type() == RTCMediaStreamTrackStats::kType) { 291 } else if (stats.type() == RTCMediaStreamTrackStats::kType) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 verifier.TestMemberIsDefined(data_channel.datachannelid); 350 verifier.TestMemberIsDefined(data_channel.datachannelid);
345 verifier.TestMemberIsDefined(data_channel.state); 351 verifier.TestMemberIsDefined(data_channel.state);
346 verifier.TestMemberIsNonNegative<uint32_t>(data_channel.messages_sent); 352 verifier.TestMemberIsNonNegative<uint32_t>(data_channel.messages_sent);
347 verifier.TestMemberIsNonNegative<uint64_t>(data_channel.bytes_sent); 353 verifier.TestMemberIsNonNegative<uint64_t>(data_channel.bytes_sent);
348 verifier.TestMemberIsNonNegative<uint32_t>(data_channel.messages_received); 354 verifier.TestMemberIsNonNegative<uint32_t>(data_channel.messages_received);
349 verifier.TestMemberIsNonNegative<uint64_t>(data_channel.bytes_received); 355 verifier.TestMemberIsNonNegative<uint64_t>(data_channel.bytes_received);
350 return verifier.ExpectAllMembersSuccessfullyTested(); 356 return verifier.ExpectAllMembersSuccessfullyTested();
351 } 357 }
352 358
353 bool VerifyRTCIceCandidatePairStats( 359 bool VerifyRTCIceCandidatePairStats(
354 const RTCIceCandidatePairStats& candidate_pair) { 360 const RTCIceCandidatePairStats& candidate_pair, bool is_selected_pair) {
355 RTCStatsVerifier verifier(report_, &candidate_pair); 361 RTCStatsVerifier verifier(report_, &candidate_pair);
356 verifier.TestMemberIsIDReference( 362 verifier.TestMemberIsIDReference(
357 candidate_pair.transport_id, RTCTransportStats::kType); 363 candidate_pair.transport_id, RTCTransportStats::kType);
358 verifier.TestMemberIsIDReference( 364 verifier.TestMemberIsIDReference(
359 candidate_pair.local_candidate_id, RTCLocalIceCandidateStats::kType); 365 candidate_pair.local_candidate_id, RTCLocalIceCandidateStats::kType);
360 verifier.TestMemberIsIDReference( 366 verifier.TestMemberIsIDReference(
361 candidate_pair.remote_candidate_id, RTCRemoteIceCandidateStats::kType); 367 candidate_pair.remote_candidate_id, RTCRemoteIceCandidateStats::kType);
362 verifier.TestMemberIsDefined(candidate_pair.state); 368 verifier.TestMemberIsDefined(candidate_pair.state);
363 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.priority); 369 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.priority);
364 verifier.TestMemberIsUndefined(candidate_pair.nominated); 370 verifier.TestMemberIsUndefined(candidate_pair.nominated);
365 verifier.TestMemberIsDefined(candidate_pair.writable); 371 verifier.TestMemberIsDefined(candidate_pair.writable);
366 verifier.TestMemberIsUndefined(candidate_pair.readable); 372 verifier.TestMemberIsUndefined(candidate_pair.readable);
367 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.bytes_sent); 373 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.bytes_sent);
368 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.bytes_received); 374 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.bytes_received);
369 verifier.TestMemberIsUndefined(candidate_pair.total_round_trip_time); 375 verifier.TestMemberIsUndefined(candidate_pair.total_round_trip_time);
370 verifier.TestMemberIsNonNegative<double>( 376 verifier.TestMemberIsNonNegative<double>(
371 candidate_pair.current_round_trip_time); 377 candidate_pair.current_round_trip_time);
372 verifier.TestMemberIsUndefined(candidate_pair.available_outgoing_bitrate); 378 if (is_selected_pair) {
379 verifier.TestMemberIsNonNegative<double>(
380 candidate_pair.available_outgoing_bitrate);
381 } else {
382 verifier.TestMemberIsUndefined(candidate_pair.available_outgoing_bitrate);
383 }
373 verifier.TestMemberIsUndefined(candidate_pair.available_incoming_bitrate); 384 verifier.TestMemberIsUndefined(candidate_pair.available_incoming_bitrate);
374 verifier.TestMemberIsNonNegative<uint64_t>( 385 verifier.TestMemberIsNonNegative<uint64_t>(
375 candidate_pair.requests_received); 386 candidate_pair.requests_received);
376 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.requests_sent); 387 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.requests_sent);
377 verifier.TestMemberIsNonNegative<uint64_t>( 388 verifier.TestMemberIsNonNegative<uint64_t>(
378 candidate_pair.responses_received); 389 candidate_pair.responses_received);
379 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.responses_sent); 390 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.responses_sent);
380 verifier.TestMemberIsUndefined(candidate_pair.retransmissions_received); 391 verifier.TestMemberIsUndefined(candidate_pair.retransmissions_received);
381 verifier.TestMemberIsUndefined(candidate_pair.retransmissions_sent); 392 verifier.TestMemberIsUndefined(candidate_pair.retransmissions_sent);
382 verifier.TestMemberIsUndefined(candidate_pair.consent_requests_received); 393 verifier.TestMemberIsUndefined(candidate_pair.consent_requests_received);
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 caller_ = nullptr; 636 caller_ = nullptr;
626 // Any pending stats requests should have completed in the act of destroying 637 // Any pending stats requests should have completed in the act of destroying
627 // the peer connection. 638 // the peer connection.
628 EXPECT_TRUE(stats_obtainer->report()); 639 EXPECT_TRUE(stats_obtainer->report());
629 } 640 }
630 #endif // HAVE_SCTP 641 #endif // HAVE_SCTP
631 642
632 } // namespace 643 } // namespace
633 644
634 } // namespace webrtc 645 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/stats/rtcstats_objects.h ('k') | webrtc/pc/rtcstatscollector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698