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 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1256 | 1256 |
1257 // Mock the session to return the desired candidates. | 1257 // Mock the session to return the desired candidates. |
1258 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( | 1258 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( |
1259 [&session_stats](const ChannelNamePairs&) { | 1259 [&session_stats](const ChannelNamePairs&) { |
1260 return std::unique_ptr<SessionStats>(new SessionStats(session_stats)); | 1260 return std::unique_ptr<SessionStats>(new SessionStats(session_stats)); |
1261 })); | 1261 })); |
1262 | 1262 |
1263 // Mock the session to return bandwidth estimation info. These should only | 1263 // Mock the session to return bandwidth estimation info. These should only |
1264 // be used for a selected candidate pair. | 1264 // be used for a selected candidate pair. |
1265 cricket::VideoMediaInfo video_media_info; | 1265 cricket::VideoMediaInfo video_media_info; |
1266 video_media_info.bw_estimations.push_back(cricket::BandwidthEstimationInfo()); | |
1267 video_media_info.bw_estimations[0].available_send_bandwidth = 8888; | |
1268 video_media_info.bw_estimations[0].available_recv_bandwidth = 9999; | |
1269 EXPECT_CALL(*video_media_channel, GetStats(_)) | 1266 EXPECT_CALL(*video_media_channel, GetStats(_)) |
1270 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); | 1267 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); |
1271 EXPECT_CALL(test_->session(), video_channel()) | 1268 EXPECT_CALL(test_->session(), video_channel()) |
1272 .WillRepeatedly(Return(&video_channel)); | 1269 .WillRepeatedly(Return(&video_channel)); |
1273 | 1270 |
1274 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 1271 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
1275 | 1272 |
1276 RTCIceCandidatePairStats expected_pair("RTCIceCandidatePair_" + | 1273 RTCIceCandidatePairStats expected_pair("RTCIceCandidatePair_" + |
1277 local_candidate->id() + "_" + | 1274 local_candidate->id() + "_" + |
1278 remote_candidate->id(), | 1275 remote_candidate->id(), |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1338 EXPECT_EQ( | 1335 EXPECT_EQ( |
1339 expected_pair, | 1336 expected_pair, |
1340 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>()); | 1337 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>()); |
1341 EXPECT_TRUE(report->Get(*expected_pair.transport_id)); | 1338 EXPECT_TRUE(report->Get(*expected_pair.transport_id)); |
1342 | 1339 |
1343 // Make pair the current pair, clear bandwidth and "GetStats" again. | 1340 // Make pair the current pair, clear bandwidth and "GetStats" again. |
1344 session_stats.transport_stats["transport"] | 1341 session_stats.transport_stats["transport"] |
1345 .channel_stats[0] | 1342 .channel_stats[0] |
1346 .connection_infos[0] | 1343 .connection_infos[0] |
1347 .best_connection = true; | 1344 .best_connection = true; |
1348 video_media_info.bw_estimations[0].available_send_bandwidth = 0; | 1345 // video_media_info.bw_estimations[0].available_send_bandwidth = 0; |
1349 video_media_info.bw_estimations[0].available_recv_bandwidth = 0; | 1346 // video_media_info.bw_estimations[0].available_recv_bandwidth = 0; |
Taylor Brandstetter
2017/05/07 21:30:44
Remember to remove this before landing
stefan-webrtc
2017/05/08 07:12:57
Done.
| |
1350 EXPECT_CALL(*video_media_channel, GetStats(_)) | 1347 EXPECT_CALL(*video_media_channel, GetStats(_)) |
1351 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); | 1348 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); |
1352 collector_->ClearCachedStatsReport(); | 1349 collector_->ClearCachedStatsReport(); |
1353 report = GetStatsReport(); | 1350 report = GetStatsReport(); |
1354 // |expected_pair.available_[outgoing/incoming]_bitrate| should still be | 1351 // |expected_pair.available_[outgoing/incoming]_bitrate| should still be |
1355 // undefined because bandwidth is not set. | 1352 // undefined because bandwidth is not set. |
1356 ASSERT_TRUE(report->Get(expected_pair.id())); | 1353 ASSERT_TRUE(report->Get(expected_pair.id())); |
1357 EXPECT_EQ( | 1354 EXPECT_EQ( |
1358 expected_pair, | 1355 expected_pair, |
1359 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>()); | 1356 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>()); |
1360 EXPECT_TRUE(report->Get(*expected_pair.transport_id)); | 1357 EXPECT_TRUE(report->Get(*expected_pair.transport_id)); |
1361 | 1358 |
1362 // Set bandwidth and "GetStats" again. | 1359 // Set bandwidth and "GetStats" again. |
1363 video_media_info.bw_estimations[0].available_send_bandwidth = 888; | 1360 webrtc::Call::Stats call_stats; |
1364 video_media_info.bw_estimations[0].available_recv_bandwidth = 999; | 1361 const int kSendBandwidth = 888; |
1362 call_stats.send_bandwidth_bps = kSendBandwidth; | |
1363 const int kRecvBandwidth = 999; | |
1364 call_stats.recv_bandwidth_bps = kRecvBandwidth; | |
1365 EXPECT_CALL(test_->session(), GetCallStats()) | |
1366 .WillRepeatedly(Return(call_stats)); | |
1365 EXPECT_CALL(*video_media_channel, GetStats(_)) | 1367 EXPECT_CALL(*video_media_channel, GetStats(_)) |
1366 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); | 1368 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); |
1367 collector_->ClearCachedStatsReport(); | 1369 collector_->ClearCachedStatsReport(); |
1368 report = GetStatsReport(); | 1370 report = GetStatsReport(); |
1369 expected_pair.available_outgoing_bitrate = 888; | 1371 expected_pair.available_outgoing_bitrate = kSendBandwidth; |
1370 expected_pair.available_incoming_bitrate = 999; | 1372 expected_pair.available_incoming_bitrate = kRecvBandwidth; |
1371 ASSERT_TRUE(report->Get(expected_pair.id())); | 1373 ASSERT_TRUE(report->Get(expected_pair.id())); |
1372 EXPECT_EQ( | 1374 EXPECT_EQ( |
1373 expected_pair, | 1375 expected_pair, |
1374 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>()); | 1376 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>()); |
1375 EXPECT_TRUE(report->Get(*expected_pair.transport_id)); | 1377 EXPECT_TRUE(report->Get(*expected_pair.transport_id)); |
1376 | 1378 |
1377 RTCLocalIceCandidateStats expected_local_candidate( | 1379 RTCLocalIceCandidateStats expected_local_candidate( |
1378 *expected_pair.local_candidate_id, report->timestamp_us()); | 1380 *expected_pair.local_candidate_id, report->timestamp_us()); |
1379 expected_local_candidate.transport_id = *expected_pair.transport_id; | 1381 expected_local_candidate.transport_id = *expected_pair.transport_id; |
1380 expected_local_candidate.ip = "42.42.42.42"; | 1382 expected_local_candidate.ip = "42.42.42.42"; |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2313 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; | 2315 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; |
2314 }; | 2316 }; |
2315 | 2317 |
2316 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { | 2318 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { |
2317 collector_->VerifyThreadUsageAndResultsMerging(); | 2319 collector_->VerifyThreadUsageAndResultsMerging(); |
2318 } | 2320 } |
2319 | 2321 |
2320 } // namespace | 2322 } // namespace |
2321 | 2323 |
2322 } // namespace webrtc | 2324 } // namespace webrtc |
OLD | NEW |