Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 | 116 |
| 117 rtc::StreamInterface* Open(const std::string& path) { | 117 rtc::StreamInterface* Open(const std::string& path) { |
| 118 return rtc::Filesystem::OpenFile( | 118 return rtc::Filesystem::OpenFile( |
| 119 rtc::Pathname(path), "wb"); | 119 rtc::Pathname(path), "wb"); |
| 120 } | 120 } |
| 121 | 121 |
| 122 // Base class for Voice/VideoChannel tests | 122 // Base class for Voice/VideoChannel tests |
| 123 template<class T> | 123 template<class T> |
| 124 class ChannelTest : public testing::Test, public sigslot::has_slots<> { | 124 class ChannelTest : public testing::Test, public sigslot::has_slots<> { |
|
Henrik Grunell WebRTC
2015/08/12 14:46:30
Should we add new tests?
hbos
2015/08/14 14:09:39
In this case the swap does not change or extend fu
| |
| 125 public: | 125 public: |
| 126 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, | 126 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, |
| 127 DTLS = 0x10 }; | 127 DTLS = 0x10 }; |
| 128 | 128 |
| 129 ChannelTest(const uint8* rtp_data, int rtp_len, | 129 ChannelTest(const uint8* rtp_data, int rtp_len, |
| 130 const uint8* rtcp_data, int rtcp_len) | 130 const uint8* rtcp_data, int rtcp_len) |
| 131 : session1_(true), | 131 : session1_(true), |
| 132 session2_(false), | 132 session2_(false), |
| 133 media_channel1_(NULL), | 133 media_channel1_(NULL), |
| 134 media_channel2_(NULL), | 134 media_channel2_(NULL), |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 Loading... | |
| 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 Loading... | |
| 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? |
| OLD | NEW |