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

Side by Side Diff: webrtc/p2p/base/dtlstransportchannel_unittest.cc

Issue 1337673002: Change WebRTC SslCipher to be exposed as number only. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 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 2011 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2011 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 if (negotiated_dtls_ && !expected_cipher.empty()) { 215 if (negotiated_dtls_ && !expected_cipher.empty()) {
216 ASSERT_TRUE(rv); 216 ASSERT_TRUE(rv);
217 217
218 ASSERT_EQ(cipher, expected_cipher); 218 ASSERT_EQ(cipher, expected_cipher);
219 } else { 219 } else {
220 ASSERT_FALSE(rv); 220 ASSERT_FALSE(rv);
221 } 221 }
222 } 222 }
223 } 223 }
224 224
225 void CheckSsl(const std::string& expected_cipher) { 225 void CheckSsl(uint16_t expected_cipher) {
226 for (std::vector<cricket::DtlsTransportChannelWrapper*>::iterator it = 226 for (std::vector<cricket::DtlsTransportChannelWrapper*>::iterator it =
227 channels_.begin(); it != channels_.end(); ++it) { 227 channels_.begin(); it != channels_.end(); ++it) {
228 std::string cipher; 228 uint16_t cipher;
229 229
230 bool rv = (*it)->GetSslCipher(&cipher); 230 bool rv = (*it)->GetSslCipher(&cipher);
231 if (negotiated_dtls_ && !expected_cipher.empty()) { 231 if (negotiated_dtls_ && !expected_cipher) {
232 ASSERT_TRUE(rv); 232 ASSERT_TRUE(rv);
233 233
234 ASSERT_EQ(cipher, expected_cipher); 234 ASSERT_EQ(cipher, expected_cipher);
235 } else { 235 } else {
236 ASSERT_FALSE(rv); 236 ASSERT_FALSE(rv);
237 } 237 }
238 } 238 }
239 } 239 }
240 240
241 void SendPackets(size_t channel, size_t size, size_t count, bool srtp) { 241 void SendPackets(size_t channel, size_t size, size_t count, bool srtp) {
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 } 455 }
456 456
457 // Check that we negotiated the right ciphers. 457 // Check that we negotiated the right ciphers.
458 if (use_dtls_srtp_) { 458 if (use_dtls_srtp_) {
459 client1_.CheckSrtp(AES_CM_128_HMAC_SHA1_80); 459 client1_.CheckSrtp(AES_CM_128_HMAC_SHA1_80);
460 client2_.CheckSrtp(AES_CM_128_HMAC_SHA1_80); 460 client2_.CheckSrtp(AES_CM_128_HMAC_SHA1_80);
461 } else { 461 } else {
462 client1_.CheckSrtp(""); 462 client1_.CheckSrtp("");
463 client2_.CheckSrtp(""); 463 client2_.CheckSrtp("");
464 } 464 }
465 client1_.CheckSsl( 465 client1_.CheckSsl(rtc::SSLStreamAdapter::GetDefaultSslCipherForTest(
466 rtc::SSLStreamAdapter::GetDefaultSslCipher(ssl_expected_version_)); 466 ssl_expected_version_, rtc::KT_DEFAULT));
467 client2_.CheckSsl( 467 client2_.CheckSsl(rtc::SSLStreamAdapter::GetDefaultSslCipherForTest(
468 rtc::SSLStreamAdapter::GetDefaultSslCipher(ssl_expected_version_)); 468 ssl_expected_version_, rtc::KT_DEFAULT));
469 469
470 return true; 470 return true;
471 } 471 }
472 472
473 bool Connect() { 473 bool Connect() {
474 // By default, Client1 will be Server and Client2 will be Client. 474 // By default, Client1 will be Server and Client2 will be Client.
475 return Connect(cricket::CONNECTIONROLE_ACTPASS, 475 return Connect(cricket::CONNECTIONROLE_ACTPASS,
476 cricket::CONNECTIONROLE_ACTIVE); 476 cricket::CONNECTIONROLE_ACTIVE);
477 } 477 }
478 478
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 // Each side's remote certificate is the other side's local certificate. 863 // Each side's remote certificate is the other side's local certificate.
864 ASSERT_TRUE( 864 ASSERT_TRUE(
865 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept())); 865 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept()));
866 ASSERT_EQ(remote_cert1->ToPEMString(), 866 ASSERT_EQ(remote_cert1->ToPEMString(),
867 certificate2->ssl_certificate().ToPEMString()); 867 certificate2->ssl_certificate().ToPEMString());
868 ASSERT_TRUE( 868 ASSERT_TRUE(
869 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept())); 869 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept()));
870 ASSERT_EQ(remote_cert2->ToPEMString(), 870 ASSERT_EQ(remote_cert2->ToPEMString(),
871 certificate1->ssl_certificate().ToPEMString()); 871 certificate1->ssl_certificate().ToPEMString());
872 } 872 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698