Chromium Code Reviews| 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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); |
| 387 } else { | 396 } else { |
| 388 verifier.TestMemberIsUndefined(candidate_pair.available_outgoing_bitrate); | 397 verifier.TestMemberIsUndefined(candidate_pair.available_outgoing_bitrate); |
| 389 } | 398 } |
| 390 verifier.TestMemberIsUndefined(candidate_pair.available_incoming_bitrate); | 399 // If we get an available_incoming_bitrate or not seems to depend |
| 400 // on test timing. | |
| 401 verifier.TestMemberIsUndefinedOrNonNegative<double>( | |
| 402 candidate_pair.available_incoming_bitrate); | |
|
hbos
2017/05/02 12:58:55
Can you move this to inside "if (is_selected_pair)
hbos
2017/05/02 13:00:46
(Or perhaps "sometimes is defined" is more accurat
nisse-webrtc
2017/05/05 09:41:19
Done. Please check if the change is like you inten
| |
| 391 verifier.TestMemberIsNonNegative<uint64_t>( | 403 verifier.TestMemberIsNonNegative<uint64_t>( |
| 392 candidate_pair.requests_received); | 404 candidate_pair.requests_received); |
| 393 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.requests_sent); | 405 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.requests_sent); |
| 394 verifier.TestMemberIsNonNegative<uint64_t>( | 406 verifier.TestMemberIsNonNegative<uint64_t>( |
| 395 candidate_pair.responses_received); | 407 candidate_pair.responses_received); |
| 396 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.responses_sent); | 408 verifier.TestMemberIsNonNegative<uint64_t>(candidate_pair.responses_sent); |
| 397 verifier.TestMemberIsUndefined(candidate_pair.retransmissions_received); | 409 verifier.TestMemberIsUndefined(candidate_pair.retransmissions_received); |
| 398 verifier.TestMemberIsUndefined(candidate_pair.retransmissions_sent); | 410 verifier.TestMemberIsUndefined(candidate_pair.retransmissions_sent); |
| 399 verifier.TestMemberIsUndefined(candidate_pair.consent_requests_received); | 411 verifier.TestMemberIsUndefined(candidate_pair.consent_requests_received); |
| 400 verifier.TestMemberIsNonNegative<uint64_t>( | 412 verifier.TestMemberIsNonNegative<uint64_t>( |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 646 caller_ = nullptr; | 658 caller_ = nullptr; |
| 647 // Any pending stats requests should have completed in the act of destroying | 659 // Any pending stats requests should have completed in the act of destroying |
| 648 // the peer connection. | 660 // the peer connection. |
| 649 EXPECT_TRUE(stats_obtainer->report()); | 661 EXPECT_TRUE(stats_obtainer->report()); |
| 650 } | 662 } |
| 651 #endif // HAVE_SCTP | 663 #endif // HAVE_SCTP |
| 652 | 664 |
| 653 } // namespace | 665 } // namespace |
| 654 | 666 |
| 655 } // namespace webrtc | 667 } // namespace webrtc |
| OLD | NEW |