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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 const std::vector<std::string>& local_ders, | 676 const std::vector<std::string>& local_ders, |
677 const rtc::FakeSSLCertificate& remote_cert, | 677 const rtc::FakeSSLCertificate& remote_cert, |
678 const std::vector<std::string>& remote_ders) { | 678 const std::vector<std::string>& remote_ders) { |
679 StatsCollectorForTest stats(&pc_); | 679 StatsCollectorForTest stats(&pc_); |
680 | 680 |
681 StatsReports reports; // returned values. | 681 StatsReports reports; // returned values. |
682 | 682 |
683 // Fake stats to process. | 683 // Fake stats to process. |
684 cricket::TransportChannelStats channel_stats; | 684 cricket::TransportChannelStats channel_stats; |
685 channel_stats.component = 1; | 685 channel_stats.component = 1; |
686 channel_stats.srtp_cipher = "the-srtp-cipher"; | 686 channel_stats.srtp_cipher = rtc::SRTP_AES128_CM_SHA1_80; |
687 channel_stats.ssl_cipher = TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA; | 687 channel_stats.ssl_cipher = TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA; |
688 | 688 |
689 cricket::TransportStats transport_stats; | 689 cricket::TransportStats transport_stats; |
690 transport_stats.transport_name = "audio"; | 690 transport_stats.transport_name = "audio"; |
691 transport_stats.channel_stats.push_back(channel_stats); | 691 transport_stats.channel_stats.push_back(channel_stats); |
692 | 692 |
693 SessionStats session_stats; | 693 SessionStats session_stats; |
694 session_stats.transport_stats[transport_stats.transport_name] = | 694 session_stats.transport_stats[transport_stats.transport_name] = |
695 transport_stats; | 695 transport_stats; |
696 | 696 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 StatsReport::kStatsValueNameRemoteCertificateId); | 740 StatsReport::kStatsValueNameRemoteCertificateId); |
741 if (remote_ders.size() > 0) { | 741 if (remote_ders.size() > 0) { |
742 EXPECT_NE(kNotFound, remote_certificate_id); | 742 EXPECT_NE(kNotFound, remote_certificate_id); |
743 StatsReport::Id id(IdFromCertIdString(remote_certificate_id)); | 743 StatsReport::Id id(IdFromCertIdString(remote_certificate_id)); |
744 CheckCertChainReports(reports, remote_ders, id); | 744 CheckCertChainReports(reports, remote_ders, id); |
745 } else { | 745 } else { |
746 EXPECT_EQ(kNotFound, remote_certificate_id); | 746 EXPECT_EQ(kNotFound, remote_certificate_id); |
747 } | 747 } |
748 | 748 |
749 // Check negotiated ciphers. | 749 // Check negotiated ciphers. |
750 std::string dtls_cipher = ExtractStatsValue( | 750 std::string dtls_cipher_suite = |
751 StatsReport::kStatsReportTypeComponent, | 751 ExtractStatsValue(StatsReport::kStatsReportTypeComponent, reports, |
752 reports, | 752 StatsReport::kStatsValueNameDtlsCipher); |
753 StatsReport::kStatsValueNameDtlsCipher); | 753 EXPECT_EQ(rtc::SSLStreamAdapter::SslCipherSuiteToName( |
754 EXPECT_EQ(rtc::SSLStreamAdapter::GetSslCipherSuiteName( | |
755 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA), | 754 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA), |
756 dtls_cipher); | 755 dtls_cipher_suite); |
757 std::string srtp_cipher = ExtractStatsValue( | 756 std::string srtp_cipher = ExtractStatsValue( |
758 StatsReport::kStatsReportTypeComponent, | 757 StatsReport::kStatsReportTypeComponent, |
759 reports, | 758 reports, |
760 StatsReport::kStatsValueNameSrtpCipher); | 759 StatsReport::kStatsValueNameSrtpCipher); |
761 EXPECT_EQ("the-srtp-cipher", srtp_cipher); | 760 EXPECT_EQ(rtc::SrtpCryptoSuiteToName(rtc::SRTP_AES128_CM_SHA1_80), |
| 761 srtp_cipher); |
762 } | 762 } |
763 | 763 |
764 cricket::FakeMediaEngine* media_engine_; | 764 cricket::FakeMediaEngine* media_engine_; |
765 rtc::scoped_ptr<cricket::ChannelManager> channel_manager_; | 765 rtc::scoped_ptr<cricket::ChannelManager> channel_manager_; |
766 rtc::scoped_ptr<webrtc::MediaControllerInterface> media_controller_; | 766 rtc::scoped_ptr<webrtc::MediaControllerInterface> media_controller_; |
767 MockWebRtcSession session_; | 767 MockWebRtcSession session_; |
768 MockPeerConnection pc_; | 768 MockPeerConnection pc_; |
769 FakeDataChannelProvider data_channel_provider_; | 769 FakeDataChannelProvider data_channel_provider_; |
770 SessionStats session_stats_; | 770 SessionStats session_stats_; |
771 rtc::scoped_refptr<webrtc::MediaStream> stream_; | 771 rtc::scoped_refptr<webrtc::MediaStream> stream_; |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 ASSERT_EQ(kNotFound, local_certificate_id); | 1400 ASSERT_EQ(kNotFound, local_certificate_id); |
1401 | 1401 |
1402 // Check that the remote certificate is absent. | 1402 // Check that the remote certificate is absent. |
1403 std::string remote_certificate_id = ExtractStatsValue( | 1403 std::string remote_certificate_id = ExtractStatsValue( |
1404 StatsReport::kStatsReportTypeComponent, | 1404 StatsReport::kStatsReportTypeComponent, |
1405 reports, | 1405 reports, |
1406 StatsReport::kStatsValueNameRemoteCertificateId); | 1406 StatsReport::kStatsValueNameRemoteCertificateId); |
1407 ASSERT_EQ(kNotFound, remote_certificate_id); | 1407 ASSERT_EQ(kNotFound, remote_certificate_id); |
1408 | 1408 |
1409 // Check that the negotiated ciphers are absent. | 1409 // Check that the negotiated ciphers are absent. |
1410 std::string dtls_cipher = ExtractStatsValue( | 1410 std::string dtls_cipher_suite = |
1411 StatsReport::kStatsReportTypeComponent, | 1411 ExtractStatsValue(StatsReport::kStatsReportTypeComponent, reports, |
1412 reports, | 1412 StatsReport::kStatsValueNameDtlsCipher); |
1413 StatsReport::kStatsValueNameDtlsCipher); | 1413 ASSERT_EQ(kNotFound, dtls_cipher_suite); |
1414 ASSERT_EQ(kNotFound, dtls_cipher); | |
1415 std::string srtp_cipher = ExtractStatsValue( | 1414 std::string srtp_cipher = ExtractStatsValue( |
1416 StatsReport::kStatsReportTypeComponent, | 1415 StatsReport::kStatsReportTypeComponent, |
1417 reports, | 1416 reports, |
1418 StatsReport::kStatsValueNameSrtpCipher); | 1417 StatsReport::kStatsValueNameSrtpCipher); |
1419 ASSERT_EQ(kNotFound, srtp_cipher); | 1418 ASSERT_EQ(kNotFound, srtp_cipher); |
1420 } | 1419 } |
1421 | 1420 |
1422 // This test verifies that the stats are generated correctly when the transport | 1421 // This test verifies that the stats are generated correctly when the transport |
1423 // does not have any certificates. | 1422 // does not have any certificates. |
1424 TEST_F(StatsCollectorTest, NoCertificates) { | 1423 TEST_F(StatsCollectorTest, NoCertificates) { |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1744 cricket::VoiceSenderInfo new_voice_sender_info; | 1743 cricket::VoiceSenderInfo new_voice_sender_info; |
1745 InitVoiceSenderInfo(&new_voice_sender_info); | 1744 InitVoiceSenderInfo(&new_voice_sender_info); |
1746 cricket::VoiceMediaInfo new_stats_read; | 1745 cricket::VoiceMediaInfo new_stats_read; |
1747 reports.clear(); | 1746 reports.clear(); |
1748 SetupAndVerifyAudioTrackStats( | 1747 SetupAndVerifyAudioTrackStats( |
1749 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, | 1748 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, |
1750 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); | 1749 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); |
1751 } | 1750 } |
1752 | 1751 |
1753 } // namespace webrtc | 1752 } // namespace webrtc |
OLD | NEW |