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

Side by Side Diff: pc/srtptransport_unittest.cc

Issue 3012953002: Created the DtlsSrtpTransport.
Patch Set: Resolved the comments. Created 3 years, 2 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 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2017 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
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 int key1_len, 303 int key1_len,
304 const uint8_t* key2, 304 const uint8_t* key2,
305 int key2_len, 305 int key2_len,
306 const std::string& cs_name) { 306 const std::string& cs_name) {
307 std::vector<int> encrypted_headers; 307 std::vector<int> encrypted_headers;
308 encrypted_headers.push_back(1); 308 encrypted_headers.push_back(1);
309 // Don't encrypt header ids 2 and 3. 309 // Don't encrypt header ids 2 and 3.
310 encrypted_headers.push_back(4); 310 encrypted_headers.push_back(4);
311 EXPECT_EQ(key1_len, key2_len); 311 EXPECT_EQ(key1_len, key2_len);
312 EXPECT_EQ(cs_name, rtc::SrtpCryptoSuiteToName(cs)); 312 EXPECT_EQ(cs_name, rtc::SrtpCryptoSuiteToName(cs));
313 srtp_transport1_->SetEncryptedHeaderExtensionIds(cricket::CS_LOCAL, 313 srtp_transport1_->SetRecvEncryptedHeaderExtensionIds(encrypted_headers);
314 encrypted_headers); 314 srtp_transport1_->SetSendEncryptedHeaderExtensionIds(encrypted_headers);
315 srtp_transport1_->SetEncryptedHeaderExtensionIds(cricket::CS_REMOTE, 315 srtp_transport2_->SetRecvEncryptedHeaderExtensionIds(encrypted_headers);
316 encrypted_headers); 316 srtp_transport2_->SetSendEncryptedHeaderExtensionIds(encrypted_headers);
317 srtp_transport2_->SetEncryptedHeaderExtensionIds(cricket::CS_LOCAL,
318 encrypted_headers);
319 srtp_transport2_->SetEncryptedHeaderExtensionIds(cricket::CS_REMOTE,
320 encrypted_headers);
321 EXPECT_TRUE( 317 EXPECT_TRUE(
322 srtp_transport1_->SetRtpParams(cs, key1, key1_len, cs, key2, key2_len)); 318 srtp_transport1_->SetRtpParams(cs, key1, key1_len, cs, key2, key2_len));
323 EXPECT_TRUE( 319 EXPECT_TRUE(
324 srtp_transport2_->SetRtpParams(cs, key2, key2_len, cs, key1, key1_len)); 320 srtp_transport2_->SetRtpParams(cs, key2, key2_len, cs, key1, key1_len));
325 EXPECT_TRUE(srtp_transport1_->IsActive()); 321 EXPECT_TRUE(srtp_transport1_->IsActive());
326 EXPECT_TRUE(srtp_transport2_->IsActive()); 322 EXPECT_TRUE(srtp_transport2_->IsActive());
327 EXPECT_FALSE(srtp_transport1_->IsExternalAuthActive()); 323 EXPECT_FALSE(srtp_transport1_->IsExternalAuthActive());
328 EXPECT_FALSE(srtp_transport2_->IsExternalAuthActive()); 324 EXPECT_FALSE(srtp_transport2_->IsExternalAuthActive());
329 TestSendRecvPacketWithEncryptedHeaderExtension(cs_name, encrypted_headers); 325 TestSendRecvPacketWithEncryptedHeaderExtension(cs_name, encrypted_headers);
330 } 326 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 TEST_F(SrtpTransportTest, TestSetParamsKeyTooShort) { 409 TEST_F(SrtpTransportTest, TestSetParamsKeyTooShort) {
414 EXPECT_FALSE(srtp_transport1_->SetRtpParams( 410 EXPECT_FALSE(srtp_transport1_->SetRtpParams(
415 rtc::SRTP_AES128_CM_SHA1_80, kTestKey1, kTestKeyLen - 1, 411 rtc::SRTP_AES128_CM_SHA1_80, kTestKey1, kTestKeyLen - 1,
416 rtc::SRTP_AES128_CM_SHA1_80, kTestKey1, kTestKeyLen - 1)); 412 rtc::SRTP_AES128_CM_SHA1_80, kTestKey1, kTestKeyLen - 1));
417 EXPECT_FALSE(srtp_transport1_->SetRtcpParams( 413 EXPECT_FALSE(srtp_transport1_->SetRtcpParams(
418 rtc::SRTP_AES128_CM_SHA1_80, kTestKey1, kTestKeyLen - 1, 414 rtc::SRTP_AES128_CM_SHA1_80, kTestKey1, kTestKeyLen - 1,
419 rtc::SRTP_AES128_CM_SHA1_80, kTestKey1, kTestKeyLen - 1)); 415 rtc::SRTP_AES128_CM_SHA1_80, kTestKey1, kTestKeyLen - 1));
420 } 416 }
421 417
422 } // namespace webrtc 418 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698