| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 : WebRtcSession(channel_manager, | 88 : WebRtcSession(channel_manager, |
| 89 rtc::Thread::Current(), | 89 rtc::Thread::Current(), |
| 90 rtc::Thread::Current(), | 90 rtc::Thread::Current(), |
| 91 nullptr) {} | 91 nullptr) {} |
| 92 MOCK_METHOD0(voice_channel, cricket::VoiceChannel*()); | 92 MOCK_METHOD0(voice_channel, cricket::VoiceChannel*()); |
| 93 MOCK_METHOD0(video_channel, cricket::VideoChannel*()); | 93 MOCK_METHOD0(video_channel, cricket::VideoChannel*()); |
| 94 // Libjingle uses "local" for a outgoing track, and "remote" for a incoming | 94 // Libjingle uses "local" for a outgoing track, and "remote" for a incoming |
| 95 // track. | 95 // track. |
| 96 MOCK_METHOD2(GetLocalTrackIdBySsrc, bool(uint32_t, std::string*)); | 96 MOCK_METHOD2(GetLocalTrackIdBySsrc, bool(uint32_t, std::string*)); |
| 97 MOCK_METHOD2(GetRemoteTrackIdBySsrc, bool(uint32_t, std::string*)); | 97 MOCK_METHOD2(GetRemoteTrackIdBySsrc, bool(uint32_t, std::string*)); |
| 98 MOCK_METHOD1(GetTransportStats, bool(cricket::SessionStats*)); | 98 MOCK_METHOD1(GetTransportStats, bool(SessionStats*)); |
| 99 MOCK_METHOD2(GetLocalCertificate, | 99 MOCK_METHOD2(GetLocalCertificate, |
| 100 bool(const std::string& transport_name, | 100 bool(const std::string& transport_name, |
| 101 rtc::scoped_refptr<rtc::RTCCertificate>* certificate)); | 101 rtc::scoped_refptr<rtc::RTCCertificate>* certificate)); |
| 102 MOCK_METHOD2(GetRemoteSSLCertificate, | 102 MOCK_METHOD2(GetRemoteSSLCertificate, |
| 103 bool(const std::string& transport_name, | 103 bool(const std::string& transport_name, |
| 104 rtc::SSLCertificate** cert)); | 104 rtc::SSLCertificate** cert)); |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 // The factory isn't really used; it just satisfies the base PeerConnection. | 107 // The factory isn't really used; it just satisfies the base PeerConnection. |
| 108 class FakePeerConnectionFactory | 108 class FakePeerConnectionFactory |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 // Fake stats to process. | 680 // Fake stats to process. |
| 681 cricket::TransportChannelStats channel_stats; | 681 cricket::TransportChannelStats channel_stats; |
| 682 channel_stats.component = 1; | 682 channel_stats.component = 1; |
| 683 channel_stats.srtp_cipher = "the-srtp-cipher"; | 683 channel_stats.srtp_cipher = "the-srtp-cipher"; |
| 684 channel_stats.ssl_cipher = TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA; | 684 channel_stats.ssl_cipher = TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA; |
| 685 | 685 |
| 686 cricket::TransportStats transport_stats; | 686 cricket::TransportStats transport_stats; |
| 687 transport_stats.transport_name = "audio"; | 687 transport_stats.transport_name = "audio"; |
| 688 transport_stats.channel_stats.push_back(channel_stats); | 688 transport_stats.channel_stats.push_back(channel_stats); |
| 689 | 689 |
| 690 cricket::SessionStats session_stats; | 690 SessionStats session_stats; |
| 691 session_stats.transport_stats[transport_stats.transport_name] = | 691 session_stats.transport_stats[transport_stats.transport_name] = |
| 692 transport_stats; | 692 transport_stats; |
| 693 | 693 |
| 694 // Fake certificate to report | 694 // Fake certificate to report |
| 695 rtc::scoped_refptr<rtc::RTCCertificate> local_certificate( | 695 rtc::scoped_refptr<rtc::RTCCertificate> local_certificate( |
| 696 rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::FakeSSLIdentity>( | 696 rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::FakeSSLIdentity>( |
| 697 new rtc::FakeSSLIdentity(local_cert)) | 697 new rtc::FakeSSLIdentity(local_cert)) |
| 698 .Pass())); | 698 .Pass())); |
| 699 | 699 |
| 700 // Configure MockWebRtcSession | 700 // Configure MockWebRtcSession |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 reports, | 756 reports, |
| 757 StatsReport::kStatsValueNameSrtpCipher); | 757 StatsReport::kStatsValueNameSrtpCipher); |
| 758 EXPECT_EQ("the-srtp-cipher", srtp_cipher); | 758 EXPECT_EQ("the-srtp-cipher", srtp_cipher); |
| 759 } | 759 } |
| 760 | 760 |
| 761 cricket::FakeMediaEngine* media_engine_; | 761 cricket::FakeMediaEngine* media_engine_; |
| 762 rtc::scoped_ptr<cricket::ChannelManager> channel_manager_; | 762 rtc::scoped_ptr<cricket::ChannelManager> channel_manager_; |
| 763 MockWebRtcSession session_; | 763 MockWebRtcSession session_; |
| 764 MockPeerConnection pc_; | 764 MockPeerConnection pc_; |
| 765 FakeDataChannelProvider data_channel_provider_; | 765 FakeDataChannelProvider data_channel_provider_; |
| 766 cricket::SessionStats session_stats_; | 766 SessionStats session_stats_; |
| 767 rtc::scoped_refptr<webrtc::MediaStream> stream_; | 767 rtc::scoped_refptr<webrtc::MediaStream> stream_; |
| 768 rtc::scoped_refptr<webrtc::VideoTrack> track_; | 768 rtc::scoped_refptr<webrtc::VideoTrack> track_; |
| 769 rtc::scoped_refptr<FakeAudioTrack> audio_track_; | 769 rtc::scoped_refptr<FakeAudioTrack> audio_track_; |
| 770 std::vector<rtc::scoped_refptr<DataChannel>> data_channels_; | 770 std::vector<rtc::scoped_refptr<DataChannel>> data_channels_; |
| 771 }; | 771 }; |
| 772 | 772 |
| 773 // Verify that ExtractDataInfo populates reports. | 773 // Verify that ExtractDataInfo populates reports. |
| 774 TEST_F(StatsCollectorTest, ExtractDataInfo) { | 774 TEST_F(StatsCollectorTest, ExtractDataInfo) { |
| 775 const std::string label = "hacks"; | 775 const std::string label = "hacks"; |
| 776 const int id = 31337; | 776 const int id = 31337; |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 StatsReports reports; // returned values. | 1369 StatsReports reports; // returned values. |
| 1370 | 1370 |
| 1371 // Fake stats to process. | 1371 // Fake stats to process. |
| 1372 cricket::TransportChannelStats channel_stats; | 1372 cricket::TransportChannelStats channel_stats; |
| 1373 channel_stats.component = 1; | 1373 channel_stats.component = 1; |
| 1374 | 1374 |
| 1375 cricket::TransportStats transport_stats; | 1375 cricket::TransportStats transport_stats; |
| 1376 transport_stats.transport_name = "audio"; | 1376 transport_stats.transport_name = "audio"; |
| 1377 transport_stats.channel_stats.push_back(channel_stats); | 1377 transport_stats.channel_stats.push_back(channel_stats); |
| 1378 | 1378 |
| 1379 cricket::SessionStats session_stats; | 1379 SessionStats session_stats; |
| 1380 session_stats.transport_stats[transport_stats.transport_name] = | 1380 session_stats.transport_stats[transport_stats.transport_name] = |
| 1381 transport_stats; | 1381 transport_stats; |
| 1382 | 1382 |
| 1383 // Configure MockWebRtcSession | 1383 // Configure MockWebRtcSession |
| 1384 EXPECT_CALL(session_, GetTransportStats(_)) | 1384 EXPECT_CALL(session_, GetTransportStats(_)) |
| 1385 .WillOnce(DoAll(SetArgPointee<0>(session_stats), | 1385 .WillOnce(DoAll(SetArgPointee<0>(session_stats), |
| 1386 Return(true))); | 1386 Return(true))); |
| 1387 | 1387 |
| 1388 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); | 1388 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); |
| 1389 stats.GetStats(NULL, &reports); | 1389 stats.GetStats(NULL, &reports); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 StatsReports reports; // returned values. | 1428 StatsReports reports; // returned values. |
| 1429 | 1429 |
| 1430 // Fake stats to process. | 1430 // Fake stats to process. |
| 1431 cricket::TransportChannelStats channel_stats; | 1431 cricket::TransportChannelStats channel_stats; |
| 1432 channel_stats.component = 1; | 1432 channel_stats.component = 1; |
| 1433 | 1433 |
| 1434 cricket::TransportStats transport_stats; | 1434 cricket::TransportStats transport_stats; |
| 1435 transport_stats.transport_name = "audio"; | 1435 transport_stats.transport_name = "audio"; |
| 1436 transport_stats.channel_stats.push_back(channel_stats); | 1436 transport_stats.channel_stats.push_back(channel_stats); |
| 1437 | 1437 |
| 1438 cricket::SessionStats session_stats; | 1438 SessionStats session_stats; |
| 1439 session_stats.transport_stats[transport_stats.transport_name] = | 1439 session_stats.transport_stats[transport_stats.transport_name] = |
| 1440 transport_stats; | 1440 transport_stats; |
| 1441 | 1441 |
| 1442 // Fake transport object. | 1442 // Fake transport object. |
| 1443 rtc::scoped_ptr<cricket::FakeTransport> transport( | 1443 rtc::scoped_ptr<cricket::FakeTransport> transport( |
| 1444 new cricket::FakeTransport(transport_stats.transport_name)); | 1444 new cricket::FakeTransport(transport_stats.transport_name)); |
| 1445 | 1445 |
| 1446 // Configure MockWebRtcSession | 1446 // Configure MockWebRtcSession |
| 1447 EXPECT_CALL(session_, GetTransportStats(_)) | 1447 EXPECT_CALL(session_, GetTransportStats(_)) |
| 1448 .WillOnce(DoAll(SetArgPointee<0>(session_stats), | 1448 .WillOnce(DoAll(SetArgPointee<0>(session_stats), |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1740 cricket::VoiceSenderInfo new_voice_sender_info; | 1740 cricket::VoiceSenderInfo new_voice_sender_info; |
| 1741 InitVoiceSenderInfo(&new_voice_sender_info); | 1741 InitVoiceSenderInfo(&new_voice_sender_info); |
| 1742 cricket::VoiceMediaInfo new_stats_read; | 1742 cricket::VoiceMediaInfo new_stats_read; |
| 1743 reports.clear(); | 1743 reports.clear(); |
| 1744 SetupAndVerifyAudioTrackStats( | 1744 SetupAndVerifyAudioTrackStats( |
| 1745 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, | 1745 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, |
| 1746 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); | 1746 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); |
| 1747 } | 1747 } |
| 1748 | 1748 |
| 1749 } // namespace webrtc | 1749 } // namespace webrtc |
| OLD | NEW |