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 bool CheckGcmCipher(typename T::Channel* channel, int flags) { | |
mattdr
2016/05/06 22:34:14
A quick comment might be useful:
// Checks that th
joachim
2016/05/09 23:21:40
Done.
| |
390 int suite; | |
391 if (!channel->transport_channel()->GetSrtpCryptoSuite(&suite)) { | |
392 return false; | |
393 } | |
394 | |
395 if (flags & GCM_CIPHER) { | |
396 return rtc::IsGcmCryptoSuite(suite); | |
397 } else { | |
398 return (suite != rtc::SRTP_INVALID_CRYPTO_SUITE && | |
399 !rtc::IsGcmCryptoSuite(suite)); | |
400 } | |
401 } | |
386 | 402 |
387 void CreateContent(int flags, | 403 void CreateContent(int flags, |
388 const cricket::AudioCodec& audio_codec, | 404 const cricket::AudioCodec& audio_codec, |
389 const cricket::VideoCodec& video_codec, | 405 const cricket::VideoCodec& video_codec, |
390 typename T::Content* content) { | 406 typename T::Content* content) { |
391 // overridden in specialized classes | 407 // overridden in specialized classes |
392 } | 408 } |
393 void CopyContent(const typename T::Content& source, | 409 void CopyContent(const typename T::Content& source, |
394 typename T::Content* content) { | 410 typename T::Content* content) { |
395 // overridden in specialized classes | 411 // overridden in specialized classes |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1302 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1318 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1303 EXPECT_TRUE(SendRtcp1()); | 1319 EXPECT_TRUE(SendRtcp1()); |
1304 EXPECT_TRUE(CheckRtcp2()); | 1320 EXPECT_TRUE(CheckRtcp2()); |
1305 EXPECT_TRUE(SendRtcp2()); | 1321 EXPECT_TRUE(SendRtcp2()); |
1306 EXPECT_TRUE(CheckRtcp1()); | 1322 EXPECT_TRUE(CheckRtcp1()); |
1307 } | 1323 } |
1308 | 1324 |
1309 // Test that we properly send SRTP with RTCP in both directions. | 1325 // Test that we properly send SRTP with RTCP in both directions. |
1310 // You can pass in DTLS and/or RTCP_MUX as flags. | 1326 // You can pass in DTLS and/or RTCP_MUX as flags. |
1311 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { | 1327 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { |
1312 ASSERT((flags1_in & ~(RTCP_MUX | DTLS)) == 0); | 1328 ASSERT((flags1_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0); |
1313 ASSERT((flags2_in & ~(RTCP_MUX | DTLS)) == 0); | 1329 ASSERT((flags2_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0); |
1314 | 1330 |
1315 int flags1 = RTCP | SECURE | flags1_in; | 1331 int flags1 = RTCP | SECURE | flags1_in; |
1316 int flags2 = RTCP | SECURE | flags2_in; | 1332 int flags2 = RTCP | SECURE | flags2_in; |
1317 bool dtls1 = !!(flags1_in & DTLS); | 1333 bool dtls1 = !!(flags1_in & DTLS); |
1318 bool dtls2 = !!(flags2_in & DTLS); | 1334 bool dtls2 = !!(flags2_in & DTLS); |
1319 CreateChannels(flags1, flags2); | 1335 CreateChannels(flags1, flags2); |
1320 EXPECT_FALSE(channel1_->secure()); | 1336 EXPECT_FALSE(channel1_->secure()); |
1321 EXPECT_FALSE(channel2_->secure()); | 1337 EXPECT_FALSE(channel2_->secure()); |
1322 EXPECT_TRUE(SendInitiate()); | 1338 EXPECT_TRUE(SendInitiate()); |
1323 EXPECT_TRUE_WAIT(channel1_->writable(), kEventTimeout); | 1339 EXPECT_TRUE_WAIT(channel1_->writable(), kEventTimeout); |
1324 EXPECT_TRUE_WAIT(channel2_->writable(), kEventTimeout); | 1340 EXPECT_TRUE_WAIT(channel2_->writable(), kEventTimeout); |
1325 EXPECT_TRUE(SendAccept()); | 1341 EXPECT_TRUE(SendAccept()); |
1326 EXPECT_TRUE(channel1_->secure()); | 1342 EXPECT_TRUE(channel1_->secure()); |
1327 EXPECT_TRUE(channel2_->secure()); | 1343 EXPECT_TRUE(channel2_->secure()); |
1328 EXPECT_EQ(dtls1 && dtls2, channel1_->secure_dtls()); | 1344 EXPECT_EQ(dtls1 && dtls2, channel1_->secure_dtls()); |
1329 EXPECT_EQ(dtls1 && dtls2, channel2_->secure_dtls()); | 1345 EXPECT_EQ(dtls1 && dtls2, channel2_->secure_dtls()); |
1346 // We can only query the negotiated cipher suite for DTLS-SRTP transport | |
1347 // channels. | |
1348 if (dtls1 && dtls2) { | |
1349 // A GCM cipher is only used if both channels support GCM ciphers. | |
1350 int common_gcm_flags = (flags1 & GCM_CIPHER) & (flags2 & GCM_CIPHER); | |
mattdr
2016/05/06 22:34:14
flags1 & flags2 & GCM_CIPHER
joachim
2016/05/09 23:21:40
Done.
| |
1351 EXPECT_TRUE(CheckGcmCipher(channel1_.get(), common_gcm_flags)); | |
1352 EXPECT_TRUE(CheckGcmCipher(channel2_.get(), common_gcm_flags)); | |
1353 } | |
1330 EXPECT_TRUE(SendRtp1()); | 1354 EXPECT_TRUE(SendRtp1()); |
1331 EXPECT_TRUE(SendRtp2()); | 1355 EXPECT_TRUE(SendRtp2()); |
1332 EXPECT_TRUE(SendRtcp1()); | 1356 EXPECT_TRUE(SendRtcp1()); |
1333 EXPECT_TRUE(SendRtcp2()); | 1357 EXPECT_TRUE(SendRtcp2()); |
1334 EXPECT_TRUE(CheckRtp1()); | 1358 EXPECT_TRUE(CheckRtp1()); |
1335 EXPECT_TRUE(CheckRtp2()); | 1359 EXPECT_TRUE(CheckRtp2()); |
1336 EXPECT_TRUE(CheckNoRtp1()); | 1360 EXPECT_TRUE(CheckNoRtp1()); |
1337 EXPECT_TRUE(CheckNoRtp2()); | 1361 EXPECT_TRUE(CheckNoRtp2()); |
1338 EXPECT_TRUE(CheckRtcp1()); | 1362 EXPECT_TRUE(CheckRtcp1()); |
1339 EXPECT_TRUE(CheckRtcp2()); | 1363 EXPECT_TRUE(CheckRtcp2()); |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1966 sizeof(kRtcpReport)) {} | 1990 sizeof(kRtcpReport)) {} |
1967 }; | 1991 }; |
1968 | 1992 |
1969 // override to add NULL parameter | 1993 // override to add NULL parameter |
1970 template <> | 1994 template <> |
1971 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( | 1995 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( |
1972 rtc::Thread* thread, | 1996 rtc::Thread* thread, |
1973 cricket::MediaEngineInterface* engine, | 1997 cricket::MediaEngineInterface* engine, |
1974 cricket::FakeVideoMediaChannel* ch, | 1998 cricket::FakeVideoMediaChannel* ch, |
1975 cricket::TransportController* transport_controller, | 1999 cricket::TransportController* transport_controller, |
1976 bool rtcp) { | 2000 int flags) { |
1977 cricket::VideoChannel* channel = new cricket::VideoChannel( | 2001 cricket::VideoChannel* channel = new cricket::VideoChannel( |
1978 thread, ch, transport_controller, cricket::CN_VIDEO, rtcp); | 2002 thread, ch, transport_controller, cricket::CN_VIDEO, |
2003 (flags & RTCP) != 0); | |
2004 rtc::CryptoOptions crypto_options; | |
2005 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; | |
2006 channel->SetCryptoOptions(crypto_options); | |
1979 if (!channel->Init()) { | 2007 if (!channel->Init()) { |
1980 delete channel; | 2008 delete channel; |
1981 channel = NULL; | 2009 channel = NULL; |
1982 } | 2010 } |
1983 return channel; | 2011 return channel; |
1984 } | 2012 } |
1985 | 2013 |
1986 // override to add 0 parameter | 2014 // override to add 0 parameter |
1987 template<> | 2015 template<> |
1988 bool ChannelTest<VideoTraits>::AddStream1(int id) { | 2016 bool ChannelTest<VideoTraits>::AddStream1(int id) { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2191 TEST_F(VoiceChannelTest, SendDtlsSrtpToSrtp) { | 2219 TEST_F(VoiceChannelTest, SendDtlsSrtpToSrtp) { |
2192 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2220 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2193 Base::SendSrtpToSrtp(DTLS, 0); | 2221 Base::SendSrtpToSrtp(DTLS, 0); |
2194 } | 2222 } |
2195 | 2223 |
2196 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtp) { | 2224 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtp) { |
2197 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2225 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2198 Base::SendSrtpToSrtp(DTLS, DTLS); | 2226 Base::SendSrtpToSrtp(DTLS, DTLS); |
2199 } | 2227 } |
2200 | 2228 |
2229 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpGcmBoth) { | |
2230 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
2231 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER); | |
2232 } | |
2233 | |
2234 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpGcmOne) { | |
2235 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
2236 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS); | |
2237 } | |
2238 | |
2239 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { | |
2240 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
2241 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); | |
2242 } | |
2243 | |
2201 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 2244 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
2202 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2245 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2203 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 2246 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
2204 } | 2247 } |
2205 | 2248 |
2206 TEST_F(VoiceChannelTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 2249 TEST_F(VoiceChannelTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
2207 Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 2250 Base::SendEarlyMediaUsingRtcpMuxSrtp(); |
2208 } | 2251 } |
2209 | 2252 |
2210 TEST_F(VoiceChannelTest, SendRtpToRtpOnThread) { | 2253 TEST_F(VoiceChannelTest, SendRtpToRtpOnThread) { |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2509 TEST_F(VideoChannelTest, SendDtlsSrtpToSrtp) { | 2552 TEST_F(VideoChannelTest, SendDtlsSrtpToSrtp) { |
2510 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2553 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2511 Base::SendSrtpToSrtp(DTLS, 0); | 2554 Base::SendSrtpToSrtp(DTLS, 0); |
2512 } | 2555 } |
2513 | 2556 |
2514 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtp) { | 2557 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtp) { |
2515 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2558 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2516 Base::SendSrtpToSrtp(DTLS, DTLS); | 2559 Base::SendSrtpToSrtp(DTLS, DTLS); |
2517 } | 2560 } |
2518 | 2561 |
2562 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpGcmBoth) { | |
2563 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
2564 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER); | |
2565 } | |
2566 | |
2567 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpGcmOne) { | |
2568 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
2569 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS); | |
2570 } | |
2571 | |
2572 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { | |
2573 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
2574 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); | |
2575 } | |
2576 | |
2519 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 2577 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
2520 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2578 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2521 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 2579 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
2522 } | 2580 } |
2523 | 2581 |
2524 TEST_F(VideoChannelTest, SendSrtcpMux) { | 2582 TEST_F(VideoChannelTest, SendSrtcpMux) { |
2525 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); | 2583 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); |
2526 } | 2584 } |
2527 | 2585 |
2528 TEST_F(VideoChannelTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 2586 TEST_F(VideoChannelTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2620 sizeof(kRtcpReport)) {} | 2678 sizeof(kRtcpReport)) {} |
2621 }; | 2679 }; |
2622 | 2680 |
2623 // Override to avoid engine channel parameter. | 2681 // Override to avoid engine channel parameter. |
2624 template <> | 2682 template <> |
2625 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel( | 2683 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel( |
2626 rtc::Thread* thread, | 2684 rtc::Thread* thread, |
2627 cricket::MediaEngineInterface* engine, | 2685 cricket::MediaEngineInterface* engine, |
2628 cricket::FakeDataMediaChannel* ch, | 2686 cricket::FakeDataMediaChannel* ch, |
2629 cricket::TransportController* transport_controller, | 2687 cricket::TransportController* transport_controller, |
2630 bool rtcp) { | 2688 int flags) { |
2631 cricket::DataChannel* channel = new cricket::DataChannel( | 2689 cricket::DataChannel* channel = new cricket::DataChannel( |
2632 thread, ch, transport_controller, cricket::CN_DATA, rtcp); | 2690 thread, ch, transport_controller, cricket::CN_DATA, |
2691 (flags & RTCP) != 0); | |
2692 rtc::CryptoOptions crypto_options; | |
2693 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; | |
2694 channel->SetCryptoOptions(crypto_options); | |
2633 if (!channel->Init()) { | 2695 if (!channel->Init()) { |
2634 delete channel; | 2696 delete channel; |
2635 channel = NULL; | 2697 channel = NULL; |
2636 } | 2698 } |
2637 return channel; | 2699 return channel; |
2638 } | 2700 } |
2639 | 2701 |
2640 template<> | 2702 template<> |
2641 void ChannelTest<DataTraits>::CreateContent( | 2703 void ChannelTest<DataTraits>::CreateContent( |
2642 int flags, | 2704 int flags, |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2810 }; | 2872 }; |
2811 rtc::CopyOnWriteBuffer payload(data, 3); | 2873 rtc::CopyOnWriteBuffer payload(data, 3); |
2812 cricket::SendDataResult result; | 2874 cricket::SendDataResult result; |
2813 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 2875 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
2814 EXPECT_EQ(params.ssrc, | 2876 EXPECT_EQ(params.ssrc, |
2815 media_channel1_->last_sent_data_params().ssrc); | 2877 media_channel1_->last_sent_data_params().ssrc); |
2816 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 2878 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
2817 } | 2879 } |
2818 | 2880 |
2819 // TODO(pthatcher): TestSetReceiver? | 2881 // TODO(pthatcher): TestSetReceiver? |
OLD | NEW |