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/array_view.h" | 13 #include "webrtc/base/array_view.h" |
14 #include "webrtc/base/buffer.h" | 14 #include "webrtc/base/buffer.h" |
15 #include "webrtc/base/gunit.h" | 15 #include "webrtc/base/gunit.h" |
16 #include "webrtc/base/logging.h" | 16 #include "webrtc/base/logging.h" |
| 17 #include "webrtc/base/sslstreamadapter.h" |
17 #include "webrtc/media/base/fakemediaengine.h" | 18 #include "webrtc/media/base/fakemediaengine.h" |
18 #include "webrtc/media/base/fakertp.h" | 19 #include "webrtc/media/base/fakertp.h" |
19 #include "webrtc/media/base/mediachannel.h" | 20 #include "webrtc/media/base/mediachannel.h" |
20 #include "webrtc/media/base/testutils.h" | 21 #include "webrtc/media/base/testutils.h" |
21 #include "webrtc/p2p/base/faketransportcontroller.h" | 22 #include "webrtc/p2p/base/faketransportcontroller.h" |
22 #include "webrtc/pc/channel.h" | 23 #include "webrtc/pc/channel.h" |
23 | 24 |
24 #define MAYBE_SKIP_TEST(feature) \ | 25 #define MAYBE_SKIP_TEST(feature) \ |
25 if (!(rtc::SSLStreamAdapter::feature())) { \ | 26 if (!(rtc::SSLStreamAdapter::feature())) { \ |
26 LOG(LS_INFO) << "Feature disabled... skipping"; \ | 27 LOG(LS_INFO) << "Feature disabled... skipping"; \ |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 cricket::DataContentDescription, | 87 cricket::DataContentDescription, |
87 cricket::DataCodec, | 88 cricket::DataCodec, |
88 cricket::DataMediaInfo, | 89 cricket::DataMediaInfo, |
89 cricket::DataOptions> {}; | 90 cricket::DataOptions> {}; |
90 | 91 |
91 // Base class for Voice/Video/DataChannel tests | 92 // Base class for Voice/Video/DataChannel tests |
92 template<class T> | 93 template<class T> |
93 class ChannelTest : public testing::Test, public sigslot::has_slots<> { | 94 class ChannelTest : public testing::Test, public sigslot::has_slots<> { |
94 public: | 95 public: |
95 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, | 96 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, |
96 DTLS = 0x10 }; | 97 DTLS = 0x10, GCM_CIPHER = 0x20 }; |
97 | 98 |
98 ChannelTest(bool verify_playout, | 99 ChannelTest(bool verify_playout, |
99 rtc::ArrayView<const uint8_t> rtp_data, | 100 rtc::ArrayView<const uint8_t> rtp_data, |
100 rtc::ArrayView<const uint8_t> rtcp_data, | 101 rtc::ArrayView<const uint8_t> rtcp_data, |
101 NetworkIsWorker network_is_worker) | 102 NetworkIsWorker network_is_worker) |
102 : verify_playout_(verify_playout), | 103 : verify_playout_(verify_playout), |
103 media_channel1_(NULL), | 104 media_channel1_(NULL), |
104 media_channel2_(NULL), | 105 media_channel2_(NULL), |
105 rtp_packet_(rtp_data.data(), rtp_data.size()), | 106 rtp_packet_(rtp_data.data(), rtp_data.size()), |
106 rtcp_packet_(rtcp_data.data(), rtcp_data.size()), | 107 rtcp_packet_(rtcp_data.data(), rtcp_data.size()), |
(...skipping 20 matching lines...) Expand all Loading... |
127 } | 128 } |
128 void CreateChannels(typename T::MediaChannel* ch1, | 129 void CreateChannels(typename T::MediaChannel* ch1, |
129 typename T::MediaChannel* ch2, | 130 typename T::MediaChannel* ch2, |
130 int flags1, | 131 int flags1, |
131 int flags2) { | 132 int flags2) { |
132 rtc::Thread* worker_thread = rtc::Thread::Current(); | 133 rtc::Thread* worker_thread = rtc::Thread::Current(); |
133 media_channel1_ = ch1; | 134 media_channel1_ = ch1; |
134 media_channel2_ = ch2; | 135 media_channel2_ = ch2; |
135 channel1_.reset( | 136 channel1_.reset( |
136 CreateChannel(worker_thread, network_thread_, &media_engine_, ch1, | 137 CreateChannel(worker_thread, network_thread_, &media_engine_, ch1, |
137 transport_controller1_.get(), (flags1 & RTCP) != 0)); | 138 transport_controller1_.get(), flags1)); |
138 channel2_.reset( | 139 channel2_.reset( |
139 CreateChannel(worker_thread, network_thread_, &media_engine_, ch2, | 140 CreateChannel(worker_thread, network_thread_, &media_engine_, ch2, |
140 transport_controller2_.get(), (flags2 & RTCP) != 0)); | 141 transport_controller2_.get(), flags2)); |
141 channel1_->SignalMediaMonitor.connect(this, | 142 channel1_->SignalMediaMonitor.connect(this, |
142 &ChannelTest<T>::OnMediaMonitor1); | 143 &ChannelTest<T>::OnMediaMonitor1); |
143 channel2_->SignalMediaMonitor.connect(this, | 144 channel2_->SignalMediaMonitor.connect(this, |
144 &ChannelTest<T>::OnMediaMonitor2); | 145 &ChannelTest<T>::OnMediaMonitor2); |
145 if ((flags1 & DTLS) && (flags2 & DTLS)) { | 146 if ((flags1 & DTLS) && (flags2 & DTLS)) { |
146 flags1 = (flags1 & ~SECURE); | 147 flags1 = (flags1 & ~SECURE); |
147 flags2 = (flags2 & ~SECURE); | 148 flags2 = (flags2 & ~SECURE); |
148 } | 149 } |
149 CreateContent(flags1, kPcmuCodec, kH264Codec, | 150 CreateContent(flags1, kPcmuCodec, kH264Codec, |
150 &local_media_content1_); | 151 &local_media_content1_); |
(...skipping 28 matching lines...) Expand all Loading... |
179 if (flags2 & SSRC_MUX) { | 180 if (flags2 & SSRC_MUX) { |
180 AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_); | 181 AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_); |
181 } | 182 } |
182 } | 183 } |
183 typename T::Channel* CreateChannel( | 184 typename T::Channel* CreateChannel( |
184 rtc::Thread* worker_thread, | 185 rtc::Thread* worker_thread, |
185 rtc::Thread* network_thread, | 186 rtc::Thread* network_thread, |
186 cricket::MediaEngineInterface* engine, | 187 cricket::MediaEngineInterface* engine, |
187 typename T::MediaChannel* ch, | 188 typename T::MediaChannel* ch, |
188 cricket::TransportController* transport_controller, | 189 cricket::TransportController* transport_controller, |
189 bool rtcp) { | 190 int flags) { |
190 typename T::Channel* channel = | 191 typename T::Channel* channel = |
191 new typename T::Channel(worker_thread, network_thread, engine, ch, | 192 new typename T::Channel(worker_thread, network_thread, engine, ch, |
192 transport_controller, cricket::CN_AUDIO, rtcp); | 193 transport_controller, cricket::CN_AUDIO, |
| 194 (flags & RTCP) != 0); |
| 195 rtc::CryptoOptions crypto_options; |
| 196 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; |
| 197 channel->SetCryptoOptions(crypto_options); |
193 if (!channel->Init_w(nullptr)) { | 198 if (!channel->Init_w(nullptr)) { |
194 delete channel; | 199 delete channel; |
195 channel = NULL; | 200 channel = NULL; |
196 } | 201 } |
197 return channel; | 202 return channel; |
198 } | 203 } |
199 | 204 |
200 bool SendInitiate() { | 205 bool SendInitiate() { |
201 bool result = channel1_->SetLocalContent(&local_media_content1_, | 206 bool result = channel1_->SetLocalContent(&local_media_content1_, |
202 CA_OFFER, NULL); | 207 CA_OFFER, NULL); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 } | 366 } |
362 bool CheckNoRtp2() { | 367 bool CheckNoRtp2() { |
363 return media_channel2_->CheckNoRtp(); | 368 return media_channel2_->CheckNoRtp(); |
364 } | 369 } |
365 bool CheckNoRtcp1() { | 370 bool CheckNoRtcp1() { |
366 return media_channel1_->CheckNoRtcp(); | 371 return media_channel1_->CheckNoRtcp(); |
367 } | 372 } |
368 bool CheckNoRtcp2() { | 373 bool CheckNoRtcp2() { |
369 return media_channel2_->CheckNoRtcp(); | 374 return media_channel2_->CheckNoRtcp(); |
370 } | 375 } |
| 376 // Checks that the channel is using GCM iff GCM_CIPHER is set in flags. |
| 377 // Returns true if so. |
| 378 bool CheckGcmCipher(typename T::Channel* channel, int flags) { |
| 379 int suite; |
| 380 if (!channel->transport_channel()->GetSrtpCryptoSuite(&suite)) { |
| 381 return false; |
| 382 } |
| 383 |
| 384 if (flags & GCM_CIPHER) { |
| 385 return rtc::IsGcmCryptoSuite(suite); |
| 386 } else { |
| 387 return (suite != rtc::SRTP_INVALID_CRYPTO_SUITE && |
| 388 !rtc::IsGcmCryptoSuite(suite)); |
| 389 } |
| 390 } |
371 | 391 |
372 void CreateContent(int flags, | 392 void CreateContent(int flags, |
373 const cricket::AudioCodec& audio_codec, | 393 const cricket::AudioCodec& audio_codec, |
374 const cricket::VideoCodec& video_codec, | 394 const cricket::VideoCodec& video_codec, |
375 typename T::Content* content) { | 395 typename T::Content* content) { |
376 // overridden in specialized classes | 396 // overridden in specialized classes |
377 } | 397 } |
378 void CopyContent(const typename T::Content& source, | 398 void CopyContent(const typename T::Content& source, |
379 typename T::Content* content) { | 399 typename T::Content* content) { |
380 // overridden in specialized classes | 400 // overridden in specialized classes |
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 SendRtcp1(); | 1301 SendRtcp1(); |
1282 SendRtcp2(); | 1302 SendRtcp2(); |
1283 WaitForThreads(); | 1303 WaitForThreads(); |
1284 EXPECT_TRUE(CheckRtcp2()); | 1304 EXPECT_TRUE(CheckRtcp2()); |
1285 EXPECT_TRUE(CheckRtcp1()); | 1305 EXPECT_TRUE(CheckRtcp1()); |
1286 } | 1306 } |
1287 | 1307 |
1288 // Test that we properly send SRTP with RTCP in both directions. | 1308 // Test that we properly send SRTP with RTCP in both directions. |
1289 // You can pass in DTLS and/or RTCP_MUX as flags. | 1309 // You can pass in DTLS and/or RTCP_MUX as flags. |
1290 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { | 1310 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { |
1291 ASSERT((flags1_in & ~(RTCP_MUX | DTLS)) == 0); | 1311 ASSERT((flags1_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0); |
1292 ASSERT((flags2_in & ~(RTCP_MUX | DTLS)) == 0); | 1312 ASSERT((flags2_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0); |
1293 | 1313 |
1294 int flags1 = RTCP | SECURE | flags1_in; | 1314 int flags1 = RTCP | SECURE | flags1_in; |
1295 int flags2 = RTCP | SECURE | flags2_in; | 1315 int flags2 = RTCP | SECURE | flags2_in; |
1296 bool dtls1 = !!(flags1_in & DTLS); | 1316 bool dtls1 = !!(flags1_in & DTLS); |
1297 bool dtls2 = !!(flags2_in & DTLS); | 1317 bool dtls2 = !!(flags2_in & DTLS); |
1298 CreateChannels(flags1, flags2); | 1318 CreateChannels(flags1, flags2); |
1299 EXPECT_FALSE(channel1_->secure()); | 1319 EXPECT_FALSE(channel1_->secure()); |
1300 EXPECT_FALSE(channel2_->secure()); | 1320 EXPECT_FALSE(channel2_->secure()); |
1301 EXPECT_TRUE(SendInitiate()); | 1321 EXPECT_TRUE(SendInitiate()); |
1302 WaitForThreads(); | 1322 WaitForThreads(); |
1303 EXPECT_TRUE(channel1_->writable()); | 1323 EXPECT_TRUE(channel1_->writable()); |
1304 EXPECT_TRUE(channel2_->writable()); | 1324 EXPECT_TRUE(channel2_->writable()); |
1305 EXPECT_TRUE(SendAccept()); | 1325 EXPECT_TRUE(SendAccept()); |
1306 EXPECT_TRUE(channel1_->secure()); | 1326 EXPECT_TRUE(channel1_->secure()); |
1307 EXPECT_TRUE(channel2_->secure()); | 1327 EXPECT_TRUE(channel2_->secure()); |
1308 EXPECT_EQ(dtls1 && dtls2, channel1_->secure_dtls()); | 1328 EXPECT_EQ(dtls1 && dtls2, channel1_->secure_dtls()); |
1309 EXPECT_EQ(dtls1 && dtls2, channel2_->secure_dtls()); | 1329 EXPECT_EQ(dtls1 && dtls2, channel2_->secure_dtls()); |
| 1330 // We can only query the negotiated cipher suite for DTLS-SRTP transport |
| 1331 // channels. |
| 1332 if (dtls1 && dtls2) { |
| 1333 // A GCM cipher is only used if both channels support GCM ciphers. |
| 1334 int common_gcm_flags = flags1 & flags2 & GCM_CIPHER; |
| 1335 EXPECT_TRUE(CheckGcmCipher(channel1_.get(), common_gcm_flags)); |
| 1336 EXPECT_TRUE(CheckGcmCipher(channel2_.get(), common_gcm_flags)); |
| 1337 } |
1310 SendRtp1(); | 1338 SendRtp1(); |
1311 SendRtp2(); | 1339 SendRtp2(); |
1312 SendRtcp1(); | 1340 SendRtcp1(); |
1313 SendRtcp2(); | 1341 SendRtcp2(); |
1314 WaitForThreads(); | 1342 WaitForThreads(); |
1315 EXPECT_TRUE(CheckRtp1()); | 1343 EXPECT_TRUE(CheckRtp1()); |
1316 EXPECT_TRUE(CheckRtp2()); | 1344 EXPECT_TRUE(CheckRtp2()); |
1317 EXPECT_TRUE(CheckNoRtp1()); | 1345 EXPECT_TRUE(CheckNoRtp1()); |
1318 EXPECT_TRUE(CheckNoRtp2()); | 1346 EXPECT_TRUE(CheckNoRtp2()); |
1319 EXPECT_TRUE(CheckRtcp1()); | 1347 EXPECT_TRUE(CheckRtcp1()); |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 }; | 2043 }; |
2016 | 2044 |
2017 // override to add NULL parameter | 2045 // override to add NULL parameter |
2018 template <> | 2046 template <> |
2019 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( | 2047 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( |
2020 rtc::Thread* worker_thread, | 2048 rtc::Thread* worker_thread, |
2021 rtc::Thread* network_thread, | 2049 rtc::Thread* network_thread, |
2022 cricket::MediaEngineInterface* engine, | 2050 cricket::MediaEngineInterface* engine, |
2023 cricket::FakeVideoMediaChannel* ch, | 2051 cricket::FakeVideoMediaChannel* ch, |
2024 cricket::TransportController* transport_controller, | 2052 cricket::TransportController* transport_controller, |
2025 bool rtcp) { | 2053 int flags) { |
2026 cricket::VideoChannel* channel = | 2054 cricket::VideoChannel* channel = |
2027 new cricket::VideoChannel(worker_thread, network_thread, ch, | 2055 new cricket::VideoChannel(worker_thread, network_thread, ch, |
2028 transport_controller, cricket::CN_VIDEO, rtcp); | 2056 transport_controller, cricket::CN_VIDEO, |
| 2057 (flags & RTCP) != 0); |
| 2058 rtc::CryptoOptions crypto_options; |
| 2059 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; |
| 2060 channel->SetCryptoOptions(crypto_options); |
2029 if (!channel->Init_w(nullptr)) { | 2061 if (!channel->Init_w(nullptr)) { |
2030 delete channel; | 2062 delete channel; |
2031 channel = NULL; | 2063 channel = NULL; |
2032 } | 2064 } |
2033 return channel; | 2065 return channel; |
2034 } | 2066 } |
2035 | 2067 |
2036 // override to add 0 parameter | 2068 // override to add 0 parameter |
2037 template<> | 2069 template<> |
2038 bool ChannelTest<VideoTraits>::AddStream1(int id) { | 2070 bool ChannelTest<VideoTraits>::AddStream1(int id) { |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2246 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToSrtp) { | 2278 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToSrtp) { |
2247 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2279 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2248 Base::SendSrtpToSrtp(DTLS, 0); | 2280 Base::SendSrtpToSrtp(DTLS, 0); |
2249 } | 2281 } |
2250 | 2282 |
2251 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtp) { | 2283 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtp) { |
2252 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2284 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2253 Base::SendSrtpToSrtp(DTLS, DTLS); | 2285 Base::SendSrtpToSrtp(DTLS, DTLS); |
2254 } | 2286 } |
2255 | 2287 |
| 2288 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmBoth) { |
| 2289 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2290 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER); |
| 2291 } |
| 2292 |
| 2293 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmOne) { |
| 2294 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2295 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS); |
| 2296 } |
| 2297 |
| 2298 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { |
| 2299 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2300 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); |
| 2301 } |
| 2302 |
2256 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 2303 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
2257 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2304 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2258 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 2305 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
2259 } | 2306 } |
2260 | 2307 |
2261 TEST_F(VoiceChannelSingleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 2308 TEST_F(VoiceChannelSingleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
2262 Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 2309 Base::SendEarlyMediaUsingRtcpMuxSrtp(); |
2263 } | 2310 } |
2264 | 2311 |
2265 TEST_F(VoiceChannelSingleThreadTest, SendRtpToRtpOnThread) { | 2312 TEST_F(VoiceChannelSingleThreadTest, SendRtpToRtpOnThread) { |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2576 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToSrtp) { | 2623 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToSrtp) { |
2577 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2624 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2578 Base::SendSrtpToSrtp(DTLS, 0); | 2625 Base::SendSrtpToSrtp(DTLS, 0); |
2579 } | 2626 } |
2580 | 2627 |
2581 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtp) { | 2628 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtp) { |
2582 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2629 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2583 Base::SendSrtpToSrtp(DTLS, DTLS); | 2630 Base::SendSrtpToSrtp(DTLS, DTLS); |
2584 } | 2631 } |
2585 | 2632 |
| 2633 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmBoth) { |
| 2634 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2635 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER); |
| 2636 } |
| 2637 |
| 2638 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmOne) { |
| 2639 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2640 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS); |
| 2641 } |
| 2642 |
| 2643 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { |
| 2644 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2645 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); |
| 2646 } |
| 2647 |
2586 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 2648 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
2587 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2649 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2588 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 2650 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
2589 } | 2651 } |
2590 | 2652 |
2591 TEST_F(VoiceChannelDoubleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 2653 TEST_F(VoiceChannelDoubleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
2592 Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 2654 Base::SendEarlyMediaUsingRtcpMuxSrtp(); |
2593 } | 2655 } |
2594 | 2656 |
2595 TEST_F(VoiceChannelDoubleThreadTest, SendRtpToRtpOnThread) { | 2657 TEST_F(VoiceChannelDoubleThreadTest, SendRtpToRtpOnThread) { |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3255 }; | 3317 }; |
3256 | 3318 |
3257 // Override to avoid engine channel parameter. | 3319 // Override to avoid engine channel parameter. |
3258 template <> | 3320 template <> |
3259 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel( | 3321 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel( |
3260 rtc::Thread* worker_thread, | 3322 rtc::Thread* worker_thread, |
3261 rtc::Thread* network_thread, | 3323 rtc::Thread* network_thread, |
3262 cricket::MediaEngineInterface* engine, | 3324 cricket::MediaEngineInterface* engine, |
3263 cricket::FakeDataMediaChannel* ch, | 3325 cricket::FakeDataMediaChannel* ch, |
3264 cricket::TransportController* transport_controller, | 3326 cricket::TransportController* transport_controller, |
3265 bool rtcp) { | 3327 int flags) { |
3266 cricket::DataChannel* channel = | 3328 cricket::DataChannel* channel = |
3267 new cricket::DataChannel(worker_thread, network_thread, ch, | 3329 new cricket::DataChannel(worker_thread, network_thread, ch, |
3268 transport_controller, cricket::CN_DATA, rtcp); | 3330 transport_controller, cricket::CN_DATA, |
| 3331 (flags & RTCP) != 0); |
| 3332 rtc::CryptoOptions crypto_options; |
| 3333 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; |
| 3334 channel->SetCryptoOptions(crypto_options); |
3269 if (!channel->Init_w(nullptr)) { | 3335 if (!channel->Init_w(nullptr)) { |
3270 delete channel; | 3336 delete channel; |
3271 channel = NULL; | 3337 channel = NULL; |
3272 } | 3338 } |
3273 return channel; | 3339 return channel; |
3274 } | 3340 } |
3275 | 3341 |
3276 template <> | 3342 template <> |
3277 void ChannelTest<DataTraits>::CreateContent( | 3343 void ChannelTest<DataTraits>::CreateContent( |
3278 int flags, | 3344 int flags, |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3594 }; | 3660 }; |
3595 rtc::CopyOnWriteBuffer payload(data, 3); | 3661 rtc::CopyOnWriteBuffer payload(data, 3); |
3596 cricket::SendDataResult result; | 3662 cricket::SendDataResult result; |
3597 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 3663 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
3598 EXPECT_EQ(params.ssrc, | 3664 EXPECT_EQ(params.ssrc, |
3599 media_channel1_->last_sent_data_params().ssrc); | 3665 media_channel1_->last_sent_data_params().ssrc); |
3600 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 3666 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
3601 } | 3667 } |
3602 | 3668 |
3603 // TODO(pthatcher): TestSetReceiver? | 3669 // TODO(pthatcher): TestSetReceiver? |
OLD | NEW |