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

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: Replacing SSLIdentity* /w scoped_refptr<DtlsCertificate> in surrounding code 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 identity1_.reset(rtc::SSLIdentity::Generate("session1")); 198 rtc::scoped_refptr<webrtc::DtlsCertificate> certificate =
199 session1_.set_ssl_identity(identity1_.get()); 199 webrtc::DtlsCertificate::Create(
200 rtc::scoped_ptr<rtc::SSLIdentity>(
201 rtc::SSLIdentity::Generate("session1")).Pass());
202 session1_.set_ssl_certificate(certificate);
200 } 203 }
201 if (flags2 & DTLS) { 204 if (flags2 & DTLS) {
202 identity2_.reset(rtc::SSLIdentity::Generate("session2")); 205 rtc::scoped_refptr<webrtc::DtlsCertificate> certificate =
203 session2_.set_ssl_identity(identity2_.get()); 206 webrtc::DtlsCertificate::Create(
207 rtc::scoped_ptr<rtc::SSLIdentity>(
208 rtc::SSLIdentity::Generate("session2")).Pass());
209 session2_.set_ssl_certificate(certificate);
204 } 210 }
205 211
206 // Add stream information (SSRC) to the local content but not to the remote 212 // Add stream information (SSRC) to the local content but not to the remote
207 // content. This means that we per default know the SSRC of what we send but 213 // content. This means that we per default know the SSRC of what we send but
208 // not what we receive. 214 // not what we receive.
209 AddLegacyStreamInContent(kSsrc1, flags1, &local_media_content1_); 215 AddLegacyStreamInContent(kSsrc1, flags1, &local_media_content1_);
210 AddLegacyStreamInContent(kSsrc2, flags2, &local_media_content2_); 216 AddLegacyStreamInContent(kSsrc2, flags2, &local_media_content2_);
211 217
212 // If SSRC_MUX is used we also need to know the SSRC of the incoming stream. 218 // If SSRC_MUX is used we also need to know the SSRC of the incoming stream.
213 if (flags1 & SSRC_MUX) { 219 if (flags1 & SSRC_MUX) {
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 cricket::FakeMediaEngine media_engine_; 1788 cricket::FakeMediaEngine media_engine_;
1783 // The media channels are owned by the voice channel objects below. 1789 // The media channels are owned by the voice channel objects below.
1784 typename T::MediaChannel* media_channel1_; 1790 typename T::MediaChannel* media_channel1_;
1785 typename T::MediaChannel* media_channel2_; 1791 typename T::MediaChannel* media_channel2_;
1786 rtc::scoped_ptr<typename T::Channel> channel1_; 1792 rtc::scoped_ptr<typename T::Channel> channel1_;
1787 rtc::scoped_ptr<typename T::Channel> channel2_; 1793 rtc::scoped_ptr<typename T::Channel> channel2_;
1788 typename T::Content local_media_content1_; 1794 typename T::Content local_media_content1_;
1789 typename T::Content local_media_content2_; 1795 typename T::Content local_media_content2_;
1790 typename T::Content remote_media_content1_; 1796 typename T::Content remote_media_content1_;
1791 typename T::Content remote_media_content2_; 1797 typename T::Content remote_media_content2_;
1792 rtc::scoped_ptr<rtc::SSLIdentity> identity1_;
1793 rtc::scoped_ptr<rtc::SSLIdentity> identity2_;
1794 // The RTP and RTCP packets to send in the tests. 1798 // The RTP and RTCP packets to send in the tests.
1795 std::string rtp_packet_; 1799 std::string rtp_packet_;
1796 std::string rtcp_packet_; 1800 std::string rtcp_packet_;
1797 int media_info_callbacks1_; 1801 int media_info_callbacks1_;
1798 int media_info_callbacks2_; 1802 int media_info_callbacks2_;
1799 bool mute_callback_recved_; 1803 bool mute_callback_recved_;
1800 bool mute_callback_value_; 1804 bool mute_callback_value_;
1801 1805
1802 uint32 ssrc_; 1806 uint32 ssrc_;
1803 typename T::MediaChannel::Error error_; 1807 typename T::MediaChannel::Error error_;
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after
2874 }; 2878 };
2875 rtc::Buffer payload(data, 3); 2879 rtc::Buffer payload(data, 3);
2876 cricket::SendDataResult result; 2880 cricket::SendDataResult result;
2877 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); 2881 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result));
2878 EXPECT_EQ(params.ssrc, 2882 EXPECT_EQ(params.ssrc,
2879 media_channel1_->last_sent_data_params().ssrc); 2883 media_channel1_->last_sent_data_params().ssrc);
2880 EXPECT_EQ("foo", media_channel1_->last_sent_data()); 2884 EXPECT_EQ("foo", media_channel1_->last_sent_data());
2881 } 2885 }
2882 2886
2883 // TODO(pthatcher): TestSetReceiver? 2887 // TODO(pthatcher): TestSetReceiver?
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698