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

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

Issue 1337673002: Change WebRTC SslCipher to be exposed as number only. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 2 months 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
« no previous file with comments | « talk/app/webrtc/statscollector.cc ('k') | talk/app/webrtc/umametrics.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 using testing::_; 52 using testing::_;
53 using testing::DoAll; 53 using testing::DoAll;
54 using testing::Field; 54 using testing::Field;
55 using testing::Return; 55 using testing::Return;
56 using testing::ReturnNull; 56 using testing::ReturnNull;
57 using testing::SetArgPointee; 57 using testing::SetArgPointee;
58 using webrtc::PeerConnectionInterface; 58 using webrtc::PeerConnectionInterface;
59 using webrtc::StatsReport; 59 using webrtc::StatsReport;
60 using webrtc::StatsReports; 60 using webrtc::StatsReports;
61 61
62 namespace {
63 // This value comes from openssl/tls1.h
64 const uint16_t TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA = 0xC014;
65 } // namespace
66
62 namespace cricket { 67 namespace cricket {
63 68
64 class ChannelManager; 69 class ChannelManager;
65 70
66 } // namespace cricket 71 } // namespace cricket
67 72
68 namespace webrtc { 73 namespace webrtc {
69 74
70 // Error return values 75 // Error return values
71 const char kNotFound[] = "NOT FOUND"; 76 const char kNotFound[] = "NOT FOUND";
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 const rtc::FakeSSLCertificate& remote_cert, 645 const rtc::FakeSSLCertificate& remote_cert,
641 const std::vector<std::string>& remote_ders) { 646 const std::vector<std::string>& remote_ders) {
642 StatsCollectorForTest stats(&session_); 647 StatsCollectorForTest stats(&session_);
643 648
644 StatsReports reports; // returned values. 649 StatsReports reports; // returned values.
645 650
646 // Fake stats to process. 651 // Fake stats to process.
647 cricket::TransportChannelStats channel_stats; 652 cricket::TransportChannelStats channel_stats;
648 channel_stats.component = 1; 653 channel_stats.component = 1;
649 channel_stats.srtp_cipher = "the-srtp-cipher"; 654 channel_stats.srtp_cipher = "the-srtp-cipher";
650 channel_stats.ssl_cipher = "the-ssl-cipher"; 655 channel_stats.ssl_cipher = TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA;
651 656
652 cricket::TransportStats transport_stats; 657 cricket::TransportStats transport_stats;
653 transport_stats.transport_name = "audio"; 658 transport_stats.transport_name = "audio";
654 transport_stats.channel_stats.push_back(channel_stats); 659 transport_stats.channel_stats.push_back(channel_stats);
655 660
656 cricket::SessionStats session_stats; 661 cricket::SessionStats session_stats;
657 session_stats.transport_stats[transport_stats.transport_name] = 662 session_stats.transport_stats[transport_stats.transport_name] =
658 transport_stats; 663 transport_stats;
659 664
660 // Fake certificate to report 665 // Fake certificate to report
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 CheckCertChainReports(reports, remote_ders, id); 714 CheckCertChainReports(reports, remote_ders, id);
710 } else { 715 } else {
711 EXPECT_EQ(kNotFound, remote_certificate_id); 716 EXPECT_EQ(kNotFound, remote_certificate_id);
712 } 717 }
713 718
714 // Check negotiated ciphers. 719 // Check negotiated ciphers.
715 std::string dtls_cipher = ExtractStatsValue( 720 std::string dtls_cipher = ExtractStatsValue(
716 StatsReport::kStatsReportTypeComponent, 721 StatsReport::kStatsReportTypeComponent,
717 reports, 722 reports,
718 StatsReport::kStatsValueNameDtlsCipher); 723 StatsReport::kStatsValueNameDtlsCipher);
719 EXPECT_EQ("the-ssl-cipher", dtls_cipher); 724 EXPECT_EQ(rtc::SSLStreamAdapter::GetSslCipherSuiteName(
725 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA),
726 dtls_cipher);
720 std::string srtp_cipher = ExtractStatsValue( 727 std::string srtp_cipher = ExtractStatsValue(
721 StatsReport::kStatsReportTypeComponent, 728 StatsReport::kStatsReportTypeComponent,
722 reports, 729 reports,
723 StatsReport::kStatsValueNameSrtpCipher); 730 StatsReport::kStatsValueNameSrtpCipher);
724 EXPECT_EQ("the-srtp-cipher", srtp_cipher); 731 EXPECT_EQ("the-srtp-cipher", srtp_cipher);
725 } 732 }
726 733
727 cricket::FakeMediaEngine* media_engine_; 734 cricket::FakeMediaEngine* media_engine_;
728 rtc::scoped_ptr<cricket::ChannelManager> channel_manager_; 735 rtc::scoped_ptr<cricket::ChannelManager> channel_manager_;
729 MockWebRtcSession session_; 736 MockWebRtcSession session_;
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 cricket::VoiceSenderInfo new_voice_sender_info; 1732 cricket::VoiceSenderInfo new_voice_sender_info;
1726 InitVoiceSenderInfo(&new_voice_sender_info); 1733 InitVoiceSenderInfo(&new_voice_sender_info);
1727 cricket::VoiceMediaInfo new_stats_read; 1734 cricket::VoiceMediaInfo new_stats_read;
1728 reports.clear(); 1735 reports.clear();
1729 SetupAndVerifyAudioTrackStats( 1736 SetupAndVerifyAudioTrackStats(
1730 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, 1737 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName,
1731 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); 1738 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports);
1732 } 1739 }
1733 1740
1734 } // namespace webrtc 1741 } // namespace webrtc
OLDNEW
« no previous file with comments | « talk/app/webrtc/statscollector.cc ('k') | talk/app/webrtc/umametrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698