OLD | NEW |
---|---|
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 } | 114 } |
115 | 115 |
116 void MarkMemberTested( | 116 void MarkMemberTested( |
117 const RTCStatsMemberInterface& member, bool test_successful) { | 117 const RTCStatsMemberInterface& member, bool test_successful) { |
118 untested_members_.erase(&member); | 118 untested_members_.erase(&member); |
119 all_tests_successful_ &= test_successful; | 119 all_tests_successful_ &= test_successful; |
120 } | 120 } |
121 | 121 |
122 void TestMemberIsDefined(const RTCStatsMemberInterface& member) { | 122 void TestMemberIsDefined(const RTCStatsMemberInterface& member) { |
123 EXPECT_TRUE(member.is_defined()) << | 123 EXPECT_TRUE(member.is_defined()) << |
124 stats_->type() << "." << member.name() << "[" << stats_->id() << | 124 stats_->type() << "." << member.name() << "[" << stats_->id() << |
125 "] was undefined."; | 125 "] was undefined."; |
126 MarkMemberTested(member, member.is_defined()); | 126 MarkMemberTested(member, member.is_defined()); |
127 } | 127 } |
128 | 128 |
129 void TestMemberIsUndefined(const RTCStatsMemberInterface& member) { | 129 void TestMemberIsUndefined(const RTCStatsMemberInterface& member) { |
130 EXPECT_FALSE(member.is_defined()) << | 130 EXPECT_FALSE(member.is_defined()) << |
131 stats_->type() << "." << member.name() << "[" << stats_->id() << | 131 stats_->type() << "." << member.name() << "[" << stats_->id() << |
132 "] was defined (" << member.ValueToString() << ")."; | 132 "] was defined (" << member.ValueToString() << ")."; |
133 MarkMemberTested(member, !member.is_defined()); | 133 MarkMemberTested(member, !member.is_defined()); |
134 } | 134 } |
135 | 135 |
136 template<typename T> | |
137 void TestMemberIsPositive(const RTCStatsMemberInterface& member) { | |
138 EXPECT_TRUE(member.is_defined()) << | |
139 stats_->type() << "." << member.name() << "[" << stats_->id() << | |
140 "] was undefined."; | |
141 if (!member.is_defined()) { | |
142 MarkMemberTested(member, false); | |
143 return; | |
144 } | |
hta-webrtc
2017/01/02 11:31:59
I'm not happy with the fact that this repeats code
| |
145 bool is_positive = *member.cast_to<RTCStatsMember<T>>() > T(0); | |
146 EXPECT_TRUE(is_positive) << | |
147 stats_->type() << "." << member.name() << "[" << stats_->id() << | |
148 "] was not positive (" << member.ValueToString() << ")."; | |
149 MarkMemberTested(member, is_positive); | |
150 } | |
151 | |
152 template<typename T> | |
153 void TestMemberIsNonNegative(const RTCStatsMemberInterface& member) { | |
154 EXPECT_TRUE(member.is_defined()) << | |
155 stats_->type() << "." << member.name() << "[" << stats_->id() << | |
156 "] was undefined."; | |
157 if (!member.is_defined()) { | |
158 MarkMemberTested(member, false); | |
159 return; | |
160 } | |
161 bool is_non_negative = *member.cast_to<RTCStatsMember<T>>() >= T(0); | |
162 EXPECT_TRUE(is_non_negative) << | |
163 stats_->type() << "." << member.name() << "[" << stats_->id() << | |
164 "] was not non-negative (" << member.ValueToString() << ")."; | |
165 MarkMemberTested(member, is_non_negative); | |
166 } | |
167 | |
136 void TestMemberIsIDReference( | 168 void TestMemberIsIDReference( |
137 const RTCStatsMemberInterface& member, | 169 const RTCStatsMemberInterface& member, |
138 const char* expected_type) { | 170 const char* expected_type) { |
139 TestMemberIsIDReference(member, expected_type, false); | 171 TestMemberIsIDReference(member, expected_type, false); |
140 } | 172 } |
141 | 173 |
142 void TestMemberIsOptionalIDReference( | 174 void TestMemberIsOptionalIDReference( |
143 const RTCStatsMemberInterface& member, | 175 const RTCStatsMemberInterface& member, |
144 const char* expected_type) { | 176 const char* expected_type) { |
145 TestMemberIsIDReference(member, expected_type, true); | 177 TestMemberIsIDReference(member, expected_type, true); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
290 verifier.TestMemberIsOptionalIDReference( | 322 verifier.TestMemberIsOptionalIDReference( |
291 certificate.issuer_certificate_id, RTCCertificateStats::kType); | 323 certificate.issuer_certificate_id, RTCCertificateStats::kType); |
292 return verifier.ExpectAllMembersSuccessfullyTested(); | 324 return verifier.ExpectAllMembersSuccessfullyTested(); |
293 } | 325 } |
294 | 326 |
295 bool VerifyRTCCodecStats( | 327 bool VerifyRTCCodecStats( |
296 const RTCCodecStats& codec) { | 328 const RTCCodecStats& codec) { |
297 RTCStatsVerifier verifier(report_, &codec); | 329 RTCStatsVerifier verifier(report_, &codec); |
298 verifier.TestMemberIsDefined(codec.payload_type); | 330 verifier.TestMemberIsDefined(codec.payload_type); |
299 verifier.TestMemberIsDefined(codec.codec); | 331 verifier.TestMemberIsDefined(codec.codec); |
300 verifier.TestMemberIsDefined(codec.clock_rate); | 332 verifier.TestMemberIsPositive<uint32_t>(codec.clock_rate); |
301 verifier.TestMemberIsUndefined(codec.channels); | 333 verifier.TestMemberIsUndefined(codec.channels); |
302 verifier.TestMemberIsUndefined(codec.parameters); | 334 verifier.TestMemberIsUndefined(codec.parameters); |
303 verifier.TestMemberIsUndefined(codec.implementation); | 335 verifier.TestMemberIsUndefined(codec.implementation); |
304 return verifier.ExpectAllMembersSuccessfullyTested(); | 336 return verifier.ExpectAllMembersSuccessfullyTested(); |
305 } | 337 } |
306 | 338 |
307 bool VerifyRTCDataChannelStats( | 339 bool VerifyRTCDataChannelStats( |
308 const RTCDataChannelStats& data_channel) { | 340 const RTCDataChannelStats& data_channel) { |
309 RTCStatsVerifier verifier(report_, &data_channel); | 341 RTCStatsVerifier verifier(report_, &data_channel); |
310 verifier.TestMemberIsDefined(data_channel.label); | 342 verifier.TestMemberIsDefined(data_channel.label); |
311 verifier.TestMemberIsDefined(data_channel.protocol); | 343 verifier.TestMemberIsDefined(data_channel.protocol); |
312 verifier.TestMemberIsDefined(data_channel.datachannelid); | 344 verifier.TestMemberIsDefined(data_channel.datachannelid); |
313 verifier.TestMemberIsDefined(data_channel.state); | 345 verifier.TestMemberIsDefined(data_channel.state); |
314 verifier.TestMemberIsDefined(data_channel.messages_sent); | 346 verifier.TestMemberIsNonNegative<uint32_t>(data_channel.messages_sent); |
315 verifier.TestMemberIsDefined(data_channel.bytes_sent); | 347 verifier.TestMemberIsNonNegative<uint64_t>(data_channel.bytes_sent); |
316 verifier.TestMemberIsDefined(data_channel.messages_received); | 348 verifier.TestMemberIsNonNegative<uint32_t>(data_channel.messages_received); |
317 verifier.TestMemberIsDefined(data_channel.bytes_received); | 349 verifier.TestMemberIsNonNegative<uint64_t>(data_channel.bytes_received); |
hbos
2016/12/21 10:41:14
Here and in other places: I'm doing the check even
| |
318 return verifier.ExpectAllMembersSuccessfullyTested(); | 350 return verifier.ExpectAllMembersSuccessfullyTested(); |
319 } | 351 } |
320 | 352 |
321 bool VerifyRTCIceCandidatePairStats( | 353 bool VerifyRTCIceCandidatePairStats( |
322 const RTCIceCandidatePairStats& candidate_pair) { | 354 const RTCIceCandidatePairStats& candidate_pair) { |
323 RTCStatsVerifier verifier(report_, &candidate_pair); | 355 RTCStatsVerifier verifier(report_, &candidate_pair); |
324 verifier.TestMemberIsIDReference( | 356 verifier.TestMemberIsIDReference( |
325 candidate_pair.transport_id, RTCTransportStats::kType); | 357 candidate_pair.transport_id, RTCTransportStats::kType); |
326 verifier.TestMemberIsIDReference( | 358 verifier.TestMemberIsIDReference( |
327 candidate_pair.local_candidate_id, RTCLocalIceCandidateStats::kType); | 359 candidate_pair.local_candidate_id, RTCLocalIceCandidateStats::kType); |
328 verifier.TestMemberIsIDReference( | 360 verifier.TestMemberIsIDReference( |
329 candidate_pair.remote_candidate_id, RTCRemoteIceCandidateStats::kType); | 361 candidate_pair.remote_candidate_id, RTCRemoteIceCandidateStats::kType); |
330 verifier.TestMemberIsUndefined(candidate_pair.state); | 362 verifier.TestMemberIsUndefined(candidate_pair.state); |
331 verifier.TestMemberIsUndefined(candidate_pair.priority); | 363 verifier.TestMemberIsUndefined(candidate_pair.priority); |
332 verifier.TestMemberIsUndefined(candidate_pair.nominated); | 364 verifier.TestMemberIsUndefined(candidate_pair.nominated); |
333 verifier.TestMemberIsDefined(candidate_pair.writable); | 365 verifier.TestMemberIsDefined(candidate_pair.writable); |
334 verifier.TestMemberIsUndefined(candidate_pair.readable); | 366 verifier.TestMemberIsUndefined(candidate_pair.readable); |
335 verifier.TestMemberIsDefined(candidate_pair.bytes_sent); | 367 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.bytes_sent); |
336 verifier.TestMemberIsDefined(candidate_pair.bytes_received); | 368 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.bytes_received); |
337 verifier.TestMemberIsUndefined(candidate_pair.total_round_trip_time); | 369 verifier.TestMemberIsUndefined(candidate_pair.total_round_trip_time); |
338 verifier.TestMemberIsDefined(candidate_pair.current_round_trip_time); | 370 verifier.TestMemberIsNonNegative<double>( |
371 candidate_pair.current_round_trip_time); | |
339 verifier.TestMemberIsUndefined(candidate_pair.available_outgoing_bitrate); | 372 verifier.TestMemberIsUndefined(candidate_pair.available_outgoing_bitrate); |
340 verifier.TestMemberIsUndefined(candidate_pair.available_incoming_bitrate); | 373 verifier.TestMemberIsUndefined(candidate_pair.available_incoming_bitrate); |
341 verifier.TestMemberIsDefined(candidate_pair.requests_received); | 374 verifier.TestMemberIsNonNegative<uint64_t>( |
342 verifier.TestMemberIsDefined(candidate_pair.requests_sent); | 375 candidate_pair.requests_received); |
343 verifier.TestMemberIsDefined(candidate_pair.responses_received); | 376 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.requests_sent); |
344 verifier.TestMemberIsDefined(candidate_pair.responses_sent); | 377 verifier.TestMemberIsNonNegative<uint64_t>( |
378 candidate_pair.responses_received); | |
379 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.responses_sent); | |
345 verifier.TestMemberIsUndefined(candidate_pair.retransmissions_received); | 380 verifier.TestMemberIsUndefined(candidate_pair.retransmissions_received); |
346 verifier.TestMemberIsUndefined(candidate_pair.retransmissions_sent); | 381 verifier.TestMemberIsUndefined(candidate_pair.retransmissions_sent); |
347 verifier.TestMemberIsUndefined(candidate_pair.consent_requests_received); | 382 verifier.TestMemberIsUndefined(candidate_pair.consent_requests_received); |
348 verifier.TestMemberIsDefined(candidate_pair.consent_requests_sent); | 383 verifier.TestMemberIsNonNegative<uint64_t>( |
384 candidate_pair.consent_requests_sent); | |
349 verifier.TestMemberIsUndefined(candidate_pair.consent_responses_received); | 385 verifier.TestMemberIsUndefined(candidate_pair.consent_responses_received); |
350 verifier.TestMemberIsUndefined(candidate_pair.consent_responses_sent); | 386 verifier.TestMemberIsUndefined(candidate_pair.consent_responses_sent); |
351 return verifier.ExpectAllMembersSuccessfullyTested(); | 387 return verifier.ExpectAllMembersSuccessfullyTested(); |
352 } | 388 } |
353 | 389 |
354 bool VerifyRTCIceCandidateStats( | 390 bool VerifyRTCIceCandidateStats( |
355 const RTCIceCandidateStats& candidate) { | 391 const RTCIceCandidateStats& candidate) { |
356 RTCStatsVerifier verifier(report_, &candidate); | 392 RTCStatsVerifier verifier(report_, &candidate); |
357 verifier.TestMemberIsDefined(candidate.ip); | 393 verifier.TestMemberIsDefined(candidate.ip); |
358 verifier.TestMemberIsDefined(candidate.port); | 394 verifier.TestMemberIsNonNegative<int32_t>(candidate.port); |
359 verifier.TestMemberIsDefined(candidate.protocol); | 395 verifier.TestMemberIsDefined(candidate.protocol); |
360 verifier.TestMemberIsDefined(candidate.candidate_type); | 396 verifier.TestMemberIsDefined(candidate.candidate_type); |
361 verifier.TestMemberIsDefined(candidate.priority); | 397 verifier.TestMemberIsNonNegative<int32_t>(candidate.priority); |
362 verifier.TestMemberIsUndefined(candidate.url); | 398 verifier.TestMemberIsUndefined(candidate.url); |
363 return verifier.ExpectAllMembersSuccessfullyTested(); | 399 return verifier.ExpectAllMembersSuccessfullyTested(); |
364 } | 400 } |
365 | 401 |
366 bool VerifyRTCLocalIceCandidateStats( | 402 bool VerifyRTCLocalIceCandidateStats( |
367 const RTCLocalIceCandidateStats& local_candidate) { | 403 const RTCLocalIceCandidateStats& local_candidate) { |
368 return VerifyRTCIceCandidateStats(local_candidate); | 404 return VerifyRTCIceCandidateStats(local_candidate); |
369 } | 405 } |
370 | 406 |
371 bool VerifyRTCRemoteIceCandidateStats( | 407 bool VerifyRTCRemoteIceCandidateStats( |
(...skipping 14 matching lines...) Expand all Loading... | |
386 const RTCMediaStreamTrackStats& media_stream_track) { | 422 const RTCMediaStreamTrackStats& media_stream_track) { |
387 RTCStatsVerifier verifier(report_, &media_stream_track); | 423 RTCStatsVerifier verifier(report_, &media_stream_track); |
388 verifier.TestMemberIsDefined(media_stream_track.track_identifier); | 424 verifier.TestMemberIsDefined(media_stream_track.track_identifier); |
389 verifier.TestMemberIsDefined(media_stream_track.remote_source); | 425 verifier.TestMemberIsDefined(media_stream_track.remote_source); |
390 verifier.TestMemberIsDefined(media_stream_track.ended); | 426 verifier.TestMemberIsDefined(media_stream_track.ended); |
391 verifier.TestMemberIsDefined(media_stream_track.detached); | 427 verifier.TestMemberIsDefined(media_stream_track.detached); |
392 verifier.TestMemberIsUndefined(media_stream_track.ssrc_ids); | 428 verifier.TestMemberIsUndefined(media_stream_track.ssrc_ids); |
393 // Video or audio media stream track? | 429 // Video or audio media stream track? |
394 if (media_stream_track.frame_width.is_defined()) { | 430 if (media_stream_track.frame_width.is_defined()) { |
395 // Video-only members | 431 // Video-only members |
396 verifier.TestMemberIsDefined(media_stream_track.frame_width); | 432 verifier.TestMemberIsNonNegative<uint32_t>( |
397 verifier.TestMemberIsDefined(media_stream_track.frame_height); | 433 media_stream_track.frame_width); |
434 verifier.TestMemberIsNonNegative<uint32_t>( | |
435 media_stream_track.frame_height); | |
398 verifier.TestMemberIsUndefined(media_stream_track.frames_per_second); | 436 verifier.TestMemberIsUndefined(media_stream_track.frames_per_second); |
399 verifier.TestMemberIsUndefined(media_stream_track.frames_sent); | 437 verifier.TestMemberIsUndefined(media_stream_track.frames_sent); |
400 verifier.TestMemberIsUndefined(media_stream_track.frames_received); | 438 verifier.TestMemberIsUndefined(media_stream_track.frames_received); |
401 verifier.TestMemberIsUndefined(media_stream_track.frames_decoded); | 439 verifier.TestMemberIsUndefined(media_stream_track.frames_decoded); |
402 verifier.TestMemberIsUndefined(media_stream_track.frames_dropped); | 440 verifier.TestMemberIsUndefined(media_stream_track.frames_dropped); |
403 verifier.TestMemberIsUndefined(media_stream_track.frames_corrupted); | 441 verifier.TestMemberIsUndefined(media_stream_track.frames_corrupted); |
404 verifier.TestMemberIsUndefined(media_stream_track.partial_frames_lost); | 442 verifier.TestMemberIsUndefined(media_stream_track.partial_frames_lost); |
405 verifier.TestMemberIsUndefined(media_stream_track.full_frames_lost); | 443 verifier.TestMemberIsUndefined(media_stream_track.full_frames_lost); |
406 // Audio-only members should be undefined | 444 // Audio-only members should be undefined |
407 verifier.TestMemberIsUndefined(media_stream_track.audio_level); | 445 verifier.TestMemberIsUndefined(media_stream_track.audio_level); |
(...skipping 21 matching lines...) Expand all Loading... | |
429 verifier.MarkMemberTested(media_stream_track.echo_return_loss, true); | 467 verifier.MarkMemberTested(media_stream_track.echo_return_loss, true); |
430 verifier.MarkMemberTested( | 468 verifier.MarkMemberTested( |
431 media_stream_track.echo_return_loss_enhancement, true); | 469 media_stream_track.echo_return_loss_enhancement, true); |
432 } | 470 } |
433 return verifier.ExpectAllMembersSuccessfullyTested(); | 471 return verifier.ExpectAllMembersSuccessfullyTested(); |
434 } | 472 } |
435 | 473 |
436 bool VerifyRTCPeerConnectionStats( | 474 bool VerifyRTCPeerConnectionStats( |
437 const RTCPeerConnectionStats& peer_connection) { | 475 const RTCPeerConnectionStats& peer_connection) { |
438 RTCStatsVerifier verifier(report_, &peer_connection); | 476 RTCStatsVerifier verifier(report_, &peer_connection); |
439 verifier.TestMemberIsDefined(peer_connection.data_channels_opened); | 477 verifier.TestMemberIsNonNegative<uint32_t>( |
440 verifier.TestMemberIsDefined(peer_connection.data_channels_closed); | 478 peer_connection.data_channels_opened); |
479 verifier.TestMemberIsNonNegative<uint32_t>( | |
480 peer_connection.data_channels_closed); | |
441 return verifier.ExpectAllMembersSuccessfullyTested(); | 481 return verifier.ExpectAllMembersSuccessfullyTested(); |
442 } | 482 } |
443 | 483 |
444 void VerifyRTCRTPStreamStats( | 484 void VerifyRTCRTPStreamStats( |
445 const RTCRTPStreamStats& stream, RTCStatsVerifier* verifier) { | 485 const RTCRTPStreamStats& stream, RTCStatsVerifier* verifier) { |
446 verifier->TestMemberIsDefined(stream.ssrc); | 486 verifier->TestMemberIsDefined(stream.ssrc); |
447 verifier->TestMemberIsUndefined(stream.associate_stats_id); | 487 verifier->TestMemberIsUndefined(stream.associate_stats_id); |
448 verifier->TestMemberIsDefined(stream.is_remote); | 488 verifier->TestMemberIsDefined(stream.is_remote); |
449 verifier->TestMemberIsDefined(stream.media_type); | 489 verifier->TestMemberIsDefined(stream.media_type); |
450 verifier->TestMemberIsUndefined(stream.media_track_id); | 490 verifier->TestMemberIsUndefined(stream.media_track_id); |
451 verifier->TestMemberIsIDReference( | 491 verifier->TestMemberIsIDReference( |
452 stream.transport_id, RTCTransportStats::kType); | 492 stream.transport_id, RTCTransportStats::kType); |
453 verifier->TestMemberIsIDReference(stream.codec_id, RTCCodecStats::kType); | 493 verifier->TestMemberIsIDReference(stream.codec_id, RTCCodecStats::kType); |
454 if (stream.media_type.is_defined() && *stream.media_type == "video") { | 494 if (stream.media_type.is_defined() && *stream.media_type == "video") { |
455 verifier->TestMemberIsDefined(stream.fir_count); | 495 verifier->TestMemberIsNonNegative<uint32_t>(stream.fir_count); |
456 verifier->TestMemberIsDefined(stream.pli_count); | 496 verifier->TestMemberIsNonNegative<uint32_t>(stream.pli_count); |
457 verifier->TestMemberIsDefined(stream.nack_count); | 497 verifier->TestMemberIsNonNegative<uint32_t>(stream.nack_count); |
458 } else { | 498 } else { |
459 verifier->TestMemberIsUndefined(stream.fir_count); | 499 verifier->TestMemberIsUndefined(stream.fir_count); |
460 verifier->TestMemberIsUndefined(stream.pli_count); | 500 verifier->TestMemberIsUndefined(stream.pli_count); |
461 verifier->TestMemberIsUndefined(stream.nack_count); | 501 verifier->TestMemberIsUndefined(stream.nack_count); |
462 } | 502 } |
463 verifier->TestMemberIsUndefined(stream.sli_count); | 503 verifier->TestMemberIsUndefined(stream.sli_count); |
464 } | 504 } |
465 | 505 |
466 bool VerifyRTCInboundRTPStreamStats( | 506 bool VerifyRTCInboundRTPStreamStats( |
467 const RTCInboundRTPStreamStats& inbound_stream) { | 507 const RTCInboundRTPStreamStats& inbound_stream) { |
468 RTCStatsVerifier verifier(report_, &inbound_stream); | 508 RTCStatsVerifier verifier(report_, &inbound_stream); |
469 VerifyRTCRTPStreamStats(inbound_stream, &verifier); | 509 VerifyRTCRTPStreamStats(inbound_stream, &verifier); |
470 verifier.TestMemberIsDefined(inbound_stream.packets_received); | 510 verifier.TestMemberIsNonNegative<uint32_t>(inbound_stream.packets_received); |
471 verifier.TestMemberIsDefined(inbound_stream.bytes_received); | 511 verifier.TestMemberIsNonNegative<uint64_t>(inbound_stream.bytes_received); |
472 verifier.TestMemberIsDefined(inbound_stream.packets_lost); | 512 verifier.TestMemberIsNonNegative<uint32_t>(inbound_stream.packets_lost); |
473 if (inbound_stream.media_type.is_defined() && | 513 if (inbound_stream.media_type.is_defined() && |
474 *inbound_stream.media_type == "video") { | 514 *inbound_stream.media_type == "video") { |
475 verifier.TestMemberIsUndefined(inbound_stream.jitter); | 515 verifier.TestMemberIsUndefined(inbound_stream.jitter); |
476 } else { | 516 } else { |
477 verifier.TestMemberIsDefined(inbound_stream.jitter); | 517 verifier.TestMemberIsNonNegative<double>(inbound_stream.jitter); |
478 } | 518 } |
479 verifier.TestMemberIsDefined(inbound_stream.fraction_lost); | 519 verifier.TestMemberIsNonNegative<double>(inbound_stream.fraction_lost); |
480 verifier.TestMemberIsUndefined(inbound_stream.packets_discarded); | 520 verifier.TestMemberIsUndefined(inbound_stream.packets_discarded); |
481 verifier.TestMemberIsUndefined(inbound_stream.packets_repaired); | 521 verifier.TestMemberIsUndefined(inbound_stream.packets_repaired); |
482 verifier.TestMemberIsUndefined(inbound_stream.burst_packets_lost); | 522 verifier.TestMemberIsUndefined(inbound_stream.burst_packets_lost); |
483 verifier.TestMemberIsUndefined(inbound_stream.burst_packets_discarded); | 523 verifier.TestMemberIsUndefined(inbound_stream.burst_packets_discarded); |
484 verifier.TestMemberIsUndefined(inbound_stream.burst_loss_count); | 524 verifier.TestMemberIsUndefined(inbound_stream.burst_loss_count); |
485 verifier.TestMemberIsUndefined(inbound_stream.burst_discard_count); | 525 verifier.TestMemberIsUndefined(inbound_stream.burst_discard_count); |
486 verifier.TestMemberIsUndefined(inbound_stream.burst_loss_rate); | 526 verifier.TestMemberIsUndefined(inbound_stream.burst_loss_rate); |
487 verifier.TestMemberIsUndefined(inbound_stream.burst_discard_rate); | 527 verifier.TestMemberIsUndefined(inbound_stream.burst_discard_rate); |
488 verifier.TestMemberIsUndefined(inbound_stream.gap_loss_rate); | 528 verifier.TestMemberIsUndefined(inbound_stream.gap_loss_rate); |
489 verifier.TestMemberIsUndefined(inbound_stream.gap_discard_rate); | 529 verifier.TestMemberIsUndefined(inbound_stream.gap_discard_rate); |
490 return verifier.ExpectAllMembersSuccessfullyTested(); | 530 return verifier.ExpectAllMembersSuccessfullyTested(); |
491 } | 531 } |
492 | 532 |
493 bool VerifyRTCOutboundRTPStreamStats( | 533 bool VerifyRTCOutboundRTPStreamStats( |
494 const RTCOutboundRTPStreamStats& outbound_stream) { | 534 const RTCOutboundRTPStreamStats& outbound_stream) { |
495 RTCStatsVerifier verifier(report_, &outbound_stream); | 535 RTCStatsVerifier verifier(report_, &outbound_stream); |
496 VerifyRTCRTPStreamStats(outbound_stream, &verifier); | 536 VerifyRTCRTPStreamStats(outbound_stream, &verifier); |
497 verifier.TestMemberIsDefined(outbound_stream.packets_sent); | 537 verifier.TestMemberIsNonNegative<uint32_t>(outbound_stream.packets_sent); |
498 verifier.TestMemberIsDefined(outbound_stream.bytes_sent); | 538 verifier.TestMemberIsNonNegative<uint64_t>(outbound_stream.bytes_sent); |
499 verifier.TestMemberIsUndefined(outbound_stream.target_bitrate); | 539 verifier.TestMemberIsUndefined(outbound_stream.target_bitrate); |
500 // TODO(hbos): Defined in video but not audio case. Why? crbug.com/669877 | 540 // TODO(hbos): Defined in video but not audio case. Why? crbug.com/669877 |
501 verifier.MarkMemberTested(outbound_stream.round_trip_time, true); | 541 verifier.MarkMemberTested(outbound_stream.round_trip_time, true); |
502 return verifier.ExpectAllMembersSuccessfullyTested(); | 542 return verifier.ExpectAllMembersSuccessfullyTested(); |
503 } | 543 } |
504 | 544 |
505 bool VerifyRTCTransportStats( | 545 bool VerifyRTCTransportStats( |
506 const RTCTransportStats& transport) { | 546 const RTCTransportStats& transport) { |
507 RTCStatsVerifier verifier(report_, &transport); | 547 RTCStatsVerifier verifier(report_, &transport); |
508 verifier.TestMemberIsDefined(transport.bytes_sent); | 548 verifier.TestMemberIsNonNegative<uint64_t>(transport.bytes_sent); |
509 verifier.TestMemberIsDefined(transport.bytes_received); | 549 verifier.TestMemberIsNonNegative<uint64_t>(transport.bytes_received); |
510 verifier.TestMemberIsOptionalIDReference( | 550 verifier.TestMemberIsOptionalIDReference( |
511 transport.rtcp_transport_stats_id, RTCTransportStats::kType); | 551 transport.rtcp_transport_stats_id, RTCTransportStats::kType); |
512 verifier.TestMemberIsDefined(transport.active_connection); | 552 verifier.TestMemberIsDefined(transport.active_connection); |
513 verifier.TestMemberIsIDReference( | 553 verifier.TestMemberIsIDReference( |
514 transport.selected_candidate_pair_id, RTCIceCandidatePairStats::kType); | 554 transport.selected_candidate_pair_id, RTCIceCandidatePairStats::kType); |
515 verifier.TestMemberIsIDReference( | 555 verifier.TestMemberIsIDReference( |
516 transport.local_certificate_id, RTCCertificateStats::kType); | 556 transport.local_certificate_id, RTCCertificateStats::kType); |
517 verifier.TestMemberIsIDReference( | 557 verifier.TestMemberIsIDReference( |
518 transport.remote_certificate_id, RTCCertificateStats::kType); | 558 transport.remote_certificate_id, RTCCertificateStats::kType); |
519 return verifier.ExpectAllMembersSuccessfullyTested(); | 559 return verifier.ExpectAllMembersSuccessfullyTested(); |
(...skipping 26 matching lines...) Expand all Loading... | |
546 // This will destroy the peer connection. | 586 // This will destroy the peer connection. |
547 caller_ = nullptr; | 587 caller_ = nullptr; |
548 // Any pending stats requests should have completed in the act of destroying | 588 // Any pending stats requests should have completed in the act of destroying |
549 // the peer connection. | 589 // the peer connection. |
550 EXPECT_TRUE(stats_obtainer->report()); | 590 EXPECT_TRUE(stats_obtainer->report()); |
551 } | 591 } |
552 | 592 |
553 } // namespace | 593 } // namespace |
554 | 594 |
555 } // namespace webrtc | 595 } // namespace webrtc |
OLD | NEW |