| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  *  Copyright 2009 The WebRTC project authors. All Rights Reserved. | 2  *  Copyright 2009 The WebRTC project authors. All Rights Reserved. | 
| 3  * | 3  * | 
| 4  *  Use of this source code is governed by a BSD-style license | 4  *  Use of this source code is governed by a BSD-style license | 
| 5  *  that can be found in the LICENSE file in the root of the source | 5  *  that can be found in the LICENSE file in the root of the source | 
| 6  *  tree. An additional intellectual property rights grant can be found | 6  *  tree. An additional intellectual property rights grant can be found | 
| 7  *  in the file PATENTS.  All contributing project authors may | 7  *  in the file PATENTS.  All contributing project authors may | 
| 8  *  be found in the AUTHORS file in the root of the source tree. | 8  *  be found in the AUTHORS file in the root of the source tree. | 
| 9  */ | 9  */ | 
| 10 | 10 | 
| 11 #include <memory> | 11 #include <memory> | 
| 12 | 12 | 
| 13 #include "webrtc/base/arraysize.h" | 13 #include "webrtc/base/arraysize.h" | 
| 14 #include "webrtc/base/criticalsection.h" | 14 #include "webrtc/base/criticalsection.h" | 
| 15 #include "webrtc/base/fileutils.h" | 15 #include "webrtc/base/fileutils.h" | 
| 16 #include "webrtc/base/gunit.h" | 16 #include "webrtc/base/gunit.h" | 
| 17 #include "webrtc/base/helpers.h" | 17 #include "webrtc/base/helpers.h" | 
| 18 #include "webrtc/base/logging.h" | 18 #include "webrtc/base/logging.h" | 
| 19 #include "webrtc/base/pathutils.h" | 19 #include "webrtc/base/pathutils.h" | 
| 20 #include "webrtc/base/signalthread.h" | 20 #include "webrtc/base/signalthread.h" | 
| 21 #include "webrtc/base/ssladapter.h" | 21 #include "webrtc/base/ssladapter.h" | 
| 22 #include "webrtc/base/sslidentity.h" | 22 #include "webrtc/base/sslidentity.h" | 
|  | 23 #include "webrtc/base/sslstreamadapter.h" | 
| 23 #include "webrtc/base/window.h" | 24 #include "webrtc/base/window.h" | 
| 24 #include "webrtc/media/base/fakemediaengine.h" | 25 #include "webrtc/media/base/fakemediaengine.h" | 
| 25 #include "webrtc/media/base/fakertp.h" | 26 #include "webrtc/media/base/fakertp.h" | 
| 26 #include "webrtc/media/base/fakescreencapturerfactory.h" | 27 #include "webrtc/media/base/fakescreencapturerfactory.h" | 
| 27 #include "webrtc/media/base/fakevideocapturer.h" | 28 #include "webrtc/media/base/fakevideocapturer.h" | 
| 28 #include "webrtc/media/base/mediachannel.h" | 29 #include "webrtc/media/base/mediachannel.h" | 
| 29 #include "webrtc/media/base/rtpdump.h" | 30 #include "webrtc/media/base/rtpdump.h" | 
| 30 #include "webrtc/media/base/screencastid.h" | 31 #include "webrtc/media/base/screencastid.h" | 
| 31 #include "webrtc/media/base/testutils.h" | 32 #include "webrtc/media/base/testutils.h" | 
| 32 #include "webrtc/p2p/base/faketransportcontroller.h" | 33 #include "webrtc/p2p/base/faketransportcontroller.h" | 
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 104 rtc::StreamInterface* Open(const std::string& path) { | 105 rtc::StreamInterface* Open(const std::string& path) { | 
| 105   return rtc::Filesystem::OpenFile( | 106   return rtc::Filesystem::OpenFile( | 
| 106       rtc::Pathname(path), "wb"); | 107       rtc::Pathname(path), "wb"); | 
| 107 } | 108 } | 
| 108 | 109 | 
| 109 // Base class for Voice/VideoChannel tests | 110 // Base class for Voice/VideoChannel tests | 
| 110 template<class T> | 111 template<class T> | 
| 111 class ChannelTest : public testing::Test, public sigslot::has_slots<> { | 112 class ChannelTest : public testing::Test, public sigslot::has_slots<> { | 
| 112  public: | 113  public: | 
| 113   enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, | 114   enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, | 
| 114                DTLS = 0x10 }; | 115                DTLS = 0x10, GCM_CIPHER = 0x20 }; | 
| 115 | 116 | 
| 116   ChannelTest(bool verify_playout, | 117   ChannelTest(bool verify_playout, | 
| 117               const uint8_t* rtp_data, | 118               const uint8_t* rtp_data, | 
| 118               int rtp_len, | 119               int rtp_len, | 
| 119               const uint8_t* rtcp_data, | 120               const uint8_t* rtcp_data, | 
| 120               int rtcp_len) | 121               int rtcp_len) | 
| 121       : verify_playout_(verify_playout), | 122       : verify_playout_(verify_playout), | 
| 122         transport_controller1_(cricket::ICEROLE_CONTROLLING), | 123         transport_controller1_(cricket::ICEROLE_CONTROLLING), | 
| 123         transport_controller2_(cricket::ICEROLE_CONTROLLED), | 124         transport_controller2_(cricket::ICEROLE_CONTROLLED), | 
| 124         media_channel1_(NULL), | 125         media_channel1_(NULL), | 
| 125         media_channel2_(NULL), | 126         media_channel2_(NULL), | 
| 126         rtp_packet_(reinterpret_cast<const char*>(rtp_data), rtp_len), | 127         rtp_packet_(reinterpret_cast<const char*>(rtp_data), rtp_len), | 
| 127         rtcp_packet_(reinterpret_cast<const char*>(rtcp_data), rtcp_len), | 128         rtcp_packet_(reinterpret_cast<const char*>(rtcp_data), rtcp_len), | 
| 128         media_info_callbacks1_(), | 129         media_info_callbacks1_(), | 
| 129         media_info_callbacks2_() {} | 130         media_info_callbacks2_() {} | 
| 130 | 131 | 
| 131   void CreateChannels(int flags1, int flags2) { | 132   void CreateChannels(int flags1, int flags2) { | 
| 132     CreateChannels(new typename T::MediaChannel(NULL, typename T::Options()), | 133     CreateChannels(new typename T::MediaChannel(NULL, typename T::Options()), | 
| 133                    new typename T::MediaChannel(NULL, typename T::Options()), | 134                    new typename T::MediaChannel(NULL, typename T::Options()), | 
| 134                    flags1, flags2, rtc::Thread::Current()); | 135                    flags1, flags2, rtc::Thread::Current()); | 
| 135   } | 136   } | 
| 136   void CreateChannels( | 137   void CreateChannels( | 
| 137       typename T::MediaChannel* ch1, typename T::MediaChannel* ch2, | 138       typename T::MediaChannel* ch1, typename T::MediaChannel* ch2, | 
| 138       int flags1, int flags2, rtc::Thread* thread) { | 139       int flags1, int flags2, rtc::Thread* thread) { | 
| 139     media_channel1_ = ch1; | 140     media_channel1_ = ch1; | 
| 140     media_channel2_ = ch2; | 141     media_channel2_ = ch2; | 
| 141     channel1_.reset(CreateChannel(thread, &media_engine_, ch1, | 142     channel1_.reset(CreateChannel(thread, &media_engine_, ch1, | 
| 142                                   &transport_controller1_, | 143                                   &transport_controller1_, flags1)); | 
| 143                                   (flags1 & RTCP) != 0)); |  | 
| 144     channel2_.reset(CreateChannel(thread, &media_engine_, ch2, | 144     channel2_.reset(CreateChannel(thread, &media_engine_, ch2, | 
| 145                                   &transport_controller2_, | 145                                   &transport_controller2_, flags2)); | 
| 146                                   (flags2 & RTCP) != 0)); |  | 
| 147     channel1_->SignalMediaMonitor.connect( | 146     channel1_->SignalMediaMonitor.connect( | 
| 148         this, &ChannelTest<T>::OnMediaMonitor); | 147         this, &ChannelTest<T>::OnMediaMonitor); | 
| 149     channel2_->SignalMediaMonitor.connect( | 148     channel2_->SignalMediaMonitor.connect( | 
| 150         this, &ChannelTest<T>::OnMediaMonitor); | 149         this, &ChannelTest<T>::OnMediaMonitor); | 
| 151     if ((flags1 & DTLS) && (flags2 & DTLS)) { | 150     if ((flags1 & DTLS) && (flags2 & DTLS)) { | 
| 152       flags1 = (flags1 & ~SECURE); | 151       flags1 = (flags1 & ~SECURE); | 
| 153       flags2 = (flags2 & ~SECURE); | 152       flags2 = (flags2 & ~SECURE); | 
| 154     } | 153     } | 
| 155     CreateContent(flags1, kPcmuCodec, kH264Codec, | 154     CreateContent(flags1, kPcmuCodec, kH264Codec, | 
| 156                   &local_media_content1_); | 155                   &local_media_content1_); | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 184     } | 183     } | 
| 185     if (flags2 & SSRC_MUX) { | 184     if (flags2 & SSRC_MUX) { | 
| 186       AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_); | 185       AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_); | 
| 187     } | 186     } | 
| 188   } | 187   } | 
| 189   typename T::Channel* CreateChannel( | 188   typename T::Channel* CreateChannel( | 
| 190       rtc::Thread* thread, | 189       rtc::Thread* thread, | 
| 191       cricket::MediaEngineInterface* engine, | 190       cricket::MediaEngineInterface* engine, | 
| 192       typename T::MediaChannel* ch, | 191       typename T::MediaChannel* ch, | 
| 193       cricket::TransportController* transport_controller, | 192       cricket::TransportController* transport_controller, | 
| 194       bool rtcp) { | 193       int flags) { | 
| 195     typename T::Channel* channel = new typename T::Channel( | 194     typename T::Channel* channel = new typename T::Channel( | 
| 196         thread, engine, ch, transport_controller, cricket::CN_AUDIO, rtcp); | 195         thread, engine, ch, transport_controller, cricket::CN_AUDIO, | 
|  | 196         (flags & RTCP) != 0); | 
|  | 197     rtc::CryptoOptions crypto_options; | 
|  | 198     crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; | 
|  | 199     channel->SetCryptoOptions(crypto_options); | 
| 197     if (!channel->Init()) { | 200     if (!channel->Init()) { | 
| 198       delete channel; | 201       delete channel; | 
| 199       channel = NULL; | 202       channel = NULL; | 
| 200     } | 203     } | 
| 201     return channel; | 204     return channel; | 
| 202   } | 205   } | 
| 203 | 206 | 
| 204   bool SendInitiate() { | 207   bool SendInitiate() { | 
| 205     bool result = channel1_->SetLocalContent(&local_media_content1_, | 208     bool result = channel1_->SetLocalContent(&local_media_content1_, | 
| 206                                              CA_OFFER, NULL); | 209                                              CA_OFFER, NULL); | 
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 376   } | 379   } | 
| 377   bool CheckNoRtp2() { | 380   bool CheckNoRtp2() { | 
| 378     return media_channel2_->CheckNoRtp(); | 381     return media_channel2_->CheckNoRtp(); | 
| 379   } | 382   } | 
| 380   bool CheckNoRtcp1() { | 383   bool CheckNoRtcp1() { | 
| 381     return media_channel1_->CheckNoRtcp(); | 384     return media_channel1_->CheckNoRtcp(); | 
| 382   } | 385   } | 
| 383   bool CheckNoRtcp2() { | 386   bool CheckNoRtcp2() { | 
| 384     return media_channel2_->CheckNoRtcp(); | 387     return media_channel2_->CheckNoRtcp(); | 
| 385   } | 388   } | 
|  | 389   // Checks that the channel is using GCM iff GCM_CIPHER is set in flags. | 
|  | 390   // Returns true if so. | 
|  | 391   bool CheckGcmCipher(typename T::Channel* channel, int flags) { | 
|  | 392     int suite; | 
|  | 393     if (!channel->transport_channel()->GetSrtpCryptoSuite(&suite)) { | 
|  | 394       return false; | 
|  | 395     } | 
|  | 396 | 
|  | 397     if (flags & GCM_CIPHER) { | 
|  | 398       return rtc::IsGcmCryptoSuite(suite); | 
|  | 399     } else { | 
|  | 400       return (suite != rtc::SRTP_INVALID_CRYPTO_SUITE && | 
|  | 401           !rtc::IsGcmCryptoSuite(suite)); | 
|  | 402     } | 
|  | 403   } | 
| 386 | 404 | 
| 387   void CreateContent(int flags, | 405   void CreateContent(int flags, | 
| 388                      const cricket::AudioCodec& audio_codec, | 406                      const cricket::AudioCodec& audio_codec, | 
| 389                      const cricket::VideoCodec& video_codec, | 407                      const cricket::VideoCodec& video_codec, | 
| 390                      typename T::Content* content) { | 408                      typename T::Content* content) { | 
| 391     // overridden in specialized classes | 409     // overridden in specialized classes | 
| 392   } | 410   } | 
| 393   void CopyContent(const typename T::Content& source, | 411   void CopyContent(const typename T::Content& source, | 
| 394                    typename T::Content* content) { | 412                    typename T::Content* content) { | 
| 395     // overridden in specialized classes | 413     // overridden in specialized classes | 
| (...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1302     EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1320     EXPECT_EQ(1U, GetTransport1()->channels().size()); | 
| 1303     EXPECT_TRUE(SendRtcp1()); | 1321     EXPECT_TRUE(SendRtcp1()); | 
| 1304     EXPECT_TRUE(CheckRtcp2()); | 1322     EXPECT_TRUE(CheckRtcp2()); | 
| 1305     EXPECT_TRUE(SendRtcp2()); | 1323     EXPECT_TRUE(SendRtcp2()); | 
| 1306     EXPECT_TRUE(CheckRtcp1()); | 1324     EXPECT_TRUE(CheckRtcp1()); | 
| 1307   } | 1325   } | 
| 1308 | 1326 | 
| 1309   // Test that we properly send SRTP with RTCP in both directions. | 1327   // Test that we properly send SRTP with RTCP in both directions. | 
| 1310   // You can pass in DTLS and/or RTCP_MUX as flags. | 1328   // You can pass in DTLS and/or RTCP_MUX as flags. | 
| 1311   void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { | 1329   void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { | 
| 1312     ASSERT((flags1_in & ~(RTCP_MUX | DTLS)) == 0); | 1330     ASSERT((flags1_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0); | 
| 1313     ASSERT((flags2_in & ~(RTCP_MUX | DTLS)) == 0); | 1331     ASSERT((flags2_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0); | 
| 1314 | 1332 | 
| 1315     int flags1 = RTCP | SECURE | flags1_in; | 1333     int flags1 = RTCP | SECURE | flags1_in; | 
| 1316     int flags2 = RTCP | SECURE | flags2_in; | 1334     int flags2 = RTCP | SECURE | flags2_in; | 
| 1317     bool dtls1 = !!(flags1_in & DTLS); | 1335     bool dtls1 = !!(flags1_in & DTLS); | 
| 1318     bool dtls2 = !!(flags2_in & DTLS); | 1336     bool dtls2 = !!(flags2_in & DTLS); | 
| 1319     CreateChannels(flags1, flags2); | 1337     CreateChannels(flags1, flags2); | 
| 1320     EXPECT_FALSE(channel1_->secure()); | 1338     EXPECT_FALSE(channel1_->secure()); | 
| 1321     EXPECT_FALSE(channel2_->secure()); | 1339     EXPECT_FALSE(channel2_->secure()); | 
| 1322     EXPECT_TRUE(SendInitiate()); | 1340     EXPECT_TRUE(SendInitiate()); | 
| 1323     EXPECT_TRUE_WAIT(channel1_->writable(), kEventTimeout); | 1341     EXPECT_TRUE_WAIT(channel1_->writable(), kEventTimeout); | 
| 1324     EXPECT_TRUE_WAIT(channel2_->writable(), kEventTimeout); | 1342     EXPECT_TRUE_WAIT(channel2_->writable(), kEventTimeout); | 
| 1325     EXPECT_TRUE(SendAccept()); | 1343     EXPECT_TRUE(SendAccept()); | 
| 1326     EXPECT_TRUE(channel1_->secure()); | 1344     EXPECT_TRUE(channel1_->secure()); | 
| 1327     EXPECT_TRUE(channel2_->secure()); | 1345     EXPECT_TRUE(channel2_->secure()); | 
| 1328     EXPECT_EQ(dtls1 && dtls2, channel1_->secure_dtls()); | 1346     EXPECT_EQ(dtls1 && dtls2, channel1_->secure_dtls()); | 
| 1329     EXPECT_EQ(dtls1 && dtls2, channel2_->secure_dtls()); | 1347     EXPECT_EQ(dtls1 && dtls2, channel2_->secure_dtls()); | 
|  | 1348     // We can only query the negotiated cipher suite for DTLS-SRTP transport | 
|  | 1349     // channels. | 
|  | 1350     if (dtls1 && dtls2) { | 
|  | 1351       // A GCM cipher is only used if both channels support GCM ciphers. | 
|  | 1352       int common_gcm_flags = flags1 & flags2 & GCM_CIPHER; | 
|  | 1353       EXPECT_TRUE(CheckGcmCipher(channel1_.get(), common_gcm_flags)); | 
|  | 1354       EXPECT_TRUE(CheckGcmCipher(channel2_.get(), common_gcm_flags)); | 
|  | 1355     } | 
| 1330     EXPECT_TRUE(SendRtp1()); | 1356     EXPECT_TRUE(SendRtp1()); | 
| 1331     EXPECT_TRUE(SendRtp2()); | 1357     EXPECT_TRUE(SendRtp2()); | 
| 1332     EXPECT_TRUE(SendRtcp1()); | 1358     EXPECT_TRUE(SendRtcp1()); | 
| 1333     EXPECT_TRUE(SendRtcp2()); | 1359     EXPECT_TRUE(SendRtcp2()); | 
| 1334     EXPECT_TRUE(CheckRtp1()); | 1360     EXPECT_TRUE(CheckRtp1()); | 
| 1335     EXPECT_TRUE(CheckRtp2()); | 1361     EXPECT_TRUE(CheckRtp2()); | 
| 1336     EXPECT_TRUE(CheckNoRtp1()); | 1362     EXPECT_TRUE(CheckNoRtp1()); | 
| 1337     EXPECT_TRUE(CheckNoRtp2()); | 1363     EXPECT_TRUE(CheckNoRtp2()); | 
| 1338     EXPECT_TRUE(CheckRtcp1()); | 1364     EXPECT_TRUE(CheckRtcp1()); | 
| 1339     EXPECT_TRUE(CheckRtcp2()); | 1365     EXPECT_TRUE(CheckRtcp2()); | 
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1966              sizeof(kRtcpReport)) {} | 1992              sizeof(kRtcpReport)) {} | 
| 1967 }; | 1993 }; | 
| 1968 | 1994 | 
| 1969 // override to add NULL parameter | 1995 // override to add NULL parameter | 
| 1970 template <> | 1996 template <> | 
| 1971 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( | 1997 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( | 
| 1972     rtc::Thread* thread, | 1998     rtc::Thread* thread, | 
| 1973     cricket::MediaEngineInterface* engine, | 1999     cricket::MediaEngineInterface* engine, | 
| 1974     cricket::FakeVideoMediaChannel* ch, | 2000     cricket::FakeVideoMediaChannel* ch, | 
| 1975     cricket::TransportController* transport_controller, | 2001     cricket::TransportController* transport_controller, | 
| 1976     bool rtcp) { | 2002     int flags) { | 
| 1977   cricket::VideoChannel* channel = new cricket::VideoChannel( | 2003   cricket::VideoChannel* channel = new cricket::VideoChannel( | 
| 1978       thread, ch, transport_controller, cricket::CN_VIDEO, rtcp); | 2004       thread, ch, transport_controller, cricket::CN_VIDEO, | 
|  | 2005         (flags & RTCP) != 0); | 
|  | 2006   rtc::CryptoOptions crypto_options; | 
|  | 2007   crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; | 
|  | 2008   channel->SetCryptoOptions(crypto_options); | 
| 1979   if (!channel->Init()) { | 2009   if (!channel->Init()) { | 
| 1980     delete channel; | 2010     delete channel; | 
| 1981     channel = NULL; | 2011     channel = NULL; | 
| 1982   } | 2012   } | 
| 1983   return channel; | 2013   return channel; | 
| 1984 } | 2014 } | 
| 1985 | 2015 | 
| 1986 // override to add 0 parameter | 2016 // override to add 0 parameter | 
| 1987 template<> | 2017 template<> | 
| 1988 bool ChannelTest<VideoTraits>::AddStream1(int id) { | 2018 bool ChannelTest<VideoTraits>::AddStream1(int id) { | 
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2191 TEST_F(VoiceChannelTest, SendDtlsSrtpToSrtp) { | 2221 TEST_F(VoiceChannelTest, SendDtlsSrtpToSrtp) { | 
| 2192   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2222   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 
| 2193   Base::SendSrtpToSrtp(DTLS, 0); | 2223   Base::SendSrtpToSrtp(DTLS, 0); | 
| 2194 } | 2224 } | 
| 2195 | 2225 | 
| 2196 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtp) { | 2226 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtp) { | 
| 2197   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2227   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 
| 2198   Base::SendSrtpToSrtp(DTLS, DTLS); | 2228   Base::SendSrtpToSrtp(DTLS, DTLS); | 
| 2199 } | 2229 } | 
| 2200 | 2230 | 
|  | 2231 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpGcmBoth) { | 
|  | 2232   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 
|  | 2233   Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER); | 
|  | 2234 } | 
|  | 2235 | 
|  | 2236 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpGcmOne) { | 
|  | 2237   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 
|  | 2238   Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS); | 
|  | 2239 } | 
|  | 2240 | 
|  | 2241 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { | 
|  | 2242   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 
|  | 2243   Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); | 
|  | 2244 } | 
|  | 2245 | 
| 2201 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 2246 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 
| 2202   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2247   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 
| 2203   Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 2248   Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 
| 2204 } | 2249 } | 
| 2205 | 2250 | 
| 2206 TEST_F(VoiceChannelTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 2251 TEST_F(VoiceChannelTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 
| 2207   Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 2252   Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 
| 2208 } | 2253 } | 
| 2209 | 2254 | 
| 2210 TEST_F(VoiceChannelTest, SendRtpToRtpOnThread) { | 2255 TEST_F(VoiceChannelTest, SendRtpToRtpOnThread) { | 
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2509 TEST_F(VideoChannelTest, SendDtlsSrtpToSrtp) { | 2554 TEST_F(VideoChannelTest, SendDtlsSrtpToSrtp) { | 
| 2510   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2555   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 
| 2511   Base::SendSrtpToSrtp(DTLS, 0); | 2556   Base::SendSrtpToSrtp(DTLS, 0); | 
| 2512 } | 2557 } | 
| 2513 | 2558 | 
| 2514 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtp) { | 2559 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtp) { | 
| 2515   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2560   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 
| 2516   Base::SendSrtpToSrtp(DTLS, DTLS); | 2561   Base::SendSrtpToSrtp(DTLS, DTLS); | 
| 2517 } | 2562 } | 
| 2518 | 2563 | 
|  | 2564 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpGcmBoth) { | 
|  | 2565   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 
|  | 2566   Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER); | 
|  | 2567 } | 
|  | 2568 | 
|  | 2569 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpGcmOne) { | 
|  | 2570   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 
|  | 2571   Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS); | 
|  | 2572 } | 
|  | 2573 | 
|  | 2574 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { | 
|  | 2575   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 
|  | 2576   Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); | 
|  | 2577 } | 
|  | 2578 | 
| 2519 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 2579 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 
| 2520   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2580   MAYBE_SKIP_TEST(HaveDtlsSrtp); | 
| 2521   Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 2581   Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 
| 2522 } | 2582 } | 
| 2523 | 2583 | 
| 2524 TEST_F(VideoChannelTest, SendSrtcpMux) { | 2584 TEST_F(VideoChannelTest, SendSrtcpMux) { | 
| 2525   Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); | 2585   Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); | 
| 2526 } | 2586 } | 
| 2527 | 2587 | 
| 2528 TEST_F(VideoChannelTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 2588 TEST_F(VideoChannelTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2620              sizeof(kRtcpReport)) {} | 2680              sizeof(kRtcpReport)) {} | 
| 2621 }; | 2681 }; | 
| 2622 | 2682 | 
| 2623 // Override to avoid engine channel parameter. | 2683 // Override to avoid engine channel parameter. | 
| 2624 template <> | 2684 template <> | 
| 2625 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel( | 2685 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel( | 
| 2626     rtc::Thread* thread, | 2686     rtc::Thread* thread, | 
| 2627     cricket::MediaEngineInterface* engine, | 2687     cricket::MediaEngineInterface* engine, | 
| 2628     cricket::FakeDataMediaChannel* ch, | 2688     cricket::FakeDataMediaChannel* ch, | 
| 2629     cricket::TransportController* transport_controller, | 2689     cricket::TransportController* transport_controller, | 
| 2630     bool rtcp) { | 2690     int flags) { | 
| 2631   cricket::DataChannel* channel = new cricket::DataChannel( | 2691   cricket::DataChannel* channel = new cricket::DataChannel( | 
| 2632       thread, ch, transport_controller, cricket::CN_DATA, rtcp); | 2692       thread, ch, transport_controller, cricket::CN_DATA, | 
|  | 2693         (flags & RTCP) != 0); | 
|  | 2694   rtc::CryptoOptions crypto_options; | 
|  | 2695   crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; | 
|  | 2696   channel->SetCryptoOptions(crypto_options); | 
| 2633   if (!channel->Init()) { | 2697   if (!channel->Init()) { | 
| 2634     delete channel; | 2698     delete channel; | 
| 2635     channel = NULL; | 2699     channel = NULL; | 
| 2636   } | 2700   } | 
| 2637   return channel; | 2701   return channel; | 
| 2638 } | 2702 } | 
| 2639 | 2703 | 
| 2640 template<> | 2704 template<> | 
| 2641 void ChannelTest<DataTraits>::CreateContent( | 2705 void ChannelTest<DataTraits>::CreateContent( | 
| 2642     int flags, | 2706     int flags, | 
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2810   }; | 2874   }; | 
| 2811   rtc::CopyOnWriteBuffer payload(data, 3); | 2875   rtc::CopyOnWriteBuffer payload(data, 3); | 
| 2812   cricket::SendDataResult result; | 2876   cricket::SendDataResult result; | 
| 2813   ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 2877   ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 
| 2814   EXPECT_EQ(params.ssrc, | 2878   EXPECT_EQ(params.ssrc, | 
| 2815             media_channel1_->last_sent_data_params().ssrc); | 2879             media_channel1_->last_sent_data_params().ssrc); | 
| 2816   EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 2880   EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 
| 2817 } | 2881 } | 
| 2818 | 2882 | 
| 2819 // TODO(pthatcher): TestSetReceiver? | 2883 // TODO(pthatcher): TestSetReceiver? | 
| OLD | NEW | 
|---|