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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 rtc::StreamInterface* Open(const std::string& path) { | 118 rtc::StreamInterface* Open(const std::string& path) { |
119 return rtc::Filesystem::OpenFile( | 119 return rtc::Filesystem::OpenFile( |
120 rtc::Pathname(path), "wb"); | 120 rtc::Pathname(path), "wb"); |
121 } | 121 } |
122 | 122 |
123 // Base class for Voice/VideoChannel tests | 123 // Base class for Voice/VideoChannel tests |
124 template<class T> | 124 template<class T> |
125 class ChannelTest : public testing::Test, public sigslot::has_slots<> { | 125 class ChannelTest : public testing::Test, public sigslot::has_slots<> { |
126 public: | 126 public: |
127 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, | 127 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, |
128 DTLS = 0x10 }; | 128 DTLS = 0x10, GCM_CIPHER = 0x20 }; |
129 | 129 |
130 ChannelTest(bool verify_playout, | 130 ChannelTest(bool verify_playout, |
131 const uint8_t* rtp_data, | 131 const uint8_t* rtp_data, |
132 int rtp_len, | 132 int rtp_len, |
133 const uint8_t* rtcp_data, | 133 const uint8_t* rtcp_data, |
134 int rtcp_len) | 134 int rtcp_len) |
135 : verify_playout_(verify_playout), | 135 : verify_playout_(verify_playout), |
136 transport_controller1_(cricket::ICEROLE_CONTROLLING), | 136 transport_controller1_(cricket::ICEROLE_CONTROLLING), |
137 transport_controller2_(cricket::ICEROLE_CONTROLLED), | 137 transport_controller2_(cricket::ICEROLE_CONTROLLED), |
138 media_channel1_(NULL), | 138 media_channel1_(NULL), |
139 media_channel2_(NULL), | 139 media_channel2_(NULL), |
140 rtp_packet_(reinterpret_cast<const char*>(rtp_data), rtp_len), | 140 rtp_packet_(reinterpret_cast<const char*>(rtp_data), rtp_len), |
141 rtcp_packet_(reinterpret_cast<const char*>(rtcp_data), rtcp_len), | 141 rtcp_packet_(reinterpret_cast<const char*>(rtcp_data), rtcp_len), |
142 media_info_callbacks1_(), | 142 media_info_callbacks1_(), |
143 media_info_callbacks2_() {} | 143 media_info_callbacks2_() {} |
144 | 144 |
145 void CreateChannels(int flags1, int flags2) { | 145 void CreateChannels(int flags1, int flags2) { |
146 CreateChannels(new typename T::MediaChannel(NULL, typename T::Options()), | 146 CreateChannels(new typename T::MediaChannel(NULL, typename T::Options()), |
147 new typename T::MediaChannel(NULL, typename T::Options()), | 147 new typename T::MediaChannel(NULL, typename T::Options()), |
148 flags1, flags2, rtc::Thread::Current()); | 148 flags1, flags2, rtc::Thread::Current()); |
149 } | 149 } |
150 void CreateChannels( | 150 void CreateChannels( |
151 typename T::MediaChannel* ch1, typename T::MediaChannel* ch2, | 151 typename T::MediaChannel* ch1, typename T::MediaChannel* ch2, |
152 int flags1, int flags2, rtc::Thread* thread) { | 152 int flags1, int flags2, rtc::Thread* thread) { |
153 media_channel1_ = ch1; | 153 media_channel1_ = ch1; |
154 media_channel2_ = ch2; | 154 media_channel2_ = ch2; |
155 channel1_.reset(CreateChannel(thread, &media_engine_, ch1, | 155 channel1_.reset(CreateChannel(thread, &media_engine_, ch1, |
156 &transport_controller1_, | 156 &transport_controller1_, flags1)); |
157 (flags1 & RTCP) != 0)); | |
158 channel2_.reset(CreateChannel(thread, &media_engine_, ch2, | 157 channel2_.reset(CreateChannel(thread, &media_engine_, ch2, |
159 &transport_controller2_, | 158 &transport_controller2_, flags2)); |
160 (flags2 & RTCP) != 0)); | |
161 channel1_->SignalMediaMonitor.connect( | 159 channel1_->SignalMediaMonitor.connect( |
162 this, &ChannelTest<T>::OnMediaMonitor); | 160 this, &ChannelTest<T>::OnMediaMonitor); |
163 channel2_->SignalMediaMonitor.connect( | 161 channel2_->SignalMediaMonitor.connect( |
164 this, &ChannelTest<T>::OnMediaMonitor); | 162 this, &ChannelTest<T>::OnMediaMonitor); |
165 if ((flags1 & DTLS) && (flags2 & DTLS)) { | 163 if ((flags1 & DTLS) && (flags2 & DTLS)) { |
166 flags1 = (flags1 & ~SECURE); | 164 flags1 = (flags1 & ~SECURE); |
167 flags2 = (flags2 & ~SECURE); | 165 flags2 = (flags2 & ~SECURE); |
168 } | 166 } |
169 CreateContent(flags1, kPcmuCodec, kH264Codec, | 167 CreateContent(flags1, kPcmuCodec, kH264Codec, |
170 &local_media_content1_); | 168 &local_media_content1_); |
(...skipping 27 matching lines...) Expand all Loading... |
198 } | 196 } |
199 if (flags2 & SSRC_MUX) { | 197 if (flags2 & SSRC_MUX) { |
200 AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_); | 198 AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_); |
201 } | 199 } |
202 } | 200 } |
203 typename T::Channel* CreateChannel( | 201 typename T::Channel* CreateChannel( |
204 rtc::Thread* thread, | 202 rtc::Thread* thread, |
205 cricket::MediaEngineInterface* engine, | 203 cricket::MediaEngineInterface* engine, |
206 typename T::MediaChannel* ch, | 204 typename T::MediaChannel* ch, |
207 cricket::TransportController* transport_controller, | 205 cricket::TransportController* transport_controller, |
208 bool rtcp) { | 206 int flags) { |
209 typename T::Channel* channel = new typename T::Channel( | 207 typename T::Channel* channel = new typename T::Channel( |
210 thread, engine, ch, transport_controller, cricket::CN_AUDIO, rtcp); | 208 thread, engine, ch, transport_controller, cricket::CN_AUDIO, |
| 209 (flags & RTCP) != 0); |
| 210 rtc::CryptoOptions crypto_options; |
| 211 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; |
| 212 channel->SetCryptoOptions(crypto_options); |
211 if (!channel->Init()) { | 213 if (!channel->Init()) { |
212 delete channel; | 214 delete channel; |
213 channel = NULL; | 215 channel = NULL; |
214 } | 216 } |
215 return channel; | 217 return channel; |
216 } | 218 } |
217 | 219 |
218 bool SendInitiate() { | 220 bool SendInitiate() { |
219 bool result = channel1_->SetLocalContent(&local_media_content1_, | 221 bool result = channel1_->SetLocalContent(&local_media_content1_, |
220 CA_OFFER, NULL); | 222 CA_OFFER, NULL); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 } | 392 } |
391 bool CheckNoRtp2() { | 393 bool CheckNoRtp2() { |
392 return media_channel2_->CheckNoRtp(); | 394 return media_channel2_->CheckNoRtp(); |
393 } | 395 } |
394 bool CheckNoRtcp1() { | 396 bool CheckNoRtcp1() { |
395 return media_channel1_->CheckNoRtcp(); | 397 return media_channel1_->CheckNoRtcp(); |
396 } | 398 } |
397 bool CheckNoRtcp2() { | 399 bool CheckNoRtcp2() { |
398 return media_channel2_->CheckNoRtcp(); | 400 return media_channel2_->CheckNoRtcp(); |
399 } | 401 } |
| 402 bool CheckGcmCipher(typename T::Channel* channel, int flags) { |
| 403 int suite; |
| 404 if (!channel->transport_channel()->GetSrtpCryptoSuite(&suite)) { |
| 405 return false; |
| 406 } |
| 407 |
| 408 if (flags & GCM_CIPHER) { |
| 409 return (suite == rtc::SRTP_AEAD_AES_128_GCM || |
| 410 suite == rtc::SRTP_AEAD_AES_256_GCM); |
| 411 } else { |
| 412 return (suite == rtc::SRTP_AES128_CM_SHA1_80 || |
| 413 suite == rtc::SRTP_AES128_CM_SHA1_32); |
| 414 } |
| 415 } |
400 | 416 |
401 void CreateContent(int flags, | 417 void CreateContent(int flags, |
402 const cricket::AudioCodec& audio_codec, | 418 const cricket::AudioCodec& audio_codec, |
403 const cricket::VideoCodec& video_codec, | 419 const cricket::VideoCodec& video_codec, |
404 typename T::Content* content) { | 420 typename T::Content* content) { |
405 // overridden in specialized classes | 421 // overridden in specialized classes |
406 } | 422 } |
407 void CopyContent(const typename T::Content& source, | 423 void CopyContent(const typename T::Content& source, |
408 typename T::Content* content) { | 424 typename T::Content* content) { |
409 // overridden in specialized classes | 425 // overridden in specialized classes |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1253 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1238 EXPECT_TRUE(SendRtcp1()); | 1254 EXPECT_TRUE(SendRtcp1()); |
1239 EXPECT_TRUE(CheckRtcp2()); | 1255 EXPECT_TRUE(CheckRtcp2()); |
1240 EXPECT_TRUE(SendRtcp2()); | 1256 EXPECT_TRUE(SendRtcp2()); |
1241 EXPECT_TRUE(CheckRtcp1()); | 1257 EXPECT_TRUE(CheckRtcp1()); |
1242 } | 1258 } |
1243 | 1259 |
1244 // Test that we properly send SRTP with RTCP in both directions. | 1260 // Test that we properly send SRTP with RTCP in both directions. |
1245 // You can pass in DTLS and/or RTCP_MUX as flags. | 1261 // You can pass in DTLS and/or RTCP_MUX as flags. |
1246 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { | 1262 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { |
1247 ASSERT((flags1_in & ~(RTCP_MUX | DTLS)) == 0); | 1263 ASSERT((flags1_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0); |
1248 ASSERT((flags2_in & ~(RTCP_MUX | DTLS)) == 0); | 1264 ASSERT((flags2_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0); |
1249 | 1265 |
1250 int flags1 = RTCP | SECURE | flags1_in; | 1266 int flags1 = RTCP | SECURE | flags1_in; |
1251 int flags2 = RTCP | SECURE | flags2_in; | 1267 int flags2 = RTCP | SECURE | flags2_in; |
1252 bool dtls1 = !!(flags1_in & DTLS); | 1268 bool dtls1 = !!(flags1_in & DTLS); |
1253 bool dtls2 = !!(flags2_in & DTLS); | 1269 bool dtls2 = !!(flags2_in & DTLS); |
1254 CreateChannels(flags1, flags2); | 1270 CreateChannels(flags1, flags2); |
1255 EXPECT_FALSE(channel1_->secure()); | 1271 EXPECT_FALSE(channel1_->secure()); |
1256 EXPECT_FALSE(channel2_->secure()); | 1272 EXPECT_FALSE(channel2_->secure()); |
1257 EXPECT_TRUE(SendInitiate()); | 1273 EXPECT_TRUE(SendInitiate()); |
1258 EXPECT_TRUE_WAIT(channel1_->writable(), kEventTimeout); | 1274 EXPECT_TRUE_WAIT(channel1_->writable(), kEventTimeout); |
1259 EXPECT_TRUE_WAIT(channel2_->writable(), kEventTimeout); | 1275 EXPECT_TRUE_WAIT(channel2_->writable(), kEventTimeout); |
1260 EXPECT_TRUE(SendAccept()); | 1276 EXPECT_TRUE(SendAccept()); |
1261 EXPECT_TRUE(channel1_->secure()); | 1277 EXPECT_TRUE(channel1_->secure()); |
1262 EXPECT_TRUE(channel2_->secure()); | 1278 EXPECT_TRUE(channel2_->secure()); |
1263 EXPECT_EQ(dtls1 && dtls2, channel1_->secure_dtls()); | 1279 EXPECT_EQ(dtls1 && dtls2, channel1_->secure_dtls()); |
1264 EXPECT_EQ(dtls1 && dtls2, channel2_->secure_dtls()); | 1280 EXPECT_EQ(dtls1 && dtls2, channel2_->secure_dtls()); |
| 1281 // A GCM cipher is only used if both channels support GCM ciphers. |
| 1282 int common_gcm_flags = (flags1 & GCM_CIPHER) & (flags2 & GCM_CIPHER); |
| 1283 EXPECT_TRUE(CheckGcmCipher(channel1_.get(), common_gcm_flags)); |
| 1284 EXPECT_TRUE(CheckGcmCipher(channel2_.get(), common_gcm_flags)); |
1265 EXPECT_TRUE(SendRtp1()); | 1285 EXPECT_TRUE(SendRtp1()); |
1266 EXPECT_TRUE(SendRtp2()); | 1286 EXPECT_TRUE(SendRtp2()); |
1267 EXPECT_TRUE(SendRtcp1()); | 1287 EXPECT_TRUE(SendRtcp1()); |
1268 EXPECT_TRUE(SendRtcp2()); | 1288 EXPECT_TRUE(SendRtcp2()); |
1269 EXPECT_TRUE(CheckRtp1()); | 1289 EXPECT_TRUE(CheckRtp1()); |
1270 EXPECT_TRUE(CheckRtp2()); | 1290 EXPECT_TRUE(CheckRtp2()); |
1271 EXPECT_TRUE(CheckNoRtp1()); | 1291 EXPECT_TRUE(CheckNoRtp1()); |
1272 EXPECT_TRUE(CheckNoRtp2()); | 1292 EXPECT_TRUE(CheckNoRtp2()); |
1273 EXPECT_TRUE(CheckRtcp1()); | 1293 EXPECT_TRUE(CheckRtcp1()); |
1274 EXPECT_TRUE(CheckRtcp2()); | 1294 EXPECT_TRUE(CheckRtcp2()); |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1856 sizeof(kRtcpReport)) {} | 1876 sizeof(kRtcpReport)) {} |
1857 }; | 1877 }; |
1858 | 1878 |
1859 // override to add NULL parameter | 1879 // override to add NULL parameter |
1860 template <> | 1880 template <> |
1861 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( | 1881 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( |
1862 rtc::Thread* thread, | 1882 rtc::Thread* thread, |
1863 cricket::MediaEngineInterface* engine, | 1883 cricket::MediaEngineInterface* engine, |
1864 cricket::FakeVideoMediaChannel* ch, | 1884 cricket::FakeVideoMediaChannel* ch, |
1865 cricket::TransportController* transport_controller, | 1885 cricket::TransportController* transport_controller, |
1866 bool rtcp) { | 1886 int flags) { |
1867 cricket::VideoChannel* channel = new cricket::VideoChannel( | 1887 cricket::VideoChannel* channel = new cricket::VideoChannel( |
1868 thread, ch, transport_controller, cricket::CN_VIDEO, rtcp); | 1888 thread, ch, transport_controller, cricket::CN_VIDEO, |
| 1889 (flags & RTCP) != 0); |
| 1890 rtc::CryptoOptions crypto_options; |
| 1891 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; |
| 1892 channel->SetCryptoOptions(crypto_options); |
1869 if (!channel->Init()) { | 1893 if (!channel->Init()) { |
1870 delete channel; | 1894 delete channel; |
1871 channel = NULL; | 1895 channel = NULL; |
1872 } | 1896 } |
1873 return channel; | 1897 return channel; |
1874 } | 1898 } |
1875 | 1899 |
1876 // override to add 0 parameter | 1900 // override to add 0 parameter |
1877 template<> | 1901 template<> |
1878 bool ChannelTest<VideoTraits>::AddStream1(int id) { | 1902 bool ChannelTest<VideoTraits>::AddStream1(int id) { |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2078 TEST_F(VoiceChannelTest, SendDtlsSrtpToSrtp) { | 2102 TEST_F(VoiceChannelTest, SendDtlsSrtpToSrtp) { |
2079 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2103 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2080 Base::SendSrtpToSrtp(DTLS, 0); | 2104 Base::SendSrtpToSrtp(DTLS, 0); |
2081 } | 2105 } |
2082 | 2106 |
2083 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtp) { | 2107 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtp) { |
2084 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2108 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2085 Base::SendSrtpToSrtp(DTLS, DTLS); | 2109 Base::SendSrtpToSrtp(DTLS, DTLS); |
2086 } | 2110 } |
2087 | 2111 |
| 2112 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpGcmBoth) { |
| 2113 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2114 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER); |
| 2115 } |
| 2116 |
| 2117 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpGcmOne) { |
| 2118 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2119 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS); |
| 2120 } |
| 2121 |
| 2122 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { |
| 2123 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2124 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); |
| 2125 } |
| 2126 |
2088 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 2127 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
2089 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2128 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2090 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 2129 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
2091 } | 2130 } |
2092 | 2131 |
2093 TEST_F(VoiceChannelTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 2132 TEST_F(VoiceChannelTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
2094 Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 2133 Base::SendEarlyMediaUsingRtcpMuxSrtp(); |
2095 } | 2134 } |
2096 | 2135 |
2097 TEST_F(VoiceChannelTest, SendRtpToRtpOnThread) { | 2136 TEST_F(VoiceChannelTest, SendRtpToRtpOnThread) { |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2414 TEST_F(VideoChannelTest, SendDtlsSrtpToSrtp) { | 2453 TEST_F(VideoChannelTest, SendDtlsSrtpToSrtp) { |
2415 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2454 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2416 Base::SendSrtpToSrtp(DTLS, 0); | 2455 Base::SendSrtpToSrtp(DTLS, 0); |
2417 } | 2456 } |
2418 | 2457 |
2419 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtp) { | 2458 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtp) { |
2420 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2459 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2421 Base::SendSrtpToSrtp(DTLS, DTLS); | 2460 Base::SendSrtpToSrtp(DTLS, DTLS); |
2422 } | 2461 } |
2423 | 2462 |
| 2463 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpGcmBoth) { |
| 2464 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2465 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER); |
| 2466 } |
| 2467 |
| 2468 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpGcmOne) { |
| 2469 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2470 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS); |
| 2471 } |
| 2472 |
| 2473 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { |
| 2474 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2475 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); |
| 2476 } |
| 2477 |
2424 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 2478 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
2425 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2479 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
2426 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 2480 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
2427 } | 2481 } |
2428 | 2482 |
2429 TEST_F(VideoChannelTest, SendSrtcpMux) { | 2483 TEST_F(VideoChannelTest, SendSrtcpMux) { |
2430 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); | 2484 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); |
2431 } | 2485 } |
2432 | 2486 |
2433 TEST_F(VideoChannelTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 2487 TEST_F(VideoChannelTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2578 sizeof(kRtcpReport)) {} | 2632 sizeof(kRtcpReport)) {} |
2579 }; | 2633 }; |
2580 | 2634 |
2581 // Override to avoid engine channel parameter. | 2635 // Override to avoid engine channel parameter. |
2582 template <> | 2636 template <> |
2583 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel( | 2637 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel( |
2584 rtc::Thread* thread, | 2638 rtc::Thread* thread, |
2585 cricket::MediaEngineInterface* engine, | 2639 cricket::MediaEngineInterface* engine, |
2586 cricket::FakeDataMediaChannel* ch, | 2640 cricket::FakeDataMediaChannel* ch, |
2587 cricket::TransportController* transport_controller, | 2641 cricket::TransportController* transport_controller, |
2588 bool rtcp) { | 2642 int flags) { |
2589 cricket::DataChannel* channel = new cricket::DataChannel( | 2643 cricket::DataChannel* channel = new cricket::DataChannel( |
2590 thread, ch, transport_controller, cricket::CN_DATA, rtcp); | 2644 thread, ch, transport_controller, cricket::CN_DATA, |
| 2645 (flags & RTCP) != 0); |
| 2646 rtc::CryptoOptions crypto_options; |
| 2647 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; |
| 2648 channel->SetCryptoOptions(crypto_options); |
2591 if (!channel->Init()) { | 2649 if (!channel->Init()) { |
2592 delete channel; | 2650 delete channel; |
2593 channel = NULL; | 2651 channel = NULL; |
2594 } | 2652 } |
2595 return channel; | 2653 return channel; |
2596 } | 2654 } |
2597 | 2655 |
2598 template<> | 2656 template<> |
2599 void ChannelTest<DataTraits>::CreateContent( | 2657 void ChannelTest<DataTraits>::CreateContent( |
2600 int flags, | 2658 int flags, |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2768 }; | 2826 }; |
2769 rtc::Buffer payload(data, 3); | 2827 rtc::Buffer payload(data, 3); |
2770 cricket::SendDataResult result; | 2828 cricket::SendDataResult result; |
2771 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 2829 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
2772 EXPECT_EQ(params.ssrc, | 2830 EXPECT_EQ(params.ssrc, |
2773 media_channel1_->last_sent_data_params().ssrc); | 2831 media_channel1_->last_sent_data_params().ssrc); |
2774 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 2832 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
2775 } | 2833 } |
2776 | 2834 |
2777 // TODO(pthatcher): TestSetReceiver? | 2835 // TODO(pthatcher): TestSetReceiver? |
OLD | NEW |