| OLD | NEW |
| 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 30 matching lines...) Expand all Loading... |
| 41 using cricket::ConnectionRole; | 41 using cricket::ConnectionRole; |
| 42 | 42 |
| 43 enum Flags { NF_REOFFER = 0x1, NF_EXPECT_FAILURE = 0x2 }; | 43 enum Flags { NF_REOFFER = 0x1, NF_EXPECT_FAILURE = 0x2 }; |
| 44 | 44 |
| 45 class DtlsTestClient : public sigslot::has_slots<> { | 45 class DtlsTestClient : public sigslot::has_slots<> { |
| 46 public: | 46 public: |
| 47 DtlsTestClient(const std::string& name) | 47 DtlsTestClient(const std::string& name) |
| 48 : name_(name), | 48 : name_(name), |
| 49 packet_size_(0), | 49 packet_size_(0), |
| 50 use_dtls_srtp_(false), | 50 use_dtls_srtp_(false), |
| 51 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10), | 51 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_12), |
| 52 negotiated_dtls_(false), | 52 negotiated_dtls_(false), |
| 53 received_dtls_client_hello_(false), | 53 received_dtls_client_hello_(false), |
| 54 received_dtls_server_hello_(false) {} | 54 received_dtls_server_hello_(false) {} |
| 55 void CreateCertificate(rtc::KeyType key_type) { | 55 void CreateCertificate(rtc::KeyType key_type) { |
| 56 certificate_ = | 56 certificate_ = |
| 57 rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>( | 57 rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>( |
| 58 rtc::SSLIdentity::Generate(name_, key_type))); | 58 rtc::SSLIdentity::Generate(name_, key_type))); |
| 59 } | 59 } |
| 60 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate() { | 60 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate() { |
| 61 return certificate_; | 61 return certificate_; |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 393 |
| 394 | 394 |
| 395 class DtlsTransportChannelTest : public testing::Test { | 395 class DtlsTransportChannelTest : public testing::Test { |
| 396 public: | 396 public: |
| 397 DtlsTransportChannelTest() | 397 DtlsTransportChannelTest() |
| 398 : client1_("P1"), | 398 : client1_("P1"), |
| 399 client2_("P2"), | 399 client2_("P2"), |
| 400 channel_ct_(1), | 400 channel_ct_(1), |
| 401 use_dtls_(false), | 401 use_dtls_(false), |
| 402 use_dtls_srtp_(false), | 402 use_dtls_srtp_(false), |
| 403 ssl_expected_version_(rtc::SSL_PROTOCOL_DTLS_10) {} | 403 ssl_expected_version_(rtc::SSL_PROTOCOL_DTLS_12) {} |
| 404 | 404 |
| 405 void SetChannelCount(size_t channel_ct) { | 405 void SetChannelCount(size_t channel_ct) { |
| 406 channel_ct_ = static_cast<int>(channel_ct); | 406 channel_ct_ = static_cast<int>(channel_ct); |
| 407 } | 407 } |
| 408 void SetMaxProtocolVersions(rtc::SSLProtocolVersion c1, | 408 void SetMaxProtocolVersions(rtc::SSLProtocolVersion c1, |
| 409 rtc::SSLProtocolVersion c2) { | 409 rtc::SSLProtocolVersion c2) { |
| 410 client1_.SetupMaxProtocolVersion(c1); | 410 client1_.SetupMaxProtocolVersion(c1); |
| 411 client2_.SetupMaxProtocolVersion(c2); | 411 client2_.SetupMaxProtocolVersion(c2); |
| 412 ssl_expected_version_ = std::min(c1, c2); | 412 ssl_expected_version_ = std::min(c1, c2); |
| 413 } | 413 } |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 // Each side's remote certificate is the other side's local certificate. | 891 // Each side's remote certificate is the other side's local certificate. |
| 892 ASSERT_TRUE( | 892 ASSERT_TRUE( |
| 893 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept())); | 893 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept())); |
| 894 ASSERT_EQ(remote_cert1->ToPEMString(), | 894 ASSERT_EQ(remote_cert1->ToPEMString(), |
| 895 certificate2->ssl_certificate().ToPEMString()); | 895 certificate2->ssl_certificate().ToPEMString()); |
| 896 ASSERT_TRUE( | 896 ASSERT_TRUE( |
| 897 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept())); | 897 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept())); |
| 898 ASSERT_EQ(remote_cert2->ToPEMString(), | 898 ASSERT_EQ(remote_cert2->ToPEMString(), |
| 899 certificate1->ssl_certificate().ToPEMString()); | 899 certificate1->ssl_certificate().ToPEMString()); |
| 900 } | 900 } |
| OLD | NEW |