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

Side by Side Diff: talk/session/media/channel_unittest.cc

Issue 1269843005: Added DtlsCertificate, a ref counted object owning an SSLIdentity (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Merge with master Created 5 years, 4 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
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2009 Google Inc. 3 * Copyright 2009 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 flags2 = (flags2 & ~SECURE); 188 flags2 = (flags2 & ~SECURE);
189 } 189 }
190 CreateContent(flags1, kPcmuCodec, kH264Codec, 190 CreateContent(flags1, kPcmuCodec, kH264Codec,
191 &local_media_content1_); 191 &local_media_content1_);
192 CreateContent(flags2, kPcmuCodec, kH264Codec, 192 CreateContent(flags2, kPcmuCodec, kH264Codec,
193 &local_media_content2_); 193 &local_media_content2_);
194 CopyContent(local_media_content1_, &remote_media_content1_); 194 CopyContent(local_media_content1_, &remote_media_content1_);
195 CopyContent(local_media_content2_, &remote_media_content2_); 195 CopyContent(local_media_content2_, &remote_media_content2_);
196 196
197 if (flags1 & DTLS) { 197 if (flags1 & DTLS) {
198 // Confirmed to work with KT_RSA and KT_ECDSA. 198 rtc::scoped_refptr<webrtc::DtlsCertificate> certificate =
199 identity1_.reset(rtc::SSLIdentity::Generate("session1", rtc::KT_DEFAULT)); 199 webrtc::DtlsCertificate::Create(
200 session1_.set_ssl_identity(identity1_.get()); 200 rtc::scoped_ptr<rtc::SSLIdentity>(
201 rtc::SSLIdentity::Generate("session1",
202 rtc::KT_DEFAULT)).Pass());
203 session1_.set_ssl_certificate(certificate);
201 } 204 }
202 if (flags2 & DTLS) { 205 if (flags2 & DTLS) {
203 // Confirmed to work with KT_RSA and KT_ECDSA. 206 rtc::scoped_refptr<webrtc::DtlsCertificate> certificate =
204 identity2_.reset(rtc::SSLIdentity::Generate("session2", rtc::KT_DEFAULT)); 207 webrtc::DtlsCertificate::Create(
205 session2_.set_ssl_identity(identity2_.get()); 208 rtc::scoped_ptr<rtc::SSLIdentity>(
209 rtc::SSLIdentity::Generate("session2",
210 rtc::KT_DEFAULT)).Pass());
211 session2_.set_ssl_certificate(certificate);
206 } 212 }
207 213
208 // Add stream information (SSRC) to the local content but not to the remote 214 // Add stream information (SSRC) to the local content but not to the remote
209 // content. This means that we per default know the SSRC of what we send but 215 // content. This means that we per default know the SSRC of what we send but
210 // not what we receive. 216 // not what we receive.
211 AddLegacyStreamInContent(kSsrc1, flags1, &local_media_content1_); 217 AddLegacyStreamInContent(kSsrc1, flags1, &local_media_content1_);
212 AddLegacyStreamInContent(kSsrc2, flags2, &local_media_content2_); 218 AddLegacyStreamInContent(kSsrc2, flags2, &local_media_content2_);
213 219
214 // If SSRC_MUX is used we also need to know the SSRC of the incoming stream. 220 // If SSRC_MUX is used we also need to know the SSRC of the incoming stream.
215 if (flags1 & SSRC_MUX) { 221 if (flags1 & SSRC_MUX) {
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 cricket::FakeMediaEngine media_engine_; 1790 cricket::FakeMediaEngine media_engine_;
1785 // The media channels are owned by the voice channel objects below. 1791 // The media channels are owned by the voice channel objects below.
1786 typename T::MediaChannel* media_channel1_; 1792 typename T::MediaChannel* media_channel1_;
1787 typename T::MediaChannel* media_channel2_; 1793 typename T::MediaChannel* media_channel2_;
1788 rtc::scoped_ptr<typename T::Channel> channel1_; 1794 rtc::scoped_ptr<typename T::Channel> channel1_;
1789 rtc::scoped_ptr<typename T::Channel> channel2_; 1795 rtc::scoped_ptr<typename T::Channel> channel2_;
1790 typename T::Content local_media_content1_; 1796 typename T::Content local_media_content1_;
1791 typename T::Content local_media_content2_; 1797 typename T::Content local_media_content2_;
1792 typename T::Content remote_media_content1_; 1798 typename T::Content remote_media_content1_;
1793 typename T::Content remote_media_content2_; 1799 typename T::Content remote_media_content2_;
1794 rtc::scoped_ptr<rtc::SSLIdentity> identity1_;
1795 rtc::scoped_ptr<rtc::SSLIdentity> identity2_;
1796 // The RTP and RTCP packets to send in the tests. 1800 // The RTP and RTCP packets to send in the tests.
1797 std::string rtp_packet_; 1801 std::string rtp_packet_;
1798 std::string rtcp_packet_; 1802 std::string rtcp_packet_;
1799 int media_info_callbacks1_; 1803 int media_info_callbacks1_;
1800 int media_info_callbacks2_; 1804 int media_info_callbacks2_;
1801 bool mute_callback_recved_; 1805 bool mute_callback_recved_;
1802 bool mute_callback_value_; 1806 bool mute_callback_value_;
1803 1807
1804 uint32 ssrc_; 1808 uint32 ssrc_;
1805 typename T::MediaChannel::Error error_; 1809 typename T::MediaChannel::Error error_;
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after
2876 }; 2880 };
2877 rtc::Buffer payload(data, 3); 2881 rtc::Buffer payload(data, 3);
2878 cricket::SendDataResult result; 2882 cricket::SendDataResult result;
2879 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); 2883 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result));
2880 EXPECT_EQ(params.ssrc, 2884 EXPECT_EQ(params.ssrc,
2881 media_channel1_->last_sent_data_params().ssrc); 2885 media_channel1_->last_sent_data_params().ssrc);
2882 EXPECT_EQ("foo", media_channel1_->last_sent_data()); 2886 EXPECT_EQ("foo", media_channel1_->last_sent_data());
2883 } 2887 }
2884 2888
2885 // TODO(pthatcher): TestSetReceiver? 2889 // TODO(pthatcher): TestSetReceiver?
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698