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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 session_(media_controller_.get()), | 306 session_(media_controller_.get()), |
307 pc_() { | 307 pc_() { |
308 // Default return values for mocks. | 308 // Default return values for mocks. |
309 EXPECT_CALL(pc_, local_streams()).WillRepeatedly(Return(nullptr)); | 309 EXPECT_CALL(pc_, local_streams()).WillRepeatedly(Return(nullptr)); |
310 EXPECT_CALL(pc_, remote_streams()).WillRepeatedly(Return(nullptr)); | 310 EXPECT_CALL(pc_, remote_streams()).WillRepeatedly(Return(nullptr)); |
311 EXPECT_CALL(pc_, session()).WillRepeatedly(Return(&session_)); | 311 EXPECT_CALL(pc_, session()).WillRepeatedly(Return(&session_)); |
312 EXPECT_CALL(pc_, sctp_data_channels()).WillRepeatedly( | 312 EXPECT_CALL(pc_, sctp_data_channels()).WillRepeatedly( |
313 ReturnRef(data_channels_)); | 313 ReturnRef(data_channels_)); |
314 EXPECT_CALL(session_, video_channel()).WillRepeatedly(ReturnNull()); | 314 EXPECT_CALL(session_, video_channel()).WillRepeatedly(ReturnNull()); |
315 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); | 315 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); |
316 EXPECT_CALL(session_, GetTransportStats(_)).WillRepeatedly(Return(false)); | 316 EXPECT_CALL(session_, GetStats(_)).WillRepeatedly(ReturnNull()); |
317 EXPECT_CALL(session_, GetLocalCertificate(_, _)).WillRepeatedly( | 317 EXPECT_CALL(session_, GetLocalCertificate(_, _)).WillRepeatedly( |
318 Return(false)); | 318 Return(false)); |
319 EXPECT_CALL(session_, GetRemoteSSLCertificate_ReturnsRawPointer(_)) | 319 EXPECT_CALL(session_, GetRemoteSSLCertificate_ReturnsRawPointer(_)) |
320 .WillRepeatedly(Return(nullptr)); | 320 .WillRepeatedly(Return(nullptr)); |
321 } | 321 } |
322 | 322 |
323 rtc::ScopedFakeClock& fake_clock() { return fake_clock_; } | 323 rtc::ScopedFakeClock& fake_clock() { return fake_clock_; } |
324 rtc::Thread* worker_thread() { return worker_thread_; } | 324 rtc::Thread* worker_thread() { return worker_thread_; } |
325 rtc::Thread* network_thread() { return network_thread_; } | 325 rtc::Thread* network_thread() { return network_thread_; } |
326 cricket::FakeMediaEngine* media_engine() { return media_engine_; } | 326 cricket::FakeMediaEngine* media_engine() { return media_engine_; } |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 | 621 |
622 TEST_F(RTCStatsCollectorTest, CollectRTCCertificateStatsSingle) { | 622 TEST_F(RTCStatsCollectorTest, CollectRTCCertificateStatsSingle) { |
623 std::unique_ptr<CertificateInfo> local_certinfo = | 623 std::unique_ptr<CertificateInfo> local_certinfo = |
624 CreateFakeCertificateAndInfoFromDers( | 624 CreateFakeCertificateAndInfoFromDers( |
625 std::vector<std::string>({ "(local) single certificate" })); | 625 std::vector<std::string>({ "(local) single certificate" })); |
626 std::unique_ptr<CertificateInfo> remote_certinfo = | 626 std::unique_ptr<CertificateInfo> remote_certinfo = |
627 CreateFakeCertificateAndInfoFromDers( | 627 CreateFakeCertificateAndInfoFromDers( |
628 std::vector<std::string>({ "(remote) single certificate" })); | 628 std::vector<std::string>({ "(remote) single certificate" })); |
629 | 629 |
630 // Mock the session to return the local and remote certificates. | 630 // Mock the session to return the local and remote certificates. |
631 EXPECT_CALL(test_->session(), GetTransportStats(_)).WillRepeatedly(Invoke( | 631 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( |
632 [this](SessionStats* stats) { | 632 [this](const ChannelNamePairs&) { |
| 633 std::unique_ptr<SessionStats> stats(new SessionStats()); |
633 stats->transport_stats["transport"].transport_name = "transport"; | 634 stats->transport_stats["transport"].transport_name = "transport"; |
634 return true; | 635 return stats; |
635 })); | 636 })); |
636 EXPECT_CALL(test_->session(), GetLocalCertificate(_, _)).WillRepeatedly( | 637 EXPECT_CALL(test_->session(), GetLocalCertificate(_, _)).WillRepeatedly( |
637 Invoke([this, &local_certinfo](const std::string& transport_name, | 638 Invoke([this, &local_certinfo](const std::string& transport_name, |
638 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) { | 639 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) { |
639 if (transport_name == "transport") { | 640 if (transport_name == "transport") { |
640 *certificate = local_certinfo->certificate; | 641 *certificate = local_certinfo->certificate; |
641 return true; | 642 return true; |
642 } | 643 } |
643 return false; | 644 return false; |
644 })); | 645 })); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 | 707 |
707 EXPECT_CALL(*video_media_channel, GetStats(_)) | 708 EXPECT_CALL(*video_media_channel, GetStats(_)) |
708 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); | 709 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); |
709 | 710 |
710 SessionStats session_stats; | 711 SessionStats session_stats; |
711 session_stats.proxy_to_transport["VoiceContentName"] = "TransportName"; | 712 session_stats.proxy_to_transport["VoiceContentName"] = "TransportName"; |
712 session_stats.proxy_to_transport["VideoContentName"] = "TransportName"; | 713 session_stats.proxy_to_transport["VideoContentName"] = "TransportName"; |
713 session_stats.transport_stats["TransportName"].transport_name = | 714 session_stats.transport_stats["TransportName"].transport_name = |
714 "TransportName"; | 715 "TransportName"; |
715 | 716 |
716 EXPECT_CALL(test_->session(), GetTransportStats(_)) | 717 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( |
717 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats), Return(true))); | 718 [&session_stats](const ChannelNamePairs&) { |
| 719 return std::unique_ptr<SessionStats>(new SessionStats(session_stats)); |
| 720 })); |
718 EXPECT_CALL(test_->session(), voice_channel()) | 721 EXPECT_CALL(test_->session(), voice_channel()) |
719 .WillRepeatedly(Return(&voice_channel)); | 722 .WillRepeatedly(Return(&voice_channel)); |
720 EXPECT_CALL(test_->session(), video_channel()) | 723 EXPECT_CALL(test_->session(), video_channel()) |
721 .WillRepeatedly(Return(&video_channel)); | 724 .WillRepeatedly(Return(&video_channel)); |
722 | 725 |
723 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 726 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
724 | 727 |
725 RTCCodecStats expected_inbound_audio_codec( | 728 RTCCodecStats expected_inbound_audio_codec( |
726 "RTCCodec_InboundAudio_1", report->timestamp_us()); | 729 "RTCCodec_InboundAudio_1", report->timestamp_us()); |
727 expected_inbound_audio_codec.payload_type = 1; | 730 expected_inbound_audio_codec.payload_type = 1; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 std::vector<std::string>({ "(local) video" })); | 787 std::vector<std::string>({ "(local) video" })); |
785 video_local_certinfo = CreateFakeCertificateAndInfoFromDers( | 788 video_local_certinfo = CreateFakeCertificateAndInfoFromDers( |
786 video_local_certinfo->ders); | 789 video_local_certinfo->ders); |
787 std::unique_ptr<CertificateInfo> video_remote_certinfo = | 790 std::unique_ptr<CertificateInfo> video_remote_certinfo = |
788 CreateFakeCertificateAndInfoFromDers( | 791 CreateFakeCertificateAndInfoFromDers( |
789 std::vector<std::string>({ "(remote) video" })); | 792 std::vector<std::string>({ "(remote) video" })); |
790 video_remote_certinfo = CreateFakeCertificateAndInfoFromDers( | 793 video_remote_certinfo = CreateFakeCertificateAndInfoFromDers( |
791 video_remote_certinfo->ders); | 794 video_remote_certinfo->ders); |
792 | 795 |
793 // Mock the session to return the local and remote certificates. | 796 // Mock the session to return the local and remote certificates. |
794 EXPECT_CALL(test_->session(), GetTransportStats(_)).WillRepeatedly(Invoke( | 797 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( |
795 [this](SessionStats* stats) { | 798 [this](const ChannelNamePairs&) { |
| 799 std::unique_ptr<SessionStats> stats(new SessionStats()); |
796 stats->transport_stats["audio"].transport_name = "audio"; | 800 stats->transport_stats["audio"].transport_name = "audio"; |
797 stats->transport_stats["video"].transport_name = "video"; | 801 stats->transport_stats["video"].transport_name = "video"; |
798 return true; | 802 return stats; |
799 })); | 803 })); |
800 EXPECT_CALL(test_->session(), GetLocalCertificate(_, _)).WillRepeatedly( | 804 EXPECT_CALL(test_->session(), GetLocalCertificate(_, _)).WillRepeatedly( |
801 Invoke([this, &audio_local_certinfo, &video_local_certinfo]( | 805 Invoke([this, &audio_local_certinfo, &video_local_certinfo]( |
802 const std::string& transport_name, | 806 const std::string& transport_name, |
803 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) { | 807 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) { |
804 if (transport_name == "audio") { | 808 if (transport_name == "audio") { |
805 *certificate = audio_local_certinfo->certificate; | 809 *certificate = audio_local_certinfo->certificate; |
806 return true; | 810 return true; |
807 } | 811 } |
808 if (transport_name == "video") { | 812 if (transport_name == "video") { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 CreateFakeCertificateAndInfoFromDers(local_ders); | 847 CreateFakeCertificateAndInfoFromDers(local_ders); |
844 std::vector<std::string> remote_ders; | 848 std::vector<std::string> remote_ders; |
845 remote_ders.push_back("(remote) this"); | 849 remote_ders.push_back("(remote) this"); |
846 remote_ders.push_back("(remote) is"); | 850 remote_ders.push_back("(remote) is"); |
847 remote_ders.push_back("(remote) another"); | 851 remote_ders.push_back("(remote) another"); |
848 remote_ders.push_back("(remote) chain"); | 852 remote_ders.push_back("(remote) chain"); |
849 std::unique_ptr<CertificateInfo> remote_certinfo = | 853 std::unique_ptr<CertificateInfo> remote_certinfo = |
850 CreateFakeCertificateAndInfoFromDers(remote_ders); | 854 CreateFakeCertificateAndInfoFromDers(remote_ders); |
851 | 855 |
852 // Mock the session to return the local and remote certificates. | 856 // Mock the session to return the local and remote certificates. |
853 EXPECT_CALL(test_->session(), GetTransportStats(_)).WillRepeatedly(Invoke( | 857 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( |
854 [this](SessionStats* stats) { | 858 [this](const ChannelNamePairs&) { |
| 859 std::unique_ptr<SessionStats> stats(new SessionStats()); |
855 stats->transport_stats["transport"].transport_name = "transport"; | 860 stats->transport_stats["transport"].transport_name = "transport"; |
856 return true; | 861 return stats; |
857 })); | 862 })); |
858 EXPECT_CALL(test_->session(), GetLocalCertificate(_, _)).WillRepeatedly( | 863 EXPECT_CALL(test_->session(), GetLocalCertificate(_, _)).WillRepeatedly( |
859 Invoke([this, &local_certinfo](const std::string& transport_name, | 864 Invoke([this, &local_certinfo](const std::string& transport_name, |
860 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) { | 865 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) { |
861 if (transport_name == "transport") { | 866 if (transport_name == "transport") { |
862 *certificate = local_certinfo->certificate; | 867 *certificate = local_certinfo->certificate; |
863 return true; | 868 return true; |
864 } | 869 } |
865 return false; | 870 return false; |
866 })); | 871 })); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 b_transport_channel_stats.connection_infos.push_back( | 976 b_transport_channel_stats.connection_infos.push_back( |
972 cricket::ConnectionInfo()); | 977 cricket::ConnectionInfo()); |
973 b_transport_channel_stats.connection_infos[0].local_candidate = | 978 b_transport_channel_stats.connection_infos[0].local_candidate = |
974 *b_local.get(); | 979 *b_local.get(); |
975 b_transport_channel_stats.connection_infos[0].remote_candidate = | 980 b_transport_channel_stats.connection_infos[0].remote_candidate = |
976 *b_remote.get(); | 981 *b_remote.get(); |
977 session_stats.transport_stats["b"].channel_stats.push_back( | 982 session_stats.transport_stats["b"].channel_stats.push_back( |
978 b_transport_channel_stats); | 983 b_transport_channel_stats); |
979 | 984 |
980 // Mock the session to return the desired candidates. | 985 // Mock the session to return the desired candidates. |
981 EXPECT_CALL(test_->session(), GetTransportStats(_)).WillRepeatedly(Invoke( | 986 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( |
982 [this, &session_stats](SessionStats* stats) { | 987 [&session_stats](const ChannelNamePairs&) { |
983 *stats = session_stats; | 988 return std::unique_ptr<SessionStats>(new SessionStats(session_stats)); |
984 return true; | |
985 })); | 989 })); |
986 | 990 |
987 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 991 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
988 ExpectReportContainsCandidate(report, *a_local_host.get(), true); | 992 ExpectReportContainsCandidate(report, *a_local_host.get(), true); |
989 ExpectReportContainsCandidate(report, *a_remote_srflx.get(), false); | 993 ExpectReportContainsCandidate(report, *a_remote_srflx.get(), false); |
990 ExpectReportContainsCandidate(report, *a_local_prflx.get(), true); | 994 ExpectReportContainsCandidate(report, *a_local_prflx.get(), true); |
991 ExpectReportContainsCandidate(report, *a_remote_relay.get(), false); | 995 ExpectReportContainsCandidate(report, *a_remote_relay.get(), false); |
992 ExpectReportContainsCandidate(report, *b_local.get(), true); | 996 ExpectReportContainsCandidate(report, *b_local.get(), true); |
993 ExpectReportContainsCandidate(report, *b_remote.get(), false); | 997 ExpectReportContainsCandidate(report, *b_remote.get(), false); |
994 } | 998 } |
(...skipping 20 matching lines...) Expand all Loading... |
1015 connection_info.sent_ping_responses = 1000; | 1019 connection_info.sent_ping_responses = 1000; |
1016 | 1020 |
1017 cricket::TransportChannelStats transport_channel_stats; | 1021 cricket::TransportChannelStats transport_channel_stats; |
1018 transport_channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; | 1022 transport_channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; |
1019 transport_channel_stats.connection_infos.push_back(connection_info); | 1023 transport_channel_stats.connection_infos.push_back(connection_info); |
1020 session_stats.transport_stats["transport"].transport_name = "transport"; | 1024 session_stats.transport_stats["transport"].transport_name = "transport"; |
1021 session_stats.transport_stats["transport"].channel_stats.push_back( | 1025 session_stats.transport_stats["transport"].channel_stats.push_back( |
1022 transport_channel_stats); | 1026 transport_channel_stats); |
1023 | 1027 |
1024 // Mock the session to return the desired candidates. | 1028 // Mock the session to return the desired candidates. |
1025 EXPECT_CALL(test_->session(), GetTransportStats(_)).WillRepeatedly(Invoke( | 1029 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( |
1026 [this, &session_stats](SessionStats* stats) { | 1030 [&session_stats](const ChannelNamePairs&) { |
1027 *stats = session_stats; | 1031 return std::unique_ptr<SessionStats>(new SessionStats(session_stats)); |
1028 return true; | |
1029 })); | 1032 })); |
1030 | 1033 |
1031 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 1034 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
1032 | 1035 |
1033 RTCIceCandidatePairStats expected_pair("RTCIceCandidatePair_" + | 1036 RTCIceCandidatePairStats expected_pair("RTCIceCandidatePair_" + |
1034 local_candidate->id() + "_" + | 1037 local_candidate->id() + "_" + |
1035 remote_candidate->id(), | 1038 remote_candidate->id(), |
1036 report->timestamp_us()); | 1039 report->timestamp_us()); |
1037 expected_pair.transport_id = | 1040 expected_pair.transport_id = |
1038 "RTCTransport_transport_" + | 1041 "RTCTransport_transport_" + |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 session_stats.proxy_to_transport["VoiceContentName"] = "TransportName"; | 1383 session_stats.proxy_to_transport["VoiceContentName"] = "TransportName"; |
1381 session_stats.transport_stats["TransportName"].transport_name = | 1384 session_stats.transport_stats["TransportName"].transport_name = |
1382 "TransportName"; | 1385 "TransportName"; |
1383 | 1386 |
1384 // Make sure the associated |RTCTransportStats| is created. | 1387 // Make sure the associated |RTCTransportStats| is created. |
1385 cricket::TransportChannelStats channel_stats; | 1388 cricket::TransportChannelStats channel_stats; |
1386 channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; | 1389 channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; |
1387 session_stats.transport_stats["TransportName"].channel_stats.push_back( | 1390 session_stats.transport_stats["TransportName"].channel_stats.push_back( |
1388 channel_stats); | 1391 channel_stats); |
1389 | 1392 |
1390 EXPECT_CALL(test_->session(), GetTransportStats(_)) | 1393 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( |
1391 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats), Return(true))); | 1394 [&session_stats](const ChannelNamePairs&) { |
| 1395 return std::unique_ptr<SessionStats>(new SessionStats(session_stats)); |
| 1396 })); |
1392 EXPECT_CALL(test_->session(), voice_channel()) | 1397 EXPECT_CALL(test_->session(), voice_channel()) |
1393 .WillRepeatedly(Return(&voice_channel)); | 1398 .WillRepeatedly(Return(&voice_channel)); |
1394 | 1399 |
1395 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 1400 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
1396 | 1401 |
1397 RTCInboundRTPStreamStats expected_audio( | 1402 RTCInboundRTPStreamStats expected_audio( |
1398 "RTCInboundRTPAudioStream_1", report->timestamp_us()); | 1403 "RTCInboundRTPAudioStream_1", report->timestamp_us()); |
1399 expected_audio.ssrc = "1"; | 1404 expected_audio.ssrc = "1"; |
1400 expected_audio.is_remote = false; | 1405 expected_audio.is_remote = false; |
1401 expected_audio.media_type = "audio"; | 1406 expected_audio.media_type = "audio"; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1452 session_stats.proxy_to_transport["VideoContentName"] = "TransportName"; | 1457 session_stats.proxy_to_transport["VideoContentName"] = "TransportName"; |
1453 session_stats.transport_stats["TransportName"].transport_name = | 1458 session_stats.transport_stats["TransportName"].transport_name = |
1454 "TransportName"; | 1459 "TransportName"; |
1455 | 1460 |
1456 // Make sure the associated |RTCTransportStats| is created. | 1461 // Make sure the associated |RTCTransportStats| is created. |
1457 cricket::TransportChannelStats channel_stats; | 1462 cricket::TransportChannelStats channel_stats; |
1458 channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; | 1463 channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; |
1459 session_stats.transport_stats["TransportName"].channel_stats.push_back( | 1464 session_stats.transport_stats["TransportName"].channel_stats.push_back( |
1460 channel_stats); | 1465 channel_stats); |
1461 | 1466 |
1462 EXPECT_CALL(test_->session(), GetTransportStats(_)) | 1467 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( |
1463 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats), Return(true))); | 1468 [&session_stats](const ChannelNamePairs&) { |
| 1469 return std::unique_ptr<SessionStats>(new SessionStats(session_stats)); |
| 1470 })); |
1464 EXPECT_CALL(test_->session(), video_channel()) | 1471 EXPECT_CALL(test_->session(), video_channel()) |
1465 .WillRepeatedly(Return(&video_channel)); | 1472 .WillRepeatedly(Return(&video_channel)); |
1466 | 1473 |
1467 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 1474 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
1468 | 1475 |
1469 RTCInboundRTPStreamStats expected_video( | 1476 RTCInboundRTPStreamStats expected_video( |
1470 "RTCInboundRTPVideoStream_1", report->timestamp_us()); | 1477 "RTCInboundRTPVideoStream_1", report->timestamp_us()); |
1471 expected_video.ssrc = "1"; | 1478 expected_video.ssrc = "1"; |
1472 expected_video.is_remote = false; | 1479 expected_video.is_remote = false; |
1473 expected_video.media_type = "video"; | 1480 expected_video.media_type = "video"; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 session_stats.proxy_to_transport["VoiceContentName"] = "TransportName"; | 1529 session_stats.proxy_to_transport["VoiceContentName"] = "TransportName"; |
1523 session_stats.transport_stats["TransportName"].transport_name = | 1530 session_stats.transport_stats["TransportName"].transport_name = |
1524 "TransportName"; | 1531 "TransportName"; |
1525 | 1532 |
1526 // Make sure the associated |RTCTransportStats| is created. | 1533 // Make sure the associated |RTCTransportStats| is created. |
1527 cricket::TransportChannelStats channel_stats; | 1534 cricket::TransportChannelStats channel_stats; |
1528 channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; | 1535 channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; |
1529 session_stats.transport_stats["TransportName"].channel_stats.push_back( | 1536 session_stats.transport_stats["TransportName"].channel_stats.push_back( |
1530 channel_stats); | 1537 channel_stats); |
1531 | 1538 |
1532 EXPECT_CALL(test_->session(), GetTransportStats(_)) | 1539 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( |
1533 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats), Return(true))); | 1540 [&session_stats](const ChannelNamePairs&) { |
| 1541 return std::unique_ptr<SessionStats>(new SessionStats(session_stats)); |
| 1542 })); |
1534 EXPECT_CALL(test_->session(), voice_channel()) | 1543 EXPECT_CALL(test_->session(), voice_channel()) |
1535 .WillRepeatedly(Return(&voice_channel)); | 1544 .WillRepeatedly(Return(&voice_channel)); |
1536 | 1545 |
1537 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 1546 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
1538 | 1547 |
1539 RTCOutboundRTPStreamStats expected_audio( | 1548 RTCOutboundRTPStreamStats expected_audio( |
1540 "RTCOutboundRTPAudioStream_1", report->timestamp_us()); | 1549 "RTCOutboundRTPAudioStream_1", report->timestamp_us()); |
1541 expected_audio.ssrc = "1"; | 1550 expected_audio.ssrc = "1"; |
1542 expected_audio.is_remote = false; | 1551 expected_audio.is_remote = false; |
1543 expected_audio.media_type = "audio"; | 1552 expected_audio.media_type = "audio"; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1590 session_stats.proxy_to_transport["VideoContentName"] = "TransportName"; | 1599 session_stats.proxy_to_transport["VideoContentName"] = "TransportName"; |
1591 session_stats.transport_stats["TransportName"].transport_name = | 1600 session_stats.transport_stats["TransportName"].transport_name = |
1592 "TransportName"; | 1601 "TransportName"; |
1593 | 1602 |
1594 // Make sure the associated |RTCTransportStats| is created. | 1603 // Make sure the associated |RTCTransportStats| is created. |
1595 cricket::TransportChannelStats channel_stats; | 1604 cricket::TransportChannelStats channel_stats; |
1596 channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; | 1605 channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; |
1597 session_stats.transport_stats["TransportName"].channel_stats.push_back( | 1606 session_stats.transport_stats["TransportName"].channel_stats.push_back( |
1598 channel_stats); | 1607 channel_stats); |
1599 | 1608 |
1600 EXPECT_CALL(test_->session(), GetTransportStats(_)) | 1609 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( |
1601 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats), Return(true))); | 1610 [&session_stats](const ChannelNamePairs&) { |
| 1611 return std::unique_ptr<SessionStats>(new SessionStats(session_stats)); |
| 1612 })); |
1602 EXPECT_CALL(test_->session(), video_channel()) | 1613 EXPECT_CALL(test_->session(), video_channel()) |
1603 .WillRepeatedly(Return(&video_channel)); | 1614 .WillRepeatedly(Return(&video_channel)); |
1604 | 1615 |
1605 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 1616 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
1606 | 1617 |
1607 RTCOutboundRTPStreamStats expected_video( | 1618 RTCOutboundRTPStreamStats expected_video( |
1608 "RTCOutboundRTPVideoStream_1", report->timestamp_us()); | 1619 "RTCOutboundRTPVideoStream_1", report->timestamp_us()); |
1609 expected_video.ssrc = "1"; | 1620 expected_video.ssrc = "1"; |
1610 expected_video.is_remote = false; | 1621 expected_video.is_remote = false; |
1611 expected_video.media_type = "video"; | 1622 expected_video.media_type = "video"; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1670 session_stats.proxy_to_transport["VideoContentName"] = "TransportName"; | 1681 session_stats.proxy_to_transport["VideoContentName"] = "TransportName"; |
1671 session_stats.transport_stats["TransportName"].transport_name = | 1682 session_stats.transport_stats["TransportName"].transport_name = |
1672 "TransportName"; | 1683 "TransportName"; |
1673 | 1684 |
1674 // Make sure the associated |RTCTransportStats| is created. | 1685 // Make sure the associated |RTCTransportStats| is created. |
1675 cricket::TransportChannelStats channel_stats; | 1686 cricket::TransportChannelStats channel_stats; |
1676 channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; | 1687 channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; |
1677 session_stats.transport_stats["TransportName"].channel_stats.push_back( | 1688 session_stats.transport_stats["TransportName"].channel_stats.push_back( |
1678 channel_stats); | 1689 channel_stats); |
1679 | 1690 |
1680 EXPECT_CALL(test_->session(), GetTransportStats(_)) | 1691 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( |
1681 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats), Return(true))); | 1692 [&session_stats](const ChannelNamePairs&) { |
| 1693 return std::unique_ptr<SessionStats>(new SessionStats(session_stats)); |
| 1694 })); |
1682 EXPECT_CALL(test_->session(), voice_channel()) | 1695 EXPECT_CALL(test_->session(), voice_channel()) |
1683 .WillRepeatedly(Return(&voice_channel)); | 1696 .WillRepeatedly(Return(&voice_channel)); |
1684 EXPECT_CALL(test_->session(), video_channel()) | 1697 EXPECT_CALL(test_->session(), video_channel()) |
1685 .WillRepeatedly(Return(&video_channel)); | 1698 .WillRepeatedly(Return(&video_channel)); |
1686 | 1699 |
1687 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 1700 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
1688 | 1701 |
1689 RTCOutboundRTPStreamStats expected_audio( | 1702 RTCOutboundRTPStreamStats expected_audio( |
1690 "RTCOutboundRTPAudioStream_1", report->timestamp_us()); | 1703 "RTCOutboundRTPAudioStream_1", report->timestamp_us()); |
1691 expected_audio.ssrc = "1"; | 1704 expected_audio.ssrc = "1"; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1747 rtp_connection_info.sent_total_bytes = 42; | 1760 rtp_connection_info.sent_total_bytes = 42; |
1748 rtp_connection_info.recv_total_bytes = 1337; | 1761 rtp_connection_info.recv_total_bytes = 1337; |
1749 cricket::TransportChannelStats rtp_transport_channel_stats; | 1762 cricket::TransportChannelStats rtp_transport_channel_stats; |
1750 rtp_transport_channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; | 1763 rtp_transport_channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; |
1751 rtp_transport_channel_stats.connection_infos.push_back(rtp_connection_info); | 1764 rtp_transport_channel_stats.connection_infos.push_back(rtp_connection_info); |
1752 session_stats.transport_stats["transport"].channel_stats.push_back( | 1765 session_stats.transport_stats["transport"].channel_stats.push_back( |
1753 rtp_transport_channel_stats); | 1766 rtp_transport_channel_stats); |
1754 | 1767 |
1755 | 1768 |
1756 // Mock the session to return the desired candidates. | 1769 // Mock the session to return the desired candidates. |
1757 EXPECT_CALL(test_->session(), GetTransportStats(_)).WillRepeatedly(Invoke( | 1770 EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke( |
1758 [this, &session_stats](SessionStats* stats) { | 1771 [&session_stats](const ChannelNamePairs&) { |
1759 *stats = session_stats; | 1772 return std::unique_ptr<SessionStats>(new SessionStats(session_stats)); |
1760 return true; | |
1761 })); | 1773 })); |
1762 | 1774 |
1763 // Get stats without RTCP, an active connection or certificates. | 1775 // Get stats without RTCP, an active connection or certificates. |
1764 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 1776 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
1765 | 1777 |
1766 RTCTransportStats expected_rtp_transport( | 1778 RTCTransportStats expected_rtp_transport( |
1767 "RTCTransport_transport_" + | 1779 "RTCTransport_transport_" + |
1768 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP), | 1780 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP), |
1769 report->timestamp_us()); | 1781 report->timestamp_us()); |
1770 expected_rtp_transport.bytes_sent = 42; | 1782 expected_rtp_transport.bytes_sent = 42; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1895 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; | 1907 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; |
1896 }; | 1908 }; |
1897 | 1909 |
1898 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { | 1910 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { |
1899 collector_->VerifyThreadUsageAndResultsMerging(); | 1911 collector_->VerifyThreadUsageAndResultsMerging(); |
1900 } | 1912 } |
1901 | 1913 |
1902 } // namespace | 1914 } // namespace |
1903 | 1915 |
1904 } // namespace webrtc | 1916 } // namespace webrtc |
OLD | NEW |