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

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

Issue 2719523002: RTCIceCandidatePairStats.[total/current]RoundTripTime collected. (Closed)
Patch Set: 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
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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = rtc::Optional<uint64_t>();
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 1253
1253 cricket::TransportChannelStats transport_channel_stats; 1254 cricket::TransportChannelStats transport_channel_stats;
1254 transport_channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; 1255 transport_channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP;
(...skipping 30 matching lines...) Expand all
1285 "RTCTransport_transport_" + 1286 "RTCTransport_transport_" +
1286 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP); 1287 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP);
1287 expected_pair.local_candidate_id = "RTCIceCandidate_" + local_candidate->id(); 1288 expected_pair.local_candidate_id = "RTCIceCandidate_" + local_candidate->id();
1288 expected_pair.remote_candidate_id = 1289 expected_pair.remote_candidate_id =
1289 "RTCIceCandidate_" + remote_candidate->id(); 1290 "RTCIceCandidate_" + remote_candidate->id();
1290 expected_pair.state = RTCStatsIceCandidatePairState::kInProgress; 1291 expected_pair.state = RTCStatsIceCandidatePairState::kInProgress;
1291 expected_pair.priority = 5555; 1292 expected_pair.priority = 5555;
1292 expected_pair.writable = true; 1293 expected_pair.writable = true;
1293 expected_pair.bytes_sent = 42; 1294 expected_pair.bytes_sent = 42;
1294 expected_pair.bytes_received = 1234; 1295 expected_pair.bytes_received = 1234;
1295 expected_pair.current_round_trip_time = 1.337;
1296 expected_pair.requests_received = 2020; 1296 expected_pair.requests_received = 2020;
1297 expected_pair.requests_sent = 2000; 1297 expected_pair.requests_sent = 2000;
1298 expected_pair.responses_received = 4321; 1298 expected_pair.responses_received = 4321;
1299 expected_pair.responses_sent = 1000; 1299 expected_pair.responses_sent = 1000;
1300 expected_pair.consent_requests_sent = (2020 - 2000); 1300 expected_pair.consent_requests_sent = (2020 - 2000);
1301 // |expected_pair.available_[total/current]_round_trip_time| should be
1302 // undefined because round trip times are not set.
1301 // |expected_pair.available_[outgoing/incoming]_bitrate| should be undefined 1303 // |expected_pair.available_[outgoing/incoming]_bitrate| should be undefined
1302 // because is is not the current pair. 1304 // because is is not the current pair.
1303 1305
1304 ASSERT_TRUE(report->Get(expected_pair.id())); 1306 ASSERT_TRUE(report->Get(expected_pair.id()));
1305 EXPECT_EQ( 1307 EXPECT_EQ(
1306 expected_pair, 1308 expected_pair,
1307 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>()); 1309 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>());
1308 EXPECT_TRUE(report->Get(*expected_pair.transport_id)); 1310 EXPECT_TRUE(report->Get(*expected_pair.transport_id));
1309 1311
1312 // Set round trip times and "GetStats" again.
1313 session_stats.transport_stats["transport"].channel_stats[0]
1314 .connection_infos[0].total_round_trip_time_ms =
1315 rtc::Optional<uint64_t>(7331);
1316 session_stats.transport_stats["transport"].channel_stats[0]
1317 .connection_infos[0].current_round_trip_time_ms =
1318 rtc::Optional<uint32_t>(1337);
1319 EXPECT_CALL(*video_media_channel, GetStats(_))
1320 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true)));
1321 collector_->ClearCachedStatsReport();
1322 report = GetStatsReport();
1323 expected_pair.total_round_trip_time = 7.331;
1324 expected_pair.current_round_trip_time = 1.337;
1325 ASSERT_TRUE(report->Get(expected_pair.id()));
1326 EXPECT_EQ(
1327 expected_pair,
1328 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>());
1329 EXPECT_TRUE(report->Get(*expected_pair.transport_id));
1330
1310 // Make pair the current pair, clear bandwidth and "GetStats" again. 1331 // Make pair the current pair, clear bandwidth and "GetStats" again.
1311 session_stats.transport_stats["transport"] 1332 session_stats.transport_stats["transport"]
1312 .channel_stats[0] 1333 .channel_stats[0]
1313 .connection_infos[0] 1334 .connection_infos[0]
1314 .best_connection = true; 1335 .best_connection = true;
1315 video_media_info.bw_estimations[0].available_send_bandwidth = 0; 1336 video_media_info.bw_estimations[0].available_send_bandwidth = 0;
1316 video_media_info.bw_estimations[0].available_recv_bandwidth = 0; 1337 video_media_info.bw_estimations[0].available_recv_bandwidth = 0;
1317 EXPECT_CALL(*video_media_channel, GetStats(_)) 1338 EXPECT_CALL(*video_media_channel, GetStats(_))
1318 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); 1339 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true)));
1319 collector_->ClearCachedStatsReport(); 1340 collector_->ClearCachedStatsReport();
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; 2283 rtc::scoped_refptr<FakeRTCStatsCollector> collector_;
2263 }; 2284 };
2264 2285
2265 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { 2286 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) {
2266 collector_->VerifyThreadUsageAndResultsMerging(); 2287 collector_->VerifyThreadUsageAndResultsMerging();
2267 } 2288 }
2268 2289
2269 } // namespace 2290 } // namespace
2270 2291
2271 } // namespace webrtc 2292 } // namespace webrtc
OLDNEW
« webrtc/p2p/base/port_unittest.cc ('K') | « webrtc/pc/rtcstatscollector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698