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

Side by Side Diff: webrtc/pc/srtpfilter_unittest.cc

Issue 2761143002: Support encrypted RTP extensions (RFC 6904) (Closed)
Patch Set: More updates + support for adding/changing encrypted extensions. Created 3 years, 8 months 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 * Copyright 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2004 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 <algorithm>
12
11 #include "webrtc/pc/srtpfilter.h" 13 #include "webrtc/pc/srtpfilter.h"
12 14
13 #include "third_party/libsrtp/include/srtp.h" 15 #include "third_party/libsrtp/include/srtp.h"
14 #include "webrtc/base/buffer.h" 16 #include "webrtc/base/buffer.h"
15 #include "webrtc/base/byteorder.h" 17 #include "webrtc/base/byteorder.h"
16 #include "webrtc/base/constructormagic.h" 18 #include "webrtc/base/constructormagic.h"
17 #include "webrtc/base/gunit.h" 19 #include "webrtc/base/gunit.h"
18 #include "webrtc/base/thread.h" 20 #include "webrtc/base/thread.h"
19 #include "webrtc/media/base/cryptoparams.h" 21 #include "webrtc/media/base/cryptoparams.h"
20 #include "webrtc/media/base/fakertp.h" 22 #include "webrtc/media/base/fakertp.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 static const cricket::CryptoParams kTestCryptoParams2( 62 static const cricket::CryptoParams kTestCryptoParams2(
61 1, "AES_CM_128_HMAC_SHA1_80", kTestKeyParams2, ""); 63 1, "AES_CM_128_HMAC_SHA1_80", kTestKeyParams2, "");
62 static const cricket::CryptoParams kTestCryptoParamsGcm1( 64 static const cricket::CryptoParams kTestCryptoParamsGcm1(
63 1, "AEAD_AES_256_GCM", kTestKeyParamsGcm1, ""); 65 1, "AEAD_AES_256_GCM", kTestKeyParamsGcm1, "");
64 static const cricket::CryptoParams kTestCryptoParamsGcm2( 66 static const cricket::CryptoParams kTestCryptoParamsGcm2(
65 1, "AEAD_AES_256_GCM", kTestKeyParamsGcm2, ""); 67 1, "AEAD_AES_256_GCM", kTestKeyParamsGcm2, "");
66 static const cricket::CryptoParams kTestCryptoParamsGcm3( 68 static const cricket::CryptoParams kTestCryptoParamsGcm3(
67 1, "AEAD_AES_128_GCM", kTestKeyParamsGcm3, ""); 69 1, "AEAD_AES_128_GCM", kTestKeyParamsGcm3, "");
68 static const cricket::CryptoParams kTestCryptoParamsGcm4( 70 static const cricket::CryptoParams kTestCryptoParamsGcm4(
69 1, "AEAD_AES_128_GCM", kTestKeyParamsGcm4, ""); 71 1, "AEAD_AES_128_GCM", kTestKeyParamsGcm4, "");
72 static const char kDummyExtensionUri1[] = "dummy-extension-uri-1";
73 static const char kDummyExtensionUri4[] = "dummy-extension-uri-4";
70 74
71 static int rtp_auth_tag_len(const std::string& cs) { 75 static int rtp_auth_tag_len(const std::string& cs) {
72 if (cs == CS_AES_CM_128_HMAC_SHA1_32) { 76 if (cs == CS_AES_CM_128_HMAC_SHA1_32) {
73 return 4; 77 return 4;
74 } else if (cs == CS_AEAD_AES_128_GCM || cs == CS_AEAD_AES_256_GCM) { 78 } else if (cs == CS_AEAD_AES_128_GCM || cs == CS_AEAD_AES_256_GCM) {
75 return 16; 79 return 16;
76 } else { 80 } else {
77 return 10; 81 return 10;
78 } 82 }
79 } 83 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 190
187 EXPECT_TRUE(f2_.ProtectRtcp(rtcp_packet, rtcp_len, 191 EXPECT_TRUE(f2_.ProtectRtcp(rtcp_packet, rtcp_len,
188 static_cast<int>(rtcp_buffer.size()), 192 static_cast<int>(rtcp_buffer.size()),
189 &out_len)); 193 &out_len));
190 EXPECT_EQ(out_len, rtcp_len + 4 + rtcp_auth_tag_len(cs2)); // NOLINT 194 EXPECT_EQ(out_len, rtcp_len + 4 + rtcp_auth_tag_len(cs2)); // NOLINT
191 EXPECT_NE(0, memcmp(rtcp_packet, kRtcpReport, rtcp_len)); 195 EXPECT_NE(0, memcmp(rtcp_packet, kRtcpReport, rtcp_len));
192 EXPECT_TRUE(f1_.UnprotectRtcp(rtcp_packet, out_len, &out_len)); 196 EXPECT_TRUE(f1_.UnprotectRtcp(rtcp_packet, out_len, &out_len));
193 EXPECT_EQ(rtcp_len, out_len); 197 EXPECT_EQ(rtcp_len, out_len);
194 EXPECT_EQ(0, memcmp(rtcp_packet, kRtcpReport, rtcp_len)); 198 EXPECT_EQ(0, memcmp(rtcp_packet, kRtcpReport, rtcp_len));
195 } 199 }
200 // This expects both packets to be based on kPcmuFrameWithExtensions.
201 // Header extensions with an id in "encrypted_headers" are expected to be
202 // different in the packets unless "expect_equal" is set to "true".
203 void CompareHeaderExtensions(const char* packet1, const char* packet2,
204 const std::vector<int> encrypted_headers,
205 bool expect_equal) {
206 // RTP header + extension header are the same.
207 EXPECT_EQ(0, memcmp(packet1, packet2, 12 + 4));
208 // Check for one-byte header extensions.
209 EXPECT_EQ('\xBE', packet1[12]);
210 EXPECT_EQ('\xDE', packet1[13]);
211 // Determine position and size of extension headers.
212 size_t extension_words = packet1[14] << 8 | packet1[15];
213 const char* extension_data1 = packet1 + 12 + 4;
214 const char* extension_end1 = extension_data1 + extension_words * 4;
215 const char* extension_data2 = packet2 + 12 + 4;
216 while (extension_data1 < extension_end1) {
217 uint8_t id = (*extension_data1 & 0xf0) >> 4;
218 uint8_t len = (*extension_data1 & 0x0f) +1;
219 extension_data1++;
220 extension_data2++;
221 EXPECT_LE(extension_data1, extension_end1);
222 if (id == 15) {
223 // Finished parsing.
224 break;
225 }
226
227 // The header extension doesn't get encrypted if the id not in the list
228 // of header extensions to encrypt.
229 if (expect_equal ||
230 std::find(encrypted_headers.begin(), encrypted_headers.end(), id) ==
231 encrypted_headers.end()) {
232 EXPECT_EQ(0, memcmp(extension_data1, extension_data2, len));
233 } else {
234 EXPECT_NE(0, memcmp(extension_data1, extension_data2, len));
235 }
236
237 extension_data1 += len;
238 extension_data2 += len;
239 // Skip padding.
240 while (extension_data1 < extension_end1 && *extension_data1 == 0) {
241 extension_data1++;
242 extension_data2++;
243 }
244 }
245 }
246 void TestProtectUnprotectHeaderEncryption(const std::string& cs1,
247 const std::string& cs2,
248 const std::vector<webrtc::RtpExtension>& encrypted_headers) {
249 rtc::Buffer rtp_buffer(sizeof(kPcmuFrameWithExtensions) +
250 rtp_auth_tag_len(cs1));
251 char* rtp_packet = rtp_buffer.data<char>();
252 char original_rtp_packet[sizeof(kPcmuFrameWithExtensions)];
253 int rtp_len = sizeof(kPcmuFrameWithExtensions), out_len;
254 memcpy(rtp_packet, kPcmuFrameWithExtensions, rtp_len);
255 // In order to be able to run this test function multiple times we can not
256 // use the same sequence number twice. Increase the sequence number by one.
257 rtc::SetBE16(reinterpret_cast<uint8_t*>(rtp_packet) + 2,
258 ++sequence_number_);
259 memcpy(original_rtp_packet, rtp_packet, rtp_len);
260
261 std::vector<int> encrypted_header_ids;
262 for (const webrtc::RtpExtension& extension : encrypted_headers) {
263 EXPECT_TRUE(extension.encrypt);
264 encrypted_header_ids.push_back(extension.id);
265 }
266
267 EXPECT_TRUE(f1_.ProtectRtp(rtp_packet, rtp_len,
268 static_cast<int>(rtp_buffer.size()),
269 &out_len));
270 EXPECT_EQ(out_len, rtp_len + rtp_auth_tag_len(cs1));
271 EXPECT_NE(0, memcmp(rtp_packet, original_rtp_packet, rtp_len));
272 CompareHeaderExtensions(rtp_packet, original_rtp_packet,
273 encrypted_header_ids, false);
274 EXPECT_TRUE(f2_.UnprotectRtp(rtp_packet, out_len, &out_len));
275 EXPECT_EQ(rtp_len, out_len);
276 EXPECT_EQ(0, memcmp(rtp_packet, original_rtp_packet, rtp_len));
277 CompareHeaderExtensions(rtp_packet, original_rtp_packet,
278 encrypted_header_ids, true);
279
280 EXPECT_TRUE(f2_.ProtectRtp(rtp_packet, rtp_len,
281 static_cast<int>(rtp_buffer.size()),
282 &out_len));
283 EXPECT_EQ(out_len, rtp_len + rtp_auth_tag_len(cs2));
284 EXPECT_NE(0, memcmp(rtp_packet, original_rtp_packet, rtp_len));
285 CompareHeaderExtensions(rtp_packet, original_rtp_packet,
286 encrypted_header_ids, false);
287 EXPECT_TRUE(f1_.UnprotectRtp(rtp_packet, out_len, &out_len));
288 EXPECT_EQ(rtp_len, out_len);
289 EXPECT_EQ(0, memcmp(rtp_packet, original_rtp_packet, rtp_len));
290 CompareHeaderExtensions(rtp_packet, original_rtp_packet,
291 encrypted_header_ids, true);
292 }
196 void TestProtectSetParamsDirect(bool enable_external_auth, int cs, 293 void TestProtectSetParamsDirect(bool enable_external_auth, int cs,
197 const uint8_t* key1, int key1_len, const uint8_t* key2, int key2_len, 294 const uint8_t* key1, int key1_len, const uint8_t* key2, int key2_len,
198 const std::string& cs_name) { 295 const std::string& cs_name) {
199 EXPECT_EQ(key1_len, key2_len); 296 EXPECT_EQ(key1_len, key2_len);
200 EXPECT_EQ(cs_name, rtc::SrtpCryptoSuiteToName(cs)); 297 EXPECT_EQ(cs_name, rtc::SrtpCryptoSuiteToName(cs));
201 if (enable_external_auth) { 298 if (enable_external_auth) {
202 f1_.EnableExternalAuth(); 299 f1_.EnableExternalAuth();
203 f2_.EnableExternalAuth(); 300 f2_.EnableExternalAuth();
204 } 301 }
205 EXPECT_TRUE(f1_.SetRtpParams(cs, key1, key1_len, cs, key2, key2_len)); 302 EXPECT_TRUE(f1_.SetRtpParams(cs, key1, key1_len, cs, key2, key2_len));
206 EXPECT_TRUE(f2_.SetRtpParams(cs, key2, key2_len, cs, key1, key1_len)); 303 EXPECT_TRUE(f2_.SetRtpParams(cs, key2, key2_len, cs, key1, key1_len));
207 EXPECT_TRUE(f1_.SetRtcpParams(cs, key1, key1_len, cs, key2, key2_len)); 304 EXPECT_TRUE(f1_.SetRtcpParams(cs, key1, key1_len, cs, key2, key2_len));
208 EXPECT_TRUE(f2_.SetRtcpParams(cs, key2, key2_len, cs, key1, key1_len)); 305 EXPECT_TRUE(f2_.SetRtcpParams(cs, key2, key2_len, cs, key1, key1_len));
209 EXPECT_TRUE(f1_.IsActive()); 306 EXPECT_TRUE(f1_.IsActive());
210 EXPECT_TRUE(f2_.IsActive()); 307 EXPECT_TRUE(f2_.IsActive());
211 if (rtc::IsGcmCryptoSuite(cs)) { 308 if (rtc::IsGcmCryptoSuite(cs)) {
212 EXPECT_FALSE(f1_.IsExternalAuthActive()); 309 EXPECT_FALSE(f1_.IsExternalAuthActive());
213 EXPECT_FALSE(f2_.IsExternalAuthActive()); 310 EXPECT_FALSE(f2_.IsExternalAuthActive());
214 } else if (enable_external_auth) { 311 } else if (enable_external_auth) {
215 EXPECT_TRUE(f1_.IsExternalAuthActive()); 312 EXPECT_TRUE(f1_.IsExternalAuthActive());
216 EXPECT_TRUE(f2_.IsExternalAuthActive()); 313 EXPECT_TRUE(f2_.IsExternalAuthActive());
217 } 314 }
218 TestProtectUnprotect(cs_name, cs_name); 315 TestProtectUnprotect(cs_name, cs_name);
219 } 316 }
317 void TestProtectSetParamsDirectHeaderEncryption(int cs,
318 const uint8_t* key1, int key1_len, const uint8_t* key2, int key2_len,
319 const std::string& cs_name) {
320 std::vector<webrtc::RtpExtension> encrypted_headers;
321 encrypted_headers.push_back(
322 webrtc::RtpExtension(kDummyExtensionUri1, 1, true));
323 // Don't encrypt header ids 2 and 3.
324 encrypted_headers.push_back(
325 webrtc::RtpExtension(kDummyExtensionUri4, 4, true));
326 EXPECT_EQ(key1_len, key2_len);
327 EXPECT_EQ(cs_name, rtc::SrtpCryptoSuiteToName(cs));
328 f1_.SetEncryptedHeaderExtensions(CS_LOCAL, encrypted_headers);
329 f1_.SetEncryptedHeaderExtensions(CS_REMOTE, encrypted_headers);
330 f2_.SetEncryptedHeaderExtensions(CS_LOCAL, encrypted_headers);
331 f2_.SetEncryptedHeaderExtensions(CS_REMOTE, encrypted_headers);
332 EXPECT_TRUE(f1_.SetRtpParams(cs, key1, key1_len, cs, key2, key2_len));
333 EXPECT_TRUE(f2_.SetRtpParams(cs, key2, key2_len, cs, key1, key1_len));
334 EXPECT_TRUE(f1_.IsActive());
335 EXPECT_TRUE(f2_.IsActive());
336 EXPECT_FALSE(f1_.IsExternalAuthActive());
337 EXPECT_FALSE(f2_.IsExternalAuthActive());
338 TestProtectUnprotectHeaderEncryption(cs_name, cs_name, encrypted_headers);
339 }
220 cricket::SrtpFilter f1_; 340 cricket::SrtpFilter f1_;
221 cricket::SrtpFilter f2_; 341 cricket::SrtpFilter f2_;
222 int sequence_number_; 342 int sequence_number_;
223 }; 343 };
224 344
225 // Test that we can set up the session and keys properly. 345 // Test that we can set up the session and keys properly.
226 TEST_F(SrtpFilterTest, TestGoodSetupOneCipherSuite) { 346 TEST_F(SrtpFilterTest, TestGoodSetupOneCipherSuite) {
227 EXPECT_TRUE(f1_.SetOffer(MakeVector(kTestCryptoParams1), CS_LOCAL)); 347 EXPECT_TRUE(f1_.SetOffer(MakeVector(kTestCryptoParams1), CS_LOCAL));
228 EXPECT_FALSE(f1_.IsActive()); 348 EXPECT_FALSE(f1_.IsActive());
229 EXPECT_TRUE(f1_.SetAnswer(MakeVector(kTestCryptoParams2), CS_REMOTE)); 349 EXPECT_TRUE(f1_.SetAnswer(MakeVector(kTestCryptoParams2), CS_REMOTE));
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 }; 732 };
613 733
614 // Test directly setting the params with AES_CM_128_HMAC_SHA1_80. 734 // Test directly setting the params with AES_CM_128_HMAC_SHA1_80.
615 TEST_P(SrtpFilterProtectSetParamsDirectTest, Test_AES_CM_128_HMAC_SHA1_80) { 735 TEST_P(SrtpFilterProtectSetParamsDirectTest, Test_AES_CM_128_HMAC_SHA1_80) {
616 bool enable_external_auth = GetParam(); 736 bool enable_external_auth = GetParam();
617 TestProtectSetParamsDirect(enable_external_auth, rtc::SRTP_AES128_CM_SHA1_80, 737 TestProtectSetParamsDirect(enable_external_auth, rtc::SRTP_AES128_CM_SHA1_80,
618 kTestKey1, kTestKeyLen, kTestKey2, kTestKeyLen, 738 kTestKey1, kTestKeyLen, kTestKey2, kTestKeyLen,
619 CS_AES_CM_128_HMAC_SHA1_80); 739 CS_AES_CM_128_HMAC_SHA1_80);
620 } 740 }
621 741
742 TEST_F(SrtpFilterTest,
743 TestProtectSetParamsDirectHeaderEncryption_AES_CM_128_HMAC_SHA1_80) {
744 TestProtectSetParamsDirectHeaderEncryption(rtc::SRTP_AES128_CM_SHA1_80,
745 kTestKey1, kTestKeyLen, kTestKey2, kTestKeyLen,
746 CS_AES_CM_128_HMAC_SHA1_80);
747 }
748
622 // Test directly setting the params with AES_CM_128_HMAC_SHA1_32. 749 // Test directly setting the params with AES_CM_128_HMAC_SHA1_32.
623 TEST_P(SrtpFilterProtectSetParamsDirectTest, Test_AES_CM_128_HMAC_SHA1_32) { 750 TEST_P(SrtpFilterProtectSetParamsDirectTest, Test_AES_CM_128_HMAC_SHA1_32) {
624 bool enable_external_auth = GetParam(); 751 bool enable_external_auth = GetParam();
625 TestProtectSetParamsDirect(enable_external_auth, rtc::SRTP_AES128_CM_SHA1_32, 752 TestProtectSetParamsDirect(enable_external_auth, rtc::SRTP_AES128_CM_SHA1_32,
626 kTestKey1, kTestKeyLen, kTestKey2, kTestKeyLen, 753 kTestKey1, kTestKeyLen, kTestKey2, kTestKeyLen,
627 CS_AES_CM_128_HMAC_SHA1_32); 754 CS_AES_CM_128_HMAC_SHA1_32);
628 } 755 }
629 756
757 TEST_F(SrtpFilterTest,
758 TestProtectSetParamsDirectHeaderEncryption_AES_CM_128_HMAC_SHA1_32) {
759 TestProtectSetParamsDirectHeaderEncryption(rtc::SRTP_AES128_CM_SHA1_32,
760 kTestKey1, kTestKeyLen, kTestKey2, kTestKeyLen,
761 CS_AES_CM_128_HMAC_SHA1_32);
762 }
763
630 // Test directly setting the params with SRTP_AEAD_AES_128_GCM. 764 // Test directly setting the params with SRTP_AEAD_AES_128_GCM.
631 TEST_P(SrtpFilterProtectSetParamsDirectTest, Test_SRTP_AEAD_AES_128_GCM) { 765 TEST_P(SrtpFilterProtectSetParamsDirectTest, Test_SRTP_AEAD_AES_128_GCM) {
632 bool enable_external_auth = GetParam(); 766 bool enable_external_auth = GetParam();
633 TestProtectSetParamsDirect(enable_external_auth, rtc::SRTP_AEAD_AES_128_GCM, 767 TestProtectSetParamsDirect(enable_external_auth, rtc::SRTP_AEAD_AES_128_GCM,
634 kTestKeyGcm128_1, kTestKeyGcm128Len, kTestKeyGcm128_2, kTestKeyGcm128Len, 768 kTestKeyGcm128_1, kTestKeyGcm128Len, kTestKeyGcm128_2, kTestKeyGcm128Len,
635 CS_AEAD_AES_128_GCM); 769 CS_AEAD_AES_128_GCM);
636 } 770 }
637 771
772 TEST_F(SrtpFilterTest,
773 TestProtectSetParamsDirectHeaderEncryption_SRTP_AEAD_AES_128_GCM) {
774 TestProtectSetParamsDirectHeaderEncryption(rtc::SRTP_AEAD_AES_128_GCM,
775 kTestKeyGcm128_1, kTestKeyGcm128Len, kTestKeyGcm128_2, kTestKeyGcm128Len,
776 CS_AEAD_AES_128_GCM);
777 }
778
638 // Test directly setting the params with SRTP_AEAD_AES_256_GCM. 779 // Test directly setting the params with SRTP_AEAD_AES_256_GCM.
639 TEST_P(SrtpFilterProtectSetParamsDirectTest, Test_SRTP_AEAD_AES_256_GCM) { 780 TEST_P(SrtpFilterProtectSetParamsDirectTest, Test_SRTP_AEAD_AES_256_GCM) {
640 bool enable_external_auth = GetParam(); 781 bool enable_external_auth = GetParam();
641 TestProtectSetParamsDirect(enable_external_auth, rtc::SRTP_AEAD_AES_256_GCM, 782 TestProtectSetParamsDirect(enable_external_auth, rtc::SRTP_AEAD_AES_256_GCM,
642 kTestKeyGcm256_1, kTestKeyGcm256Len, kTestKeyGcm256_2, kTestKeyGcm256Len, 783 kTestKeyGcm256_1, kTestKeyGcm256Len, kTestKeyGcm256_2, kTestKeyGcm256Len,
643 CS_AEAD_AES_256_GCM); 784 CS_AEAD_AES_256_GCM);
644 } 785 }
645 786
787 TEST_F(SrtpFilterTest,
788 TestProtectSetParamsDirectHeaderEncryption_SRTP_AEAD_AES_256_GCM) {
789 TestProtectSetParamsDirectHeaderEncryption(rtc::SRTP_AEAD_AES_256_GCM,
790 kTestKeyGcm256_1, kTestKeyGcm256Len, kTestKeyGcm256_2, kTestKeyGcm256Len,
791 CS_AEAD_AES_256_GCM);
792 }
793
646 // Run all tests both with and without external auth enabled. 794 // Run all tests both with and without external auth enabled.
647 INSTANTIATE_TEST_CASE_P(ExternalAuth, 795 INSTANTIATE_TEST_CASE_P(ExternalAuth,
648 SrtpFilterProtectSetParamsDirectTest, 796 SrtpFilterProtectSetParamsDirectTest,
649 ::testing::Values(true, false)); 797 ::testing::Values(true, false));
650 798
651 // Test directly setting the params with bogus keys. 799 // Test directly setting the params with bogus keys.
652 TEST_F(SrtpFilterTest, TestSetParamsKeyTooShort) { 800 TEST_F(SrtpFilterTest, TestSetParamsKeyTooShort) {
653 EXPECT_FALSE(f1_.SetRtpParams(rtc::SRTP_AES128_CM_SHA1_80, kTestKey1, 801 EXPECT_FALSE(f1_.SetRtpParams(rtc::SRTP_AES128_CM_SHA1_80, kTestKey1,
654 kTestKeyLen - 1, rtc::SRTP_AES128_CM_SHA1_80, 802 kTestKeyLen - 1, rtc::SRTP_AES128_CM_SHA1_80,
655 kTestKey1, kTestKeyLen - 1)); 803 kTestKey1, kTestKeyLen - 1));
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 srtp_stat_.AddUnprotectRtcpResult(srtp_err_status_fail); 1151 srtp_stat_.AddUnprotectRtcpResult(srtp_err_status_fail);
1004 EXPECT_EQ(-1, mode_); 1152 EXPECT_EQ(-1, mode_);
1005 EXPECT_EQ(cricket::SrtpFilter::ERROR_NONE, error_); 1153 EXPECT_EQ(cricket::SrtpFilter::ERROR_NONE, error_);
1006 // Now the error will be triggered again. 1154 // Now the error will be triggered again.
1007 Reset(); 1155 Reset();
1008 rtc::Thread::Current()->SleepMs(210); 1156 rtc::Thread::Current()->SleepMs(210);
1009 srtp_stat_.AddUnprotectRtcpResult(srtp_err_status_fail); 1157 srtp_stat_.AddUnprotectRtcpResult(srtp_err_status_fail);
1010 EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, mode_); 1158 EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, mode_);
1011 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_); 1159 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_);
1012 } 1160 }
OLDNEW
« webrtc/pc/mediasession.cc ('K') | « webrtc/pc/srtpfilter.cc ('k') | webrtc/pc/webrtcsdp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698