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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 } | 132 } |
133 | 133 |
134 void TestMemberIsUndefined(const RTCStatsMemberInterface& member) { | 134 void TestMemberIsUndefined(const RTCStatsMemberInterface& member) { |
135 EXPECT_FALSE(member.is_defined()) << | 135 EXPECT_FALSE(member.is_defined()) << |
136 stats_->type() << "." << member.name() << "[" << stats_->id() << | 136 stats_->type() << "." << member.name() << "[" << stats_->id() << |
137 "] was defined (" << member.ValueToString() << ")."; | 137 "] was defined (" << member.ValueToString() << ")."; |
138 MarkMemberTested(member, !member.is_defined()); | 138 MarkMemberTested(member, !member.is_defined()); |
139 } | 139 } |
140 | 140 |
141 template<typename T> | 141 template<typename T> |
| 142 void TestMemberIsUndefinedOrNonNegative( |
| 143 const RTCStatsMemberInterface& member) { |
| 144 if (member.is_defined()) |
| 145 TestMemberIsNonNegative<T>(member); |
| 146 else |
| 147 MarkMemberTested(member, true); |
| 148 } |
| 149 |
| 150 template<typename T> |
142 void TestMemberIsPositive(const RTCStatsMemberInterface& member) { | 151 void TestMemberIsPositive(const RTCStatsMemberInterface& member) { |
143 EXPECT_TRUE(member.is_defined()) << | 152 EXPECT_TRUE(member.is_defined()) << |
144 stats_->type() << "." << member.name() << "[" << stats_->id() << | 153 stats_->type() << "." << member.name() << "[" << stats_->id() << |
145 "] was undefined."; | 154 "] was undefined."; |
146 if (!member.is_defined()) { | 155 if (!member.is_defined()) { |
147 MarkMemberTested(member, false); | 156 MarkMemberTested(member, false); |
148 return; | 157 return; |
149 } | 158 } |
150 bool is_positive = *member.cast_to<RTCStatsMember<T>>() > T(0); | 159 bool is_positive = *member.cast_to<RTCStatsMember<T>>() > T(0); |
151 EXPECT_TRUE(is_positive) << | 160 EXPECT_TRUE(is_positive) << |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 verifier.TestMemberIsUndefined(candidate_pair.readable); | 386 verifier.TestMemberIsUndefined(candidate_pair.readable); |
378 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.bytes_sent); | 387 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.bytes_sent); |
379 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.bytes_received); | 388 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.bytes_received); |
380 verifier.TestMemberIsNonNegative<double>( | 389 verifier.TestMemberIsNonNegative<double>( |
381 candidate_pair.total_round_trip_time); | 390 candidate_pair.total_round_trip_time); |
382 verifier.TestMemberIsNonNegative<double>( | 391 verifier.TestMemberIsNonNegative<double>( |
383 candidate_pair.current_round_trip_time); | 392 candidate_pair.current_round_trip_time); |
384 if (is_selected_pair) { | 393 if (is_selected_pair) { |
385 verifier.TestMemberIsNonNegative<double>( | 394 verifier.TestMemberIsNonNegative<double>( |
386 candidate_pair.available_outgoing_bitrate); | 395 candidate_pair.available_outgoing_bitrate); |
| 396 // TODO(hbos, nisse): It's usually undefined, but have appeared in tests |
| 397 // on the tsan try-bot. Find out why, possibly something timing related? |
| 398 // See https://bugs.webrtc.org/7062. |
| 399 verifier.TestMemberIsUndefinedOrNonNegative<double>( |
| 400 candidate_pair.available_incoming_bitrate); |
387 } else { | 401 } else { |
388 verifier.TestMemberIsUndefined(candidate_pair.available_outgoing_bitrate); | 402 verifier.TestMemberIsUndefined(candidate_pair.available_outgoing_bitrate); |
| 403 verifier.TestMemberIsUndefined(candidate_pair.available_incoming_bitrate); |
389 } | 404 } |
390 verifier.TestMemberIsUndefined(candidate_pair.available_incoming_bitrate); | |
391 verifier.TestMemberIsNonNegative<uint64_t>( | 405 verifier.TestMemberIsNonNegative<uint64_t>( |
392 candidate_pair.requests_received); | 406 candidate_pair.requests_received); |
393 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.requests_sent); | 407 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.requests_sent); |
394 verifier.TestMemberIsNonNegative<uint64_t>( | 408 verifier.TestMemberIsNonNegative<uint64_t>( |
395 candidate_pair.responses_received); | 409 candidate_pair.responses_received); |
396 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.responses_sent); | 410 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.responses_sent); |
397 verifier.TestMemberIsUndefined(candidate_pair.retransmissions_received); | 411 verifier.TestMemberIsUndefined(candidate_pair.retransmissions_received); |
398 verifier.TestMemberIsUndefined(candidate_pair.retransmissions_sent); | 412 verifier.TestMemberIsUndefined(candidate_pair.retransmissions_sent); |
399 verifier.TestMemberIsUndefined(candidate_pair.consent_requests_received); | 413 verifier.TestMemberIsUndefined(candidate_pair.consent_requests_received); |
400 verifier.TestMemberIsNonNegative<uint64_t>( | 414 verifier.TestMemberIsNonNegative<uint64_t>( |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 caller_ = nullptr; | 660 caller_ = nullptr; |
647 // Any pending stats requests should have completed in the act of destroying | 661 // Any pending stats requests should have completed in the act of destroying |
648 // the peer connection. | 662 // the peer connection. |
649 EXPECT_TRUE(stats_obtainer->report()); | 663 EXPECT_TRUE(stats_obtainer->report()); |
650 } | 664 } |
651 #endif // HAVE_SCTP | 665 #endif // HAVE_SCTP |
652 | 666 |
653 } // namespace | 667 } // namespace |
654 | 668 |
655 } // namespace webrtc | 669 } // namespace webrtc |
OLD | NEW |