| 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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 | 1234 |
| 1235 SessionStats session_stats; | 1235 SessionStats session_stats; |
| 1236 | 1236 |
| 1237 cricket::ConnectionInfo connection_info; | 1237 cricket::ConnectionInfo connection_info; |
| 1238 connection_info.best_connection = false; | 1238 connection_info.best_connection = false; |
| 1239 connection_info.local_candidate = *local_candidate.get(); | 1239 connection_info.local_candidate = *local_candidate.get(); |
| 1240 connection_info.remote_candidate = *remote_candidate.get(); | 1240 connection_info.remote_candidate = *remote_candidate.get(); |
| 1241 connection_info.writable = true; | 1241 connection_info.writable = true; |
| 1242 connection_info.sent_total_bytes = 42; | 1242 connection_info.sent_total_bytes = 42; |
| 1243 connection_info.recv_total_bytes = 1234; | 1243 connection_info.recv_total_bytes = 1234; |
| 1244 connection_info.rtt = 1337; | 1244 connection_info.total_round_trip_time_ms = 0; |
| 1245 connection_info.current_round_trip_time_ms = rtc::Optional<uint32_t>(); |
| 1245 connection_info.recv_ping_requests = 2020; | 1246 connection_info.recv_ping_requests = 2020; |
| 1246 connection_info.sent_ping_requests_total = 2020; | 1247 connection_info.sent_ping_requests_total = 2020; |
| 1247 connection_info.sent_ping_requests_before_first_response = 2000; | 1248 connection_info.sent_ping_requests_before_first_response = 2000; |
| 1248 connection_info.recv_ping_responses = 4321; | 1249 connection_info.recv_ping_responses = 4321; |
| 1249 connection_info.sent_ping_responses = 1000; | 1250 connection_info.sent_ping_responses = 1000; |
| 1250 connection_info.state = cricket::IceCandidatePairState::IN_PROGRESS; | 1251 connection_info.state = cricket::IceCandidatePairState::IN_PROGRESS; |
| 1251 connection_info.priority = 5555; | 1252 connection_info.priority = 5555; |
| 1252 connection_info.nominated = false; | 1253 connection_info.nominated = false; |
| 1253 | 1254 |
| 1254 cricket::TransportChannelStats transport_channel_stats; | 1255 cricket::TransportChannelStats transport_channel_stats; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1288 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1288 expected_pair.local_candidate_id = "RTCIceCandidate_" + local_candidate->id(); | 1289 expected_pair.local_candidate_id = "RTCIceCandidate_" + local_candidate->id(); |
| 1289 expected_pair.remote_candidate_id = | 1290 expected_pair.remote_candidate_id = |
| 1290 "RTCIceCandidate_" + remote_candidate->id(); | 1291 "RTCIceCandidate_" + remote_candidate->id(); |
| 1291 expected_pair.state = RTCStatsIceCandidatePairState::kInProgress; | 1292 expected_pair.state = RTCStatsIceCandidatePairState::kInProgress; |
| 1292 expected_pair.priority = 5555; | 1293 expected_pair.priority = 5555; |
| 1293 expected_pair.nominated = false; | 1294 expected_pair.nominated = false; |
| 1294 expected_pair.writable = true; | 1295 expected_pair.writable = true; |
| 1295 expected_pair.bytes_sent = 42; | 1296 expected_pair.bytes_sent = 42; |
| 1296 expected_pair.bytes_received = 1234; | 1297 expected_pair.bytes_received = 1234; |
| 1297 expected_pair.current_round_trip_time = 1.337; | 1298 expected_pair.total_round_trip_time = 0.0; |
| 1298 expected_pair.requests_received = 2020; | 1299 expected_pair.requests_received = 2020; |
| 1299 expected_pair.requests_sent = 2000; | 1300 expected_pair.requests_sent = 2000; |
| 1300 expected_pair.responses_received = 4321; | 1301 expected_pair.responses_received = 4321; |
| 1301 expected_pair.responses_sent = 1000; | 1302 expected_pair.responses_sent = 1000; |
| 1302 expected_pair.consent_requests_sent = (2020 - 2000); | 1303 expected_pair.consent_requests_sent = (2020 - 2000); |
| 1304 // |expected_pair.current_round_trip_time| should be undefined because the |
| 1305 // current RTT is not set. |
| 1303 // |expected_pair.available_[outgoing/incoming]_bitrate| should be undefined | 1306 // |expected_pair.available_[outgoing/incoming]_bitrate| should be undefined |
| 1304 // because is is not the current pair. | 1307 // because is is not the current pair. |
| 1305 | 1308 |
| 1306 ASSERT_TRUE(report->Get(expected_pair.id())); | 1309 ASSERT_TRUE(report->Get(expected_pair.id())); |
| 1307 EXPECT_EQ( | 1310 EXPECT_EQ( |
| 1308 expected_pair, | 1311 expected_pair, |
| 1309 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>()); | 1312 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>()); |
| 1310 EXPECT_TRUE(report->Get(*expected_pair.transport_id)); | 1313 EXPECT_TRUE(report->Get(*expected_pair.transport_id)); |
| 1311 | 1314 |
| 1312 // Set nominated and "GetStats" again. | 1315 // Set nominated and "GetStats" again. |
| 1313 session_stats.transport_stats["transport"] | 1316 session_stats.transport_stats["transport"] |
| 1314 .channel_stats[0] | 1317 .channel_stats[0] |
| 1315 .connection_infos[0] | 1318 .connection_infos[0] |
| 1316 .nominated = true; | 1319 .nominated = true; |
| 1317 EXPECT_CALL(*video_media_channel, GetStats(_)) | 1320 EXPECT_CALL(*video_media_channel, GetStats(_)) |
| 1318 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); | 1321 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); |
| 1319 collector_->ClearCachedStatsReport(); | 1322 collector_->ClearCachedStatsReport(); |
| 1320 report = GetStatsReport(); | 1323 report = GetStatsReport(); |
| 1321 expected_pair.nominated = true; | 1324 expected_pair.nominated = true; |
| 1322 ASSERT_TRUE(report->Get(expected_pair.id())); | 1325 ASSERT_TRUE(report->Get(expected_pair.id())); |
| 1323 EXPECT_EQ( | 1326 EXPECT_EQ( |
| 1324 expected_pair, | 1327 expected_pair, |
| 1325 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>()); | 1328 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>()); |
| 1326 EXPECT_TRUE(report->Get(*expected_pair.transport_id)); | 1329 EXPECT_TRUE(report->Get(*expected_pair.transport_id)); |
| 1327 | 1330 |
| 1331 // Set round trip times and "GetStats" again. |
| 1332 session_stats.transport_stats["transport"].channel_stats[0] |
| 1333 .connection_infos[0].total_round_trip_time_ms = 7331; |
| 1334 session_stats.transport_stats["transport"].channel_stats[0] |
| 1335 .connection_infos[0].current_round_trip_time_ms = |
| 1336 rtc::Optional<uint32_t>(1337); |
| 1337 EXPECT_CALL(*video_media_channel, GetStats(_)) |
| 1338 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); |
| 1339 collector_->ClearCachedStatsReport(); |
| 1340 report = GetStatsReport(); |
| 1341 expected_pair.total_round_trip_time = 7.331; |
| 1342 expected_pair.current_round_trip_time = 1.337; |
| 1343 ASSERT_TRUE(report->Get(expected_pair.id())); |
| 1344 EXPECT_EQ( |
| 1345 expected_pair, |
| 1346 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>()); |
| 1347 EXPECT_TRUE(report->Get(*expected_pair.transport_id)); |
| 1348 |
| 1328 // Make pair the current pair, clear bandwidth and "GetStats" again. | 1349 // Make pair the current pair, clear bandwidth and "GetStats" again. |
| 1329 session_stats.transport_stats["transport"] | 1350 session_stats.transport_stats["transport"] |
| 1330 .channel_stats[0] | 1351 .channel_stats[0] |
| 1331 .connection_infos[0] | 1352 .connection_infos[0] |
| 1332 .best_connection = true; | 1353 .best_connection = true; |
| 1333 video_media_info.bw_estimations[0].available_send_bandwidth = 0; | 1354 video_media_info.bw_estimations[0].available_send_bandwidth = 0; |
| 1334 video_media_info.bw_estimations[0].available_recv_bandwidth = 0; | 1355 video_media_info.bw_estimations[0].available_recv_bandwidth = 0; |
| 1335 EXPECT_CALL(*video_media_channel, GetStats(_)) | 1356 EXPECT_CALL(*video_media_channel, GetStats(_)) |
| 1336 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); | 1357 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); |
| 1337 collector_->ClearCachedStatsReport(); | 1358 collector_->ClearCachedStatsReport(); |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2280 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; | 2301 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; |
| 2281 }; | 2302 }; |
| 2282 | 2303 |
| 2283 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { | 2304 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { |
| 2284 collector_->VerifyThreadUsageAndResultsMerging(); | 2305 collector_->VerifyThreadUsageAndResultsMerging(); |
| 2285 } | 2306 } |
| 2286 | 2307 |
| 2287 } // namespace | 2308 } // namespace |
| 2288 | 2309 |
| 2289 } // namespace webrtc | 2310 } // namespace webrtc |
| OLD | NEW |