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

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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 ASSERT_EQ(cipher, expected_cipher); 223 ASSERT_EQ(cipher, expected_cipher);
224 } else { 224 } else {
225 ASSERT_FALSE(rv); 225 ASSERT_FALSE(rv);
226 } 226 }
227 } 227 }
228 } 228 }
229 229
230 void CheckSsl(const std::string& expected_cipher) { 230 void CheckSsl(const std::string& expected_cipher) {
231 for (std::vector<cricket::DtlsTransportChannelWrapper*>::iterator it = 231 for (std::vector<cricket::DtlsTransportChannelWrapper*>::iterator it =
232 channels_.begin(); it != channels_.end(); ++it) { 232 channels_.begin(); it != channels_.end(); ++it) {
233 std::string cipher; 233 rtc::SslCipher cipher;
234 234
235 bool rv = (*it)->GetSslCipher(&cipher); 235 bool rv = (*it)->GetSslCipher(&cipher);
236 if (negotiated_dtls_ && !expected_cipher.empty()) { 236 if (negotiated_dtls_ && !expected_cipher.empty()) {
237 ASSERT_TRUE(rv); 237 ASSERT_TRUE(rv);
238 238
239 ASSERT_EQ(cipher, expected_cipher); 239 ASSERT_EQ(cipher.rfc_name, expected_cipher);
240 } else { 240 } else {
241 ASSERT_FALSE(rv); 241 ASSERT_FALSE(rv);
242 } 242 }
243 } 243 }
244 } 244 }
245 245
246 void SendPackets(size_t channel, size_t size, size_t count, bool srtp) { 246 void SendPackets(size_t channel, size_t size, size_t count, bool srtp) {
247 ASSERT(channel < channels_.size()); 247 ASSERT(channel < channels_.size());
248 rtc::scoped_ptr<char[]> packet(new char[size]); 248 rtc::scoped_ptr<char[]> packet(new char[size]);
249 size_t sent = 0; 249 size_t sent = 0;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 } 463 }
464 464
465 // Check that we negotiated the right ciphers. 465 // Check that we negotiated the right ciphers.
466 if (use_dtls_srtp_) { 466 if (use_dtls_srtp_) {
467 client1_.CheckSrtp(AES_CM_128_HMAC_SHA1_80); 467 client1_.CheckSrtp(AES_CM_128_HMAC_SHA1_80);
468 client2_.CheckSrtp(AES_CM_128_HMAC_SHA1_80); 468 client2_.CheckSrtp(AES_CM_128_HMAC_SHA1_80);
469 } else { 469 } else {
470 client1_.CheckSrtp(""); 470 client1_.CheckSrtp("");
471 client2_.CheckSrtp(""); 471 client2_.CheckSrtp("");
472 } 472 }
473 client1_.CheckSsl( 473 client1_.CheckSsl(rtc::SSLStreamAdapter::GetDefaultSslCipher(
474 rtc::SSLStreamAdapter::GetDefaultSslCipher(ssl_expected_version_)); 474 ssl_expected_version_).rfc_name);
475 client2_.CheckSsl( 475 client2_.CheckSsl(rtc::SSLStreamAdapter::GetDefaultSslCipher(
476 rtc::SSLStreamAdapter::GetDefaultSslCipher(ssl_expected_version_)); 476 ssl_expected_version_).rfc_name);
477 477
478 return true; 478 return true;
479 } 479 }
480 480
481 bool Connect() { 481 bool Connect() {
482 // By default, Client1 will be Server and Client2 will be Client. 482 // By default, Client1 will be Server and Client2 will be Client.
483 return Connect(cricket::CONNECTIONROLE_ACTPASS, 483 return Connect(cricket::CONNECTIONROLE_ACTPASS,
484 cricket::CONNECTIONROLE_ACTIVE); 484 cricket::CONNECTIONROLE_ACTIVE);
485 } 485 }
486 486
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 // Each side's remote certificate is the other side's local certificate. 869 // Each side's remote certificate is the other side's local certificate.
870 ASSERT_TRUE( 870 ASSERT_TRUE(
871 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept())); 871 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept()));
872 ASSERT_EQ(remote_cert1->ToPEMString(), 872 ASSERT_EQ(remote_cert1->ToPEMString(),
873 certificate2->ssl_certificate().ToPEMString()); 873 certificate2->ssl_certificate().ToPEMString());
874 ASSERT_TRUE( 874 ASSERT_TRUE(
875 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept())); 875 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept()));
876 ASSERT_EQ(remote_cert2->ToPEMString(), 876 ASSERT_EQ(remote_cert2->ToPEMString(),
877 certificate1->ssl_certificate().ToPEMString()); 877 certificate1->ssl_certificate().ToPEMString());
878 } 878 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698