| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 // Tests that VerifyCertificateFingerprint only returns true when the | 238 // Tests that VerifyCertificateFingerprint only returns true when the |
| 239 // certificate matches the fingerprint. | 239 // certificate matches the fingerprint. |
| 240 TEST_F(TransportTest, TestVerifyCertificateFingerprint) { | 240 TEST_F(TransportTest, TestVerifyCertificateFingerprint) { |
| 241 std::string error_desc; | 241 std::string error_desc; |
| 242 EXPECT_FALSE( | 242 EXPECT_FALSE( |
| 243 transport_->VerifyCertificateFingerprint(nullptr, nullptr, &error_desc)); | 243 transport_->VerifyCertificateFingerprint(nullptr, nullptr, &error_desc)); |
| 244 rtc::KeyType key_types[] = {rtc::KT_RSA, rtc::KT_ECDSA}; | 244 rtc::KeyType key_types[] = {rtc::KT_RSA, rtc::KT_ECDSA}; |
| 245 | 245 |
| 246 for (auto& key_type : key_types) { | 246 for (auto& key_type : key_types) { |
| 247 rtc::scoped_refptr<rtc::RTCCertificate> certificate = | 247 rtc::scoped_refptr<rtc::RTCCertificate> certificate = |
| 248 rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>( | 248 rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>( |
| 249 rtc::SSLIdentity::Generate("testing", key_type))); | 249 rtc::SSLIdentity::Generate("testing", key_type))); |
| 250 ASSERT_NE(nullptr, certificate); | 250 ASSERT_NE(nullptr, certificate); |
| 251 | 251 |
| 252 std::string digest_algorithm; | 252 std::string digest_algorithm; |
| 253 ASSERT_TRUE(certificate->ssl_certificate().GetSignatureDigestAlgorithm( | 253 ASSERT_TRUE(certificate->ssl_certificate().GetSignatureDigestAlgorithm( |
| 254 &digest_algorithm)); | 254 &digest_algorithm)); |
| 255 ASSERT_FALSE(digest_algorithm.empty()); | 255 ASSERT_FALSE(digest_algorithm.empty()); |
| 256 rtc::scoped_ptr<rtc::SSLFingerprint> good_fingerprint( | 256 std::unique_ptr<rtc::SSLFingerprint> good_fingerprint( |
| 257 rtc::SSLFingerprint::Create(digest_algorithm, certificate->identity())); | 257 rtc::SSLFingerprint::Create(digest_algorithm, certificate->identity())); |
| 258 ASSERT_NE(nullptr, good_fingerprint); | 258 ASSERT_NE(nullptr, good_fingerprint); |
| 259 | 259 |
| 260 EXPECT_TRUE(transport_->VerifyCertificateFingerprint( | 260 EXPECT_TRUE(transport_->VerifyCertificateFingerprint( |
| 261 certificate.get(), good_fingerprint.get(), &error_desc)); | 261 certificate.get(), good_fingerprint.get(), &error_desc)); |
| 262 EXPECT_FALSE(transport_->VerifyCertificateFingerprint( | 262 EXPECT_FALSE(transport_->VerifyCertificateFingerprint( |
| 263 certificate.get(), nullptr, &error_desc)); | 263 certificate.get(), nullptr, &error_desc)); |
| 264 EXPECT_FALSE(transport_->VerifyCertificateFingerprint( | 264 EXPECT_FALSE(transport_->VerifyCertificateFingerprint( |
| 265 nullptr, good_fingerprint.get(), &error_desc)); | 265 nullptr, good_fingerprint.get(), &error_desc)); |
| 266 | 266 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 remote_desc.connection_role = param.remote_role; | 405 remote_desc.connection_role = param.remote_role; |
| 406 | 406 |
| 407 ASSERT_TRUE(transport_->SetRemoteTransportDescription( | 407 ASSERT_TRUE(transport_->SetRemoteTransportDescription( |
| 408 remote_desc, param.remote_action, nullptr)); | 408 remote_desc, param.remote_action, nullptr)); |
| 409 ASSERT_TRUE(transport_->SetLocalTransportDescription( | 409 ASSERT_TRUE(transport_->SetLocalTransportDescription( |
| 410 local_desc, param.local_action, nullptr)); | 410 local_desc, param.local_action, nullptr)); |
| 411 EXPECT_FALSE( | 411 EXPECT_FALSE( |
| 412 transport_->NegotiateRole(param.local_action, &ssl_role, &error_desc)); | 412 transport_->NegotiateRole(param.local_action, &ssl_role, &error_desc)); |
| 413 } | 413 } |
| 414 } | 414 } |
| OLD | NEW |