Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(675)

Side by Side Diff: talk/session/media/channel_unittest.cc

Issue 1528843005: Add support for GCM cipher suites from RFC 7714. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Updates after feedback from Peter Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 29 matching lines...) Expand all
200 } 198 }
201 if (flags2 & SSRC_MUX) { 199 if (flags2 & SSRC_MUX) {
202 AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_); 200 AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_);
203 } 201 }
204 } 202 }
205 typename T::Channel* CreateChannel( 203 typename T::Channel* CreateChannel(
206 rtc::Thread* thread, 204 rtc::Thread* thread,
207 cricket::MediaEngineInterface* engine, 205 cricket::MediaEngineInterface* engine,
208 typename T::MediaChannel* ch, 206 typename T::MediaChannel* ch,
209 cricket::TransportController* transport_controller, 207 cricket::TransportController* transport_controller,
210 bool rtcp) { 208 int flags) {
211 typename T::Channel* channel = new typename T::Channel( 209 typename T::Channel* channel = new typename T::Channel(
212 thread, engine, ch, transport_controller, cricket::CN_AUDIO, rtcp); 210 thread, engine, ch, transport_controller, cricket::CN_AUDIO,
211 (flags & RTCP) != 0);
212 channel->SetEnableGcmCryptoSuites((flags & GCM_CIPHER) != 0);
213 if (!channel->Init()) { 213 if (!channel->Init()) {
214 delete channel; 214 delete channel;
215 channel = NULL; 215 channel = NULL;
216 } 216 }
217 return channel; 217 return channel;
218 } 218 }
219 219
220 bool SendInitiate() { 220 bool SendInitiate() {
221 bool result = channel1_->SetLocalContent(&local_media_content1_, 221 bool result = channel1_->SetLocalContent(&local_media_content1_,
222 CA_OFFER, NULL); 222 CA_OFFER, NULL);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } 392 }
393 bool CheckNoRtp2() { 393 bool CheckNoRtp2() {
394 return media_channel2_->CheckNoRtp(); 394 return media_channel2_->CheckNoRtp();
395 } 395 }
396 bool CheckNoRtcp1() { 396 bool CheckNoRtcp1() {
397 return media_channel1_->CheckNoRtcp(); 397 return media_channel1_->CheckNoRtcp();
398 } 398 }
399 bool CheckNoRtcp2() { 399 bool CheckNoRtcp2() {
400 return media_channel2_->CheckNoRtcp(); 400 return media_channel2_->CheckNoRtcp();
401 } 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 }
402 416
403 void CreateContent(int flags, 417 void CreateContent(int flags,
404 const cricket::AudioCodec& audio_codec, 418 const cricket::AudioCodec& audio_codec,
405 const cricket::VideoCodec& video_codec, 419 const cricket::VideoCodec& video_codec,
406 typename T::Content* content) { 420 typename T::Content* content) {
407 // overridden in specialized classes 421 // overridden in specialized classes
408 } 422 }
409 void CopyContent(const typename T::Content& source, 423 void CopyContent(const typename T::Content& source,
410 typename T::Content* content) { 424 typename T::Content* content) {
411 // overridden in specialized classes 425 // overridden in specialized classes
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1253 EXPECT_EQ(1U, GetTransport1()->channels().size());
1240 EXPECT_TRUE(SendRtcp1()); 1254 EXPECT_TRUE(SendRtcp1());
1241 EXPECT_TRUE(CheckRtcp2()); 1255 EXPECT_TRUE(CheckRtcp2());
1242 EXPECT_TRUE(SendRtcp2()); 1256 EXPECT_TRUE(SendRtcp2());
1243 EXPECT_TRUE(CheckRtcp1()); 1257 EXPECT_TRUE(CheckRtcp1());
1244 } 1258 }
1245 1259
1246 // Test that we properly send SRTP with RTCP in both directions. 1260 // Test that we properly send SRTP with RTCP in both directions.
1247 // You can pass in DTLS and/or RTCP_MUX as flags. 1261 // You can pass in DTLS and/or RTCP_MUX as flags.
1248 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { 1262 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) {
1249 ASSERT((flags1_in & ~(RTCP_MUX | DTLS)) == 0); 1263 ASSERT((flags1_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0);
1250 ASSERT((flags2_in & ~(RTCP_MUX | DTLS)) == 0); 1264 ASSERT((flags2_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0);
1251 1265
1252 int flags1 = RTCP | SECURE | flags1_in; 1266 int flags1 = RTCP | SECURE | flags1_in;
1253 int flags2 = RTCP | SECURE | flags2_in; 1267 int flags2 = RTCP | SECURE | flags2_in;
1254 bool dtls1 = !!(flags1_in & DTLS); 1268 bool dtls1 = !!(flags1_in & DTLS);
1255 bool dtls2 = !!(flags2_in & DTLS); 1269 bool dtls2 = !!(flags2_in & DTLS);
1256 CreateChannels(flags1, flags2); 1270 CreateChannels(flags1, flags2);
1257 EXPECT_FALSE(channel1_->secure()); 1271 EXPECT_FALSE(channel1_->secure());
1258 EXPECT_FALSE(channel2_->secure()); 1272 EXPECT_FALSE(channel2_->secure());
1259 EXPECT_TRUE(SendInitiate()); 1273 EXPECT_TRUE(SendInitiate());
1260 EXPECT_TRUE_WAIT(channel1_->writable(), kEventTimeout); 1274 EXPECT_TRUE_WAIT(channel1_->writable(), kEventTimeout);
1261 EXPECT_TRUE_WAIT(channel2_->writable(), kEventTimeout); 1275 EXPECT_TRUE_WAIT(channel2_->writable(), kEventTimeout);
1262 EXPECT_TRUE(SendAccept()); 1276 EXPECT_TRUE(SendAccept());
1263 EXPECT_TRUE(channel1_->secure()); 1277 EXPECT_TRUE(channel1_->secure());
1264 EXPECT_TRUE(channel2_->secure()); 1278 EXPECT_TRUE(channel2_->secure());
1265 EXPECT_EQ(dtls1 && dtls2, channel1_->secure_dtls()); 1279 EXPECT_EQ(dtls1 && dtls2, channel1_->secure_dtls());
1266 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));
1267 EXPECT_TRUE(SendRtp1()); 1285 EXPECT_TRUE(SendRtp1());
1268 EXPECT_TRUE(SendRtp2()); 1286 EXPECT_TRUE(SendRtp2());
1269 EXPECT_TRUE(SendRtcp1()); 1287 EXPECT_TRUE(SendRtcp1());
1270 EXPECT_TRUE(SendRtcp2()); 1288 EXPECT_TRUE(SendRtcp2());
1271 EXPECT_TRUE(CheckRtp1()); 1289 EXPECT_TRUE(CheckRtp1());
1272 EXPECT_TRUE(CheckRtp2()); 1290 EXPECT_TRUE(CheckRtp2());
1273 EXPECT_TRUE(CheckNoRtp1()); 1291 EXPECT_TRUE(CheckNoRtp1());
1274 EXPECT_TRUE(CheckNoRtp2()); 1292 EXPECT_TRUE(CheckNoRtp2());
1275 EXPECT_TRUE(CheckRtcp1()); 1293 EXPECT_TRUE(CheckRtcp1());
1276 EXPECT_TRUE(CheckRtcp2()); 1294 EXPECT_TRUE(CheckRtcp2());
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 sizeof(kRtcpReport)) {} 1876 sizeof(kRtcpReport)) {}
1859 }; 1877 };
1860 1878
1861 // override to add NULL parameter 1879 // override to add NULL parameter
1862 template <> 1880 template <>
1863 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( 1881 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel(
1864 rtc::Thread* thread, 1882 rtc::Thread* thread,
1865 cricket::MediaEngineInterface* engine, 1883 cricket::MediaEngineInterface* engine,
1866 cricket::FakeVideoMediaChannel* ch, 1884 cricket::FakeVideoMediaChannel* ch,
1867 cricket::TransportController* transport_controller, 1885 cricket::TransportController* transport_controller,
1868 bool rtcp) { 1886 int flags) {
1869 cricket::VideoChannel* channel = new cricket::VideoChannel( 1887 cricket::VideoChannel* channel = new cricket::VideoChannel(
1870 thread, ch, transport_controller, cricket::CN_VIDEO, rtcp); 1888 thread, ch, transport_controller, cricket::CN_VIDEO,
1889 (flags & RTCP) != 0);
1890 channel->SetEnableGcmCryptoSuites((flags & GCM_CIPHER) != 0);
1871 if (!channel->Init()) { 1891 if (!channel->Init()) {
1872 delete channel; 1892 delete channel;
1873 channel = NULL; 1893 channel = NULL;
1874 } 1894 }
1875 return channel; 1895 return channel;
1876 } 1896 }
1877 1897
1878 // override to add 0 parameter 1898 // override to add 0 parameter
1879 template<> 1899 template<>
1880 bool ChannelTest<VideoTraits>::AddStream1(int id) { 1900 bool ChannelTest<VideoTraits>::AddStream1(int id) {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 TEST_F(VoiceChannelTest, SendDtlsSrtpToSrtp) { 2100 TEST_F(VoiceChannelTest, SendDtlsSrtpToSrtp) {
2081 MAYBE_SKIP_TEST(HaveDtlsSrtp); 2101 MAYBE_SKIP_TEST(HaveDtlsSrtp);
2082 Base::SendSrtpToSrtp(DTLS, 0); 2102 Base::SendSrtpToSrtp(DTLS, 0);
2083 } 2103 }
2084 2104
2085 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtp) { 2105 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtp) {
2086 MAYBE_SKIP_TEST(HaveDtlsSrtp); 2106 MAYBE_SKIP_TEST(HaveDtlsSrtp);
2087 Base::SendSrtpToSrtp(DTLS, DTLS); 2107 Base::SendSrtpToSrtp(DTLS, DTLS);
2088 } 2108 }
2089 2109
2110 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpGcmBoth) {
2111 MAYBE_SKIP_TEST(HaveDtlsSrtp);
2112 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER);
2113 }
2114
2115 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpGcmOne) {
2116 MAYBE_SKIP_TEST(HaveDtlsSrtp);
2117 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS);
2118 }
2119
2120 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpGcmTwo) {
2121 MAYBE_SKIP_TEST(HaveDtlsSrtp);
2122 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER);
2123 }
2124
2090 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { 2125 TEST_F(VoiceChannelTest, SendDtlsSrtpToDtlsSrtpRtcpMux) {
2091 MAYBE_SKIP_TEST(HaveDtlsSrtp); 2126 MAYBE_SKIP_TEST(HaveDtlsSrtp);
2092 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); 2127 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX);
2093 } 2128 }
2094 2129
2095 TEST_F(VoiceChannelTest, SendEarlyMediaUsingRtcpMuxSrtp) { 2130 TEST_F(VoiceChannelTest, SendEarlyMediaUsingRtcpMuxSrtp) {
2096 Base::SendEarlyMediaUsingRtcpMuxSrtp(); 2131 Base::SendEarlyMediaUsingRtcpMuxSrtp();
2097 } 2132 }
2098 2133
2099 TEST_F(VoiceChannelTest, SendRtpToRtpOnThread) { 2134 TEST_F(VoiceChannelTest, SendRtpToRtpOnThread) {
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
2416 TEST_F(VideoChannelTest, SendDtlsSrtpToSrtp) { 2451 TEST_F(VideoChannelTest, SendDtlsSrtpToSrtp) {
2417 MAYBE_SKIP_TEST(HaveDtlsSrtp); 2452 MAYBE_SKIP_TEST(HaveDtlsSrtp);
2418 Base::SendSrtpToSrtp(DTLS, 0); 2453 Base::SendSrtpToSrtp(DTLS, 0);
2419 } 2454 }
2420 2455
2421 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtp) { 2456 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtp) {
2422 MAYBE_SKIP_TEST(HaveDtlsSrtp); 2457 MAYBE_SKIP_TEST(HaveDtlsSrtp);
2423 Base::SendSrtpToSrtp(DTLS, DTLS); 2458 Base::SendSrtpToSrtp(DTLS, DTLS);
2424 } 2459 }
2425 2460
2461 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpGcmBoth) {
2462 MAYBE_SKIP_TEST(HaveDtlsSrtp);
2463 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER);
2464 }
2465
2466 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpGcmOne) {
2467 MAYBE_SKIP_TEST(HaveDtlsSrtp);
2468 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS);
2469 }
2470
2471 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpGcmTwo) {
2472 MAYBE_SKIP_TEST(HaveDtlsSrtp);
2473 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER);
2474 }
2475
2426 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { 2476 TEST_F(VideoChannelTest, SendDtlsSrtpToDtlsSrtpRtcpMux) {
2427 MAYBE_SKIP_TEST(HaveDtlsSrtp); 2477 MAYBE_SKIP_TEST(HaveDtlsSrtp);
2428 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); 2478 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX);
2429 } 2479 }
2430 2480
2431 TEST_F(VideoChannelTest, SendSrtcpMux) { 2481 TEST_F(VideoChannelTest, SendSrtcpMux) {
2432 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); 2482 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX);
2433 } 2483 }
2434 2484
2435 TEST_F(VideoChannelTest, SendEarlyMediaUsingRtcpMuxSrtp) { 2485 TEST_F(VideoChannelTest, SendEarlyMediaUsingRtcpMuxSrtp) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2580 sizeof(kRtcpReport)) {} 2630 sizeof(kRtcpReport)) {}
2581 }; 2631 };
2582 2632
2583 // Override to avoid engine channel parameter. 2633 // Override to avoid engine channel parameter.
2584 template <> 2634 template <>
2585 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel( 2635 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel(
2586 rtc::Thread* thread, 2636 rtc::Thread* thread,
2587 cricket::MediaEngineInterface* engine, 2637 cricket::MediaEngineInterface* engine,
2588 cricket::FakeDataMediaChannel* ch, 2638 cricket::FakeDataMediaChannel* ch,
2589 cricket::TransportController* transport_controller, 2639 cricket::TransportController* transport_controller,
2590 bool rtcp) { 2640 int flags) {
2591 cricket::DataChannel* channel = new cricket::DataChannel( 2641 cricket::DataChannel* channel = new cricket::DataChannel(
2592 thread, ch, transport_controller, cricket::CN_DATA, rtcp); 2642 thread, ch, transport_controller, cricket::CN_DATA,
2643 (flags & RTCP) != 0);
2644 channel->SetEnableGcmCryptoSuites((flags & GCM_CIPHER) != 0);
2593 if (!channel->Init()) { 2645 if (!channel->Init()) {
2594 delete channel; 2646 delete channel;
2595 channel = NULL; 2647 channel = NULL;
2596 } 2648 }
2597 return channel; 2649 return channel;
2598 } 2650 }
2599 2651
2600 template<> 2652 template<>
2601 void ChannelTest<DataTraits>::CreateContent( 2653 void ChannelTest<DataTraits>::CreateContent(
2602 int flags, 2654 int flags,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
2770 }; 2822 };
2771 rtc::Buffer payload(data, 3); 2823 rtc::Buffer payload(data, 3);
2772 cricket::SendDataResult result; 2824 cricket::SendDataResult result;
2773 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); 2825 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result));
2774 EXPECT_EQ(params.ssrc, 2826 EXPECT_EQ(params.ssrc,
2775 media_channel1_->last_sent_data_params().ssrc); 2827 media_channel1_->last_sent_data_params().ssrc);
2776 EXPECT_EQ("foo", media_channel1_->last_sent_data()); 2828 EXPECT_EQ("foo", media_channel1_->last_sent_data());
2777 } 2829 }
2778 2830
2779 // TODO(pthatcher): TestSetReceiver? 2831 // TODO(pthatcher): TestSetReceiver?
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698