OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 .WillRepeatedly(Return(false)); | 796 .WillRepeatedly(Return(false)); |
797 | 797 |
798 const char kVideoChannelName[] = "video"; | 798 const char kVideoChannelName[] = "video"; |
799 | 799 |
800 InitSessionStats(kVideoChannelName); | 800 InitSessionStats(kVideoChannelName); |
801 EXPECT_CALL(session_, GetTransportStats(_)) | 801 EXPECT_CALL(session_, GetTransportStats(_)) |
802 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats_), | 802 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats_), |
803 Return(true))); | 803 Return(true))); |
804 | 804 |
805 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); | 805 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); |
806 cricket::VideoChannel video_channel(rtc::Thread::Current(), | 806 cricket::VideoChannel video_channel(rtc::Thread::Current(), media_channel, |
807 media_channel, NULL, kVideoChannelName, false); | 807 nullptr, kVideoChannelName, false); |
808 StatsReports reports; // returned values. | 808 StatsReports reports; // returned values. |
809 cricket::VideoSenderInfo video_sender_info; | 809 cricket::VideoSenderInfo video_sender_info; |
810 cricket::VideoMediaInfo stats_read; | 810 cricket::VideoMediaInfo stats_read; |
811 // The number of bytes must be larger than 0xFFFFFFFF for this test. | 811 // The number of bytes must be larger than 0xFFFFFFFF for this test. |
812 const int64_t kBytesSent = 12345678901234LL; | 812 const int64_t kBytesSent = 12345678901234LL; |
813 const std::string kBytesSentString("12345678901234"); | 813 const std::string kBytesSentString("12345678901234"); |
814 | 814 |
815 AddOutgoingVideoTrackStats(); | 815 AddOutgoingVideoTrackStats(); |
816 stats.AddStream(stream_); | 816 stats.AddStream(stream_); |
817 | 817 |
(...skipping 24 matching lines...) Expand all Loading... |
842 .WillRepeatedly(Return(false)); | 842 .WillRepeatedly(Return(false)); |
843 | 843 |
844 const char kVideoChannelName[] = "video"; | 844 const char kVideoChannelName[] = "video"; |
845 | 845 |
846 InitSessionStats(kVideoChannelName); | 846 InitSessionStats(kVideoChannelName); |
847 EXPECT_CALL(session_, GetTransportStats(_)) | 847 EXPECT_CALL(session_, GetTransportStats(_)) |
848 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats_), | 848 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats_), |
849 Return(true))); | 849 Return(true))); |
850 | 850 |
851 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); | 851 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); |
852 cricket::VideoChannel video_channel(rtc::Thread::Current(), | 852 cricket::VideoChannel video_channel(rtc::Thread::Current(), media_channel, |
853 media_channel, NULL, kVideoChannelName, false); | 853 nullptr, kVideoChannelName, false); |
854 | 854 |
855 StatsReports reports; // returned values. | 855 StatsReports reports; // returned values. |
856 cricket::VideoSenderInfo video_sender_info; | 856 cricket::VideoSenderInfo video_sender_info; |
857 cricket::VideoMediaInfo stats_read; | 857 cricket::VideoMediaInfo stats_read; |
858 // Set up an SSRC just to test that we get both kinds of stats back: SSRC and | 858 // Set up an SSRC just to test that we get both kinds of stats back: SSRC and |
859 // BWE. | 859 // BWE. |
860 const int64_t kBytesSent = 12345678901234LL; | 860 const int64_t kBytesSent = 12345678901234LL; |
861 const std::string kBytesSentString("12345678901234"); | 861 const std::string kBytesSentString("12345678901234"); |
862 | 862 |
863 AddOutgoingVideoTrackStats(); | 863 AddOutgoingVideoTrackStats(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 reports, StatsReport::kStatsReportTypeSession, 2); | 921 reports, StatsReport::kStatsReportTypeSession, 2); |
922 EXPECT_EQ(NULL, session_report); | 922 EXPECT_EQ(NULL, session_report); |
923 } | 923 } |
924 | 924 |
925 // This test verifies that the empty track report exists in the returned stats | 925 // This test verifies that the empty track report exists in the returned stats |
926 // without calling StatsCollector::UpdateStats. | 926 // without calling StatsCollector::UpdateStats. |
927 TEST_F(StatsCollectorTest, TrackObjectExistsWithoutUpdateStats) { | 927 TEST_F(StatsCollectorTest, TrackObjectExistsWithoutUpdateStats) { |
928 StatsCollectorForTest stats(&session_); | 928 StatsCollectorForTest stats(&session_); |
929 | 929 |
930 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); | 930 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); |
931 cricket::VideoChannel video_channel(rtc::Thread::Current(), | 931 cricket::VideoChannel video_channel(rtc::Thread::Current(), media_channel, |
932 media_channel, NULL, "video", false); | 932 nullptr, "video", false); |
933 AddOutgoingVideoTrackStats(); | 933 AddOutgoingVideoTrackStats(); |
934 stats.AddStream(stream_); | 934 stats.AddStream(stream_); |
935 | 935 |
936 // Verfies the existence of the track report. | 936 // Verfies the existence of the track report. |
937 StatsReports reports; | 937 StatsReports reports; |
938 stats.GetStats(NULL, &reports); | 938 stats.GetStats(NULL, &reports); |
939 EXPECT_EQ((size_t)1, reports.size()); | 939 EXPECT_EQ((size_t)1, reports.size()); |
940 EXPECT_EQ(StatsReport::kStatsReportTypeTrack, reports[0]->type()); | 940 EXPECT_EQ(StatsReport::kStatsReportTypeTrack, reports[0]->type()); |
941 EXPECT_EQ(0, reports[0]->timestamp()); | 941 EXPECT_EQ(0, reports[0]->timestamp()); |
942 | 942 |
(...skipping 14 matching lines...) Expand all Loading... |
957 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) | 957 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) |
958 .WillRepeatedly(Return(false)); | 958 .WillRepeatedly(Return(false)); |
959 | 959 |
960 const char kVideoChannelName[] = "video"; | 960 const char kVideoChannelName[] = "video"; |
961 InitSessionStats(kVideoChannelName); | 961 InitSessionStats(kVideoChannelName); |
962 EXPECT_CALL(session_, GetTransportStats(_)) | 962 EXPECT_CALL(session_, GetTransportStats(_)) |
963 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats_), | 963 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats_), |
964 Return(true))); | 964 Return(true))); |
965 | 965 |
966 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); | 966 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); |
967 cricket::VideoChannel video_channel(rtc::Thread::Current(), | 967 cricket::VideoChannel video_channel(rtc::Thread::Current(), media_channel, |
968 media_channel, NULL, kVideoChannelName, false); | 968 nullptr, kVideoChannelName, false); |
969 AddOutgoingVideoTrackStats(); | 969 AddOutgoingVideoTrackStats(); |
970 stats.AddStream(stream_); | 970 stats.AddStream(stream_); |
971 | 971 |
972 // Constructs an ssrc stats update. | 972 // Constructs an ssrc stats update. |
973 cricket::VideoSenderInfo video_sender_info; | 973 cricket::VideoSenderInfo video_sender_info; |
974 cricket::VideoMediaInfo stats_read; | 974 cricket::VideoMediaInfo stats_read; |
975 const int64_t kBytesSent = 12345678901234LL; | 975 const int64_t kBytesSent = 12345678901234LL; |
976 | 976 |
977 // Construct a stats value to read. | 977 // Construct a stats value to read. |
978 video_sender_info.add_ssrc(1234); | 978 video_sender_info.add_ssrc(1234); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 StatsCollectorForTest stats(&session_); | 1021 StatsCollectorForTest stats(&session_); |
1022 | 1022 |
1023 EXPECT_CALL(session_, GetLocalCertificate(_, _)) | 1023 EXPECT_CALL(session_, GetLocalCertificate(_, _)) |
1024 .WillRepeatedly(Return(false)); | 1024 .WillRepeatedly(Return(false)); |
1025 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) | 1025 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) |
1026 .WillRepeatedly(Return(false)); | 1026 .WillRepeatedly(Return(false)); |
1027 | 1027 |
1028 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); | 1028 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); |
1029 // The transport_name known by the video channel. | 1029 // The transport_name known by the video channel. |
1030 const std::string kVcName("vcname"); | 1030 const std::string kVcName("vcname"); |
1031 cricket::VideoChannel video_channel(rtc::Thread::Current(), | 1031 cricket::VideoChannel video_channel(rtc::Thread::Current(), media_channel, |
1032 media_channel, NULL, kVcName, false); | 1032 nullptr, kVcName, false); |
1033 AddOutgoingVideoTrackStats(); | 1033 AddOutgoingVideoTrackStats(); |
1034 stats.AddStream(stream_); | 1034 stats.AddStream(stream_); |
1035 | 1035 |
1036 // Constructs an ssrc stats update. | 1036 // Constructs an ssrc stats update. |
1037 cricket::VideoSenderInfo video_sender_info; | 1037 cricket::VideoSenderInfo video_sender_info; |
1038 cricket::VideoMediaInfo stats_read; | 1038 cricket::VideoMediaInfo stats_read; |
1039 const int64_t kBytesSent = 12345678901234LL; | 1039 const int64_t kBytesSent = 12345678901234LL; |
1040 | 1040 |
1041 // Construct a stats value to read. | 1041 // Construct a stats value to read. |
1042 video_sender_info.add_ssrc(1234); | 1042 video_sender_info.add_ssrc(1234); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 } | 1079 } |
1080 | 1080 |
1081 // This test verifies that a remote stats object will not be created for | 1081 // This test verifies that a remote stats object will not be created for |
1082 // an outgoing SSRC where remote stats are not returned. | 1082 // an outgoing SSRC where remote stats are not returned. |
1083 TEST_F(StatsCollectorTest, RemoteSsrcInfoIsAbsent) { | 1083 TEST_F(StatsCollectorTest, RemoteSsrcInfoIsAbsent) { |
1084 StatsCollectorForTest stats(&session_); | 1084 StatsCollectorForTest stats(&session_); |
1085 | 1085 |
1086 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); | 1086 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); |
1087 // The transport_name known by the video channel. | 1087 // The transport_name known by the video channel. |
1088 const std::string kVcName("vcname"); | 1088 const std::string kVcName("vcname"); |
1089 cricket::VideoChannel video_channel(rtc::Thread::Current(), | 1089 cricket::VideoChannel video_channel(rtc::Thread::Current(), media_channel, |
1090 media_channel, NULL, kVcName, false); | 1090 nullptr, kVcName, false); |
1091 AddOutgoingVideoTrackStats(); | 1091 AddOutgoingVideoTrackStats(); |
1092 stats.AddStream(stream_); | 1092 stats.AddStream(stream_); |
1093 | 1093 |
1094 EXPECT_CALL(session_, video_channel()).WillRepeatedly(ReturnNull()); | 1094 EXPECT_CALL(session_, video_channel()).WillRepeatedly(ReturnNull()); |
1095 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); | 1095 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); |
1096 | 1096 |
1097 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); | 1097 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); |
1098 StatsReports reports; | 1098 StatsReports reports; |
1099 stats.GetStats(NULL, &reports); | 1099 stats.GetStats(NULL, &reports); |
1100 const StatsReport* remote_report = FindNthReportByType(reports, | 1100 const StatsReport* remote_report = FindNthReportByType(reports, |
1101 StatsReport::kStatsReportTypeRemoteSsrc, 1); | 1101 StatsReport::kStatsReportTypeRemoteSsrc, 1); |
1102 EXPECT_TRUE(remote_report == NULL); | 1102 EXPECT_TRUE(remote_report == NULL); |
1103 } | 1103 } |
1104 | 1104 |
1105 // This test verifies that a remote stats object will be created for | 1105 // This test verifies that a remote stats object will be created for |
1106 // an outgoing SSRC where stats are returned. | 1106 // an outgoing SSRC where stats are returned. |
1107 TEST_F(StatsCollectorTest, RemoteSsrcInfoIsPresent) { | 1107 TEST_F(StatsCollectorTest, RemoteSsrcInfoIsPresent) { |
1108 StatsCollectorForTest stats(&session_); | 1108 StatsCollectorForTest stats(&session_); |
1109 | 1109 |
1110 EXPECT_CALL(session_, GetLocalCertificate(_, _)) | 1110 EXPECT_CALL(session_, GetLocalCertificate(_, _)) |
1111 .WillRepeatedly(Return(false)); | 1111 .WillRepeatedly(Return(false)); |
1112 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) | 1112 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) |
1113 .WillRepeatedly(Return(false)); | 1113 .WillRepeatedly(Return(false)); |
1114 | 1114 |
1115 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); | 1115 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); |
1116 // The transport_name known by the video channel. | 1116 // The transport_name known by the video channel. |
1117 const std::string kVcName("vcname"); | 1117 const std::string kVcName("vcname"); |
1118 cricket::VideoChannel video_channel(rtc::Thread::Current(), | 1118 cricket::VideoChannel video_channel(rtc::Thread::Current(), media_channel, |
1119 media_channel, NULL, kVcName, false); | 1119 nullptr, kVcName, false); |
1120 AddOutgoingVideoTrackStats(); | 1120 AddOutgoingVideoTrackStats(); |
1121 stats.AddStream(stream_); | 1121 stats.AddStream(stream_); |
1122 | 1122 |
1123 // Instruct the session to return stats containing the transport channel. | 1123 // Instruct the session to return stats containing the transport channel. |
1124 InitSessionStats(kVcName); | 1124 InitSessionStats(kVcName); |
1125 EXPECT_CALL(session_, GetTransportStats(_)) | 1125 EXPECT_CALL(session_, GetTransportStats(_)) |
1126 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats_), | 1126 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats_), |
1127 Return(true))); | 1127 Return(true))); |
1128 | 1128 |
1129 // Constructs an ssrc stats update. | 1129 // Constructs an ssrc stats update. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) | 1163 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) |
1164 .WillRepeatedly(Return(false)); | 1164 .WillRepeatedly(Return(false)); |
1165 | 1165 |
1166 const char kVideoChannelName[] = "video"; | 1166 const char kVideoChannelName[] = "video"; |
1167 InitSessionStats(kVideoChannelName); | 1167 InitSessionStats(kVideoChannelName); |
1168 EXPECT_CALL(session_, GetTransportStats(_)) | 1168 EXPECT_CALL(session_, GetTransportStats(_)) |
1169 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats_), | 1169 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats_), |
1170 Return(true))); | 1170 Return(true))); |
1171 | 1171 |
1172 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); | 1172 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel(); |
1173 cricket::VideoChannel video_channel(rtc::Thread::Current(), | 1173 cricket::VideoChannel video_channel(rtc::Thread::Current(), media_channel, |
1174 media_channel, NULL, kVideoChannelName, false); | 1174 nullptr, kVideoChannelName, false); |
1175 AddIncomingVideoTrackStats(); | 1175 AddIncomingVideoTrackStats(); |
1176 stats.AddStream(stream_); | 1176 stats.AddStream(stream_); |
1177 | 1177 |
1178 // Constructs an ssrc stats update. | 1178 // Constructs an ssrc stats update. |
1179 cricket::VideoReceiverInfo video_receiver_info; | 1179 cricket::VideoReceiverInfo video_receiver_info; |
1180 cricket::VideoMediaInfo stats_read; | 1180 cricket::VideoMediaInfo stats_read; |
1181 const int64_t kNumOfPacketsConcealed = 54321; | 1181 const int64_t kNumOfPacketsConcealed = 54321; |
1182 | 1182 |
1183 // Construct a stats value to read. | 1183 // Construct a stats value to read. |
1184 video_receiver_info.add_ssrc(1234); | 1184 video_receiver_info.add_ssrc(1234); |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 StatsCollectorForTest stats(&session_); | 1478 StatsCollectorForTest stats(&session_); |
1479 | 1479 |
1480 EXPECT_CALL(session_, GetLocalCertificate(_, _)) | 1480 EXPECT_CALL(session_, GetLocalCertificate(_, _)) |
1481 .WillRepeatedly(Return(false)); | 1481 .WillRepeatedly(Return(false)); |
1482 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) | 1482 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) |
1483 .WillRepeatedly(Return(false)); | 1483 .WillRepeatedly(Return(false)); |
1484 | 1484 |
1485 MockVoiceMediaChannel* media_channel = new MockVoiceMediaChannel(); | 1485 MockVoiceMediaChannel* media_channel = new MockVoiceMediaChannel(); |
1486 // The transport_name known by the voice channel. | 1486 // The transport_name known by the voice channel. |
1487 const std::string kVcName("vcname"); | 1487 const std::string kVcName("vcname"); |
1488 cricket::VoiceChannel voice_channel(rtc::Thread::Current(), | 1488 cricket::VoiceChannel voice_channel(rtc::Thread::Current(), media_engine_, |
1489 media_engine_, media_channel, NULL, kVcName, false); | 1489 media_channel, nullptr, kVcName, false); |
1490 AddOutgoingAudioTrackStats(); | 1490 AddOutgoingAudioTrackStats(); |
1491 stats.AddStream(stream_); | 1491 stats.AddStream(stream_); |
1492 stats.AddLocalAudioTrack(audio_track_, kSsrcOfTrack); | 1492 stats.AddLocalAudioTrack(audio_track_, kSsrcOfTrack); |
1493 | 1493 |
1494 cricket::VoiceSenderInfo voice_sender_info; | 1494 cricket::VoiceSenderInfo voice_sender_info; |
1495 InitVoiceSenderInfo(&voice_sender_info); | 1495 InitVoiceSenderInfo(&voice_sender_info); |
1496 | 1496 |
1497 cricket::VoiceMediaInfo stats_read; | 1497 cricket::VoiceMediaInfo stats_read; |
1498 StatsReports reports; // returned values. | 1498 StatsReports reports; // returned values. |
1499 SetupAndVerifyAudioTrackStats( | 1499 SetupAndVerifyAudioTrackStats( |
(...skipping 13 matching lines...) Expand all Loading... |
1513 StatsCollectorForTest stats(&session_); | 1513 StatsCollectorForTest stats(&session_); |
1514 | 1514 |
1515 EXPECT_CALL(session_, GetLocalCertificate(_, _)) | 1515 EXPECT_CALL(session_, GetLocalCertificate(_, _)) |
1516 .WillRepeatedly(Return(false)); | 1516 .WillRepeatedly(Return(false)); |
1517 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) | 1517 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) |
1518 .WillRepeatedly(Return(false)); | 1518 .WillRepeatedly(Return(false)); |
1519 | 1519 |
1520 MockVoiceMediaChannel* media_channel = new MockVoiceMediaChannel(); | 1520 MockVoiceMediaChannel* media_channel = new MockVoiceMediaChannel(); |
1521 // The transport_name known by the voice channel. | 1521 // The transport_name known by the voice channel. |
1522 const std::string kVcName("vcname"); | 1522 const std::string kVcName("vcname"); |
1523 cricket::VoiceChannel voice_channel(rtc::Thread::Current(), | 1523 cricket::VoiceChannel voice_channel(rtc::Thread::Current(), media_engine_, |
1524 media_engine_, media_channel, NULL, kVcName, false); | 1524 media_channel, nullptr, kVcName, false); |
1525 AddIncomingAudioTrackStats(); | 1525 AddIncomingAudioTrackStats(); |
1526 stats.AddStream(stream_); | 1526 stats.AddStream(stream_); |
1527 | 1527 |
1528 cricket::VoiceReceiverInfo voice_receiver_info; | 1528 cricket::VoiceReceiverInfo voice_receiver_info; |
1529 InitVoiceReceiverInfo(&voice_receiver_info); | 1529 InitVoiceReceiverInfo(&voice_receiver_info); |
1530 voice_receiver_info.codec_name = "fake_codec"; | 1530 voice_receiver_info.codec_name = "fake_codec"; |
1531 | 1531 |
1532 cricket::VoiceMediaInfo stats_read; | 1532 cricket::VoiceMediaInfo stats_read; |
1533 StatsReports reports; // returned values. | 1533 StatsReports reports; // returned values. |
1534 SetupAndVerifyAudioTrackStats( | 1534 SetupAndVerifyAudioTrackStats( |
1535 audio_track_.get(), stream_.get(), &stats, &voice_channel, kVcName, | 1535 audio_track_.get(), stream_.get(), &stats, &voice_channel, kVcName, |
1536 media_channel, NULL, &voice_receiver_info, &stats_read, &reports); | 1536 media_channel, NULL, &voice_receiver_info, &stats_read, &reports); |
1537 } | 1537 } |
1538 | 1538 |
1539 // This test verifies that a local stats object won't update its statistics | 1539 // This test verifies that a local stats object won't update its statistics |
1540 // after a RemoveLocalAudioTrack() call. | 1540 // after a RemoveLocalAudioTrack() call. |
1541 TEST_F(StatsCollectorTest, GetStatsAfterRemoveAudioStream) { | 1541 TEST_F(StatsCollectorTest, GetStatsAfterRemoveAudioStream) { |
1542 StatsCollectorForTest stats(&session_); | 1542 StatsCollectorForTest stats(&session_); |
1543 | 1543 |
1544 EXPECT_CALL(session_, GetLocalCertificate(_, _)) | 1544 EXPECT_CALL(session_, GetLocalCertificate(_, _)) |
1545 .WillRepeatedly(Return(false)); | 1545 .WillRepeatedly(Return(false)); |
1546 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) | 1546 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) |
1547 .WillRepeatedly(Return(false)); | 1547 .WillRepeatedly(Return(false)); |
1548 | 1548 |
1549 MockVoiceMediaChannel* media_channel = new MockVoiceMediaChannel(); | 1549 MockVoiceMediaChannel* media_channel = new MockVoiceMediaChannel(); |
1550 // The transport_name known by the voice channel. | 1550 // The transport_name known by the voice channel. |
1551 const std::string kVcName("vcname"); | 1551 const std::string kVcName("vcname"); |
1552 cricket::VoiceChannel voice_channel(rtc::Thread::Current(), | 1552 cricket::VoiceChannel voice_channel(rtc::Thread::Current(), media_engine_, |
1553 media_engine_, media_channel, NULL, kVcName, false); | 1553 media_channel, nullptr, kVcName, false); |
1554 AddOutgoingAudioTrackStats(); | 1554 AddOutgoingAudioTrackStats(); |
1555 stats.AddStream(stream_); | 1555 stats.AddStream(stream_); |
1556 stats.AddLocalAudioTrack(audio_track_.get(), kSsrcOfTrack); | 1556 stats.AddLocalAudioTrack(audio_track_.get(), kSsrcOfTrack); |
1557 | 1557 |
1558 // Instruct the session to return stats containing the transport channel. | 1558 // Instruct the session to return stats containing the transport channel. |
1559 InitSessionStats(kVcName); | 1559 InitSessionStats(kVcName); |
1560 EXPECT_CALL(session_, GetTransportStats(_)) | 1560 EXPECT_CALL(session_, GetTransportStats(_)) |
1561 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats_), | 1561 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats_), |
1562 Return(true))); | 1562 Return(true))); |
1563 | 1563 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 StatsCollectorForTest stats(&session_); | 1603 StatsCollectorForTest stats(&session_); |
1604 | 1604 |
1605 EXPECT_CALL(session_, GetLocalCertificate(_, _)) | 1605 EXPECT_CALL(session_, GetLocalCertificate(_, _)) |
1606 .WillRepeatedly(Return(false)); | 1606 .WillRepeatedly(Return(false)); |
1607 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) | 1607 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) |
1608 .WillRepeatedly(Return(false)); | 1608 .WillRepeatedly(Return(false)); |
1609 | 1609 |
1610 MockVoiceMediaChannel* media_channel = new MockVoiceMediaChannel(); | 1610 MockVoiceMediaChannel* media_channel = new MockVoiceMediaChannel(); |
1611 // The transport_name known by the voice channel. | 1611 // The transport_name known by the voice channel. |
1612 const std::string kVcName("vcname"); | 1612 const std::string kVcName("vcname"); |
1613 cricket::VoiceChannel voice_channel(rtc::Thread::Current(), | 1613 cricket::VoiceChannel voice_channel(rtc::Thread::Current(), media_engine_, |
1614 media_engine_, media_channel, NULL, kVcName, false); | 1614 media_channel, nullptr, kVcName, false); |
1615 | 1615 |
1616 // Create a local stream with a local audio track and adds it to the stats. | 1616 // Create a local stream with a local audio track and adds it to the stats. |
1617 AddOutgoingAudioTrackStats(); | 1617 AddOutgoingAudioTrackStats(); |
1618 stats.AddStream(stream_); | 1618 stats.AddStream(stream_); |
1619 stats.AddLocalAudioTrack(audio_track_.get(), kSsrcOfTrack); | 1619 stats.AddLocalAudioTrack(audio_track_.get(), kSsrcOfTrack); |
1620 | 1620 |
1621 // Create a remote stream with a remote audio track and adds it to the stats. | 1621 // Create a remote stream with a remote audio track and adds it to the stats. |
1622 rtc::scoped_refptr<webrtc::MediaStream> remote_stream( | 1622 rtc::scoped_refptr<webrtc::MediaStream> remote_stream( |
1623 webrtc::MediaStream::Create("remotestreamlabel")); | 1623 webrtc::MediaStream::Create("remotestreamlabel")); |
1624 rtc::scoped_refptr<FakeAudioTrack> remote_track( | 1624 rtc::scoped_refptr<FakeAudioTrack> remote_track( |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 StatsCollectorForTest stats(&session_); | 1690 StatsCollectorForTest stats(&session_); |
1691 | 1691 |
1692 EXPECT_CALL(session_, GetLocalCertificate(_, _)) | 1692 EXPECT_CALL(session_, GetLocalCertificate(_, _)) |
1693 .WillRepeatedly(Return(false)); | 1693 .WillRepeatedly(Return(false)); |
1694 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) | 1694 EXPECT_CALL(session_, GetRemoteSSLCertificate(_, _)) |
1695 .WillRepeatedly(Return(false)); | 1695 .WillRepeatedly(Return(false)); |
1696 | 1696 |
1697 MockVoiceMediaChannel* media_channel = new MockVoiceMediaChannel(); | 1697 MockVoiceMediaChannel* media_channel = new MockVoiceMediaChannel(); |
1698 // The transport_name known by the voice channel. | 1698 // The transport_name known by the voice channel. |
1699 const std::string kVcName("vcname"); | 1699 const std::string kVcName("vcname"); |
1700 cricket::VoiceChannel voice_channel(rtc::Thread::Current(), | 1700 cricket::VoiceChannel voice_channel(rtc::Thread::Current(), media_engine_, |
1701 media_engine_, media_channel, NULL, kVcName, false); | 1701 media_channel, nullptr, kVcName, false); |
1702 | 1702 |
1703 // Create a local stream with a local audio track and adds it to the stats. | 1703 // Create a local stream with a local audio track and adds it to the stats. |
1704 AddOutgoingAudioTrackStats(); | 1704 AddOutgoingAudioTrackStats(); |
1705 stats.AddStream(stream_); | 1705 stats.AddStream(stream_); |
1706 stats.AddLocalAudioTrack(audio_track_, kSsrcOfTrack); | 1706 stats.AddLocalAudioTrack(audio_track_, kSsrcOfTrack); |
1707 | 1707 |
1708 cricket::VoiceSenderInfo voice_sender_info; | 1708 cricket::VoiceSenderInfo voice_sender_info; |
1709 voice_sender_info.add_ssrc(kSsrcOfTrack); | 1709 voice_sender_info.add_ssrc(kSsrcOfTrack); |
1710 | 1710 |
1711 cricket::VoiceMediaInfo stats_read; | 1711 cricket::VoiceMediaInfo stats_read; |
(...skipping 19 matching lines...) Expand all Loading... |
1731 cricket::VoiceSenderInfo new_voice_sender_info; | 1731 cricket::VoiceSenderInfo new_voice_sender_info; |
1732 InitVoiceSenderInfo(&new_voice_sender_info); | 1732 InitVoiceSenderInfo(&new_voice_sender_info); |
1733 cricket::VoiceMediaInfo new_stats_read; | 1733 cricket::VoiceMediaInfo new_stats_read; |
1734 reports.clear(); | 1734 reports.clear(); |
1735 SetupAndVerifyAudioTrackStats( | 1735 SetupAndVerifyAudioTrackStats( |
1736 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, | 1736 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, |
1737 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); | 1737 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); |
1738 } | 1738 } |
1739 | 1739 |
1740 } // namespace webrtc | 1740 } // namespace webrtc |
OLD | NEW |