Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: talk/app/webrtc/statscollector_unittest.cc

Issue 1416673006: Convert internal representation of Srtp cryptos from string to int. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Add back an old function name to prevent build break in chromium. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 = ExtractStatsValue(
pthatcher1 2015/11/11 19:59:40 Similarly here and below with x_cipher to x_cipher
guoweis_webrtc 2015/11/17 01:21:15 Done.
751 StatsReport::kStatsReportTypeComponent, 751 StatsReport::kStatsReportTypeComponent,
752 reports, 752 reports,
753 StatsReport::kStatsValueNameDtlsCipher); 753 StatsReport::kStatsValueNameDtlsCipher);
754 EXPECT_EQ(rtc::SSLStreamAdapter::GetSslCipherSuiteName( 754 EXPECT_EQ(rtc::SSLStreamAdapter::SslCipherSuiteToName(
755 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA), 755 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA),
756 dtls_cipher); 756 dtls_cipher);
757 std::string srtp_cipher = ExtractStatsValue( 757 std::string srtp_cipher = ExtractStatsValue(
758 StatsReport::kStatsReportTypeComponent, 758 StatsReport::kStatsReportTypeComponent,
759 reports, 759 reports,
760 StatsReport::kStatsValueNameSrtpCipher); 760 StatsReport::kStatsValueNameSrtpCipher);
761 EXPECT_EQ("the-srtp-cipher", srtp_cipher); 761 EXPECT_EQ(rtc::SrtpCryptoSuiteToName(rtc::SRTP_AES128_CM_SHA1_80),
762 srtp_cipher);
762 } 763 }
763 764
764 cricket::FakeMediaEngine* media_engine_; 765 cricket::FakeMediaEngine* media_engine_;
765 rtc::scoped_ptr<cricket::ChannelManager> channel_manager_; 766 rtc::scoped_ptr<cricket::ChannelManager> channel_manager_;
766 rtc::scoped_ptr<webrtc::MediaControllerInterface> media_controller_; 767 rtc::scoped_ptr<webrtc::MediaControllerInterface> media_controller_;
767 MockWebRtcSession session_; 768 MockWebRtcSession session_;
768 MockPeerConnection pc_; 769 MockPeerConnection pc_;
769 FakeDataChannelProvider data_channel_provider_; 770 FakeDataChannelProvider data_channel_provider_;
770 SessionStats session_stats_; 771 SessionStats session_stats_;
771 rtc::scoped_refptr<webrtc::MediaStream> stream_; 772 rtc::scoped_refptr<webrtc::MediaStream> stream_;
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1744 cricket::VoiceSenderInfo new_voice_sender_info; 1745 cricket::VoiceSenderInfo new_voice_sender_info;
1745 InitVoiceSenderInfo(&new_voice_sender_info); 1746 InitVoiceSenderInfo(&new_voice_sender_info);
1746 cricket::VoiceMediaInfo new_stats_read; 1747 cricket::VoiceMediaInfo new_stats_read;
1747 reports.clear(); 1748 reports.clear();
1748 SetupAndVerifyAudioTrackStats( 1749 SetupAndVerifyAudioTrackStats(
1749 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, 1750 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName,
1750 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); 1751 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports);
1751 } 1752 }
1752 1753
1753 } // namespace webrtc 1754 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698