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

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

Issue 2709293004: RTCIceCandidatePairStats.nominated collected. (Closed)
Patch Set: Updated comment 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
« no previous file with comments | « webrtc/pc/rtcstatscollector.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.rtt = 1337;
1245 connection_info.recv_ping_requests = 2020; 1245 connection_info.recv_ping_requests = 2020;
1246 connection_info.sent_ping_requests_total = 2020; 1246 connection_info.sent_ping_requests_total = 2020;
1247 connection_info.sent_ping_requests_before_first_response = 2000; 1247 connection_info.sent_ping_requests_before_first_response = 2000;
1248 connection_info.recv_ping_responses = 4321; 1248 connection_info.recv_ping_responses = 4321;
1249 connection_info.sent_ping_responses = 1000; 1249 connection_info.sent_ping_responses = 1000;
1250 connection_info.state = cricket::IceCandidatePairState::IN_PROGRESS; 1250 connection_info.state = cricket::IceCandidatePairState::IN_PROGRESS;
1251 connection_info.priority = 5555; 1251 connection_info.priority = 5555;
1252 connection_info.nominated = false;
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;
1255 transport_channel_stats.connection_infos.push_back(connection_info); 1256 transport_channel_stats.connection_infos.push_back(connection_info);
1256 session_stats.proxy_to_transport["VideoContentName"] = "transport"; 1257 session_stats.proxy_to_transport["VideoContentName"] = "transport";
1257 session_stats.transport_stats["transport"].transport_name = "transport"; 1258 session_stats.transport_stats["transport"].transport_name = "transport";
1258 session_stats.transport_stats["transport"].channel_stats.push_back( 1259 session_stats.transport_stats["transport"].channel_stats.push_back(
1259 transport_channel_stats); 1260 transport_channel_stats);
1260 1261
1261 // Mock the session to return the desired candidates. 1262 // Mock the session to return the desired candidates.
(...skipping 20 matching lines...) Expand all
1282 remote_candidate->id(), 1283 remote_candidate->id(),
1283 report->timestamp_us()); 1284 report->timestamp_us());
1284 expected_pair.transport_id = 1285 expected_pair.transport_id =
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;
1293 expected_pair.nominated = false;
1292 expected_pair.writable = true; 1294 expected_pair.writable = true;
1293 expected_pair.bytes_sent = 42; 1295 expected_pair.bytes_sent = 42;
1294 expected_pair.bytes_received = 1234; 1296 expected_pair.bytes_received = 1234;
1295 expected_pair.current_round_trip_time = 1.337; 1297 expected_pair.current_round_trip_time = 1.337;
1296 expected_pair.requests_received = 2020; 1298 expected_pair.requests_received = 2020;
1297 expected_pair.requests_sent = 2000; 1299 expected_pair.requests_sent = 2000;
1298 expected_pair.responses_received = 4321; 1300 expected_pair.responses_received = 4321;
1299 expected_pair.responses_sent = 1000; 1301 expected_pair.responses_sent = 1000;
1300 expected_pair.consent_requests_sent = (2020 - 2000); 1302 expected_pair.consent_requests_sent = (2020 - 2000);
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 nominated and "GetStats" again.
1313 session_stats.transport_stats["transport"]
1314 .channel_stats[0]
1315 .connection_infos[0]
1316 .nominated = true;
1317 EXPECT_CALL(*video_media_channel, GetStats(_))
1318 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true)));
1319 collector_->ClearCachedStatsReport();
1320 report = GetStatsReport();
1321 expected_pair.nominated = true;
1322 ASSERT_TRUE(report->Get(expected_pair.id()));
1323 EXPECT_EQ(
1324 expected_pair,
1325 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>());
1326 EXPECT_TRUE(report->Get(*expected_pair.transport_id));
1327
1310 // Make pair the current pair, clear bandwidth and "GetStats" again. 1328 // Make pair the current pair, clear bandwidth and "GetStats" again.
1311 session_stats.transport_stats["transport"] 1329 session_stats.transport_stats["transport"]
1312 .channel_stats[0] 1330 .channel_stats[0]
1313 .connection_infos[0] 1331 .connection_infos[0]
1314 .best_connection = true; 1332 .best_connection = true;
1315 video_media_info.bw_estimations[0].available_send_bandwidth = 0; 1333 video_media_info.bw_estimations[0].available_send_bandwidth = 0;
1316 video_media_info.bw_estimations[0].available_recv_bandwidth = 0; 1334 video_media_info.bw_estimations[0].available_recv_bandwidth = 0;
1317 EXPECT_CALL(*video_media_channel, GetStats(_)) 1335 EXPECT_CALL(*video_media_channel, GetStats(_))
1318 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); 1336 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true)));
1319 collector_->ClearCachedStatsReport(); 1337 collector_->ClearCachedStatsReport();
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; 2280 rtc::scoped_refptr<FakeRTCStatsCollector> collector_;
2263 }; 2281 };
2264 2282
2265 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { 2283 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) {
2266 collector_->VerifyThreadUsageAndResultsMerging(); 2284 collector_->VerifyThreadUsageAndResultsMerging();
2267 } 2285 }
2268 2286
2269 } // namespace 2287 } // namespace
2270 2288
2271 } // namespace webrtc 2289 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/pc/rtcstatscollector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698