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

Side by Side Diff: net/cert/ct_objects_extractor_unittest.cc

Issue 503163002: Remove implicit conversions from scoped_refptr to T* in net/cert/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « net/cert/ct_log_verifier_unittest.cc ('k') | net/cert/multi_log_ct_verifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/cert/ct_objects_extractor.h" 5 #include "net/cert/ct_objects_extractor.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "net/base/test_data_directory.h" 8 #include "net/base/test_data_directory.h"
9 #include "net/cert/ct_log_verifier.h" 9 #include "net/cert/ct_log_verifier.h"
10 #include "net/cert/ct_serialization.h" 10 #include "net/cert/ct_serialization.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 TEST_F(CTObjectsExtractorTest, ExtractedSCTVerifies) { 100 TEST_F(CTObjectsExtractorTest, ExtractedSCTVerifies) {
101 scoped_refptr<ct::SignedCertificateTimestamp> sct( 101 scoped_refptr<ct::SignedCertificateTimestamp> sct(
102 new ct::SignedCertificateTimestamp()); 102 new ct::SignedCertificateTimestamp());
103 ExtractEmbeddedSCT(precert_chain_[0], &sct); 103 ExtractEmbeddedSCT(precert_chain_[0], &sct);
104 104
105 LogEntry entry; 105 LogEntry entry;
106 ASSERT_TRUE(GetPrecertLogEntry(precert_chain_[0]->os_cert_handle(), 106 ASSERT_TRUE(GetPrecertLogEntry(precert_chain_[0]->os_cert_handle(),
107 precert_chain_[1]->os_cert_handle(), 107 precert_chain_[1]->os_cert_handle(),
108 &entry)); 108 &entry));
109 109
110 EXPECT_TRUE(log_->Verify(entry, *sct)); 110 EXPECT_TRUE(log_->Verify(entry, *sct.get()));
111 } 111 }
112 112
113 // Test that an externally-provided SCT verifies over the LogEntry 113 // Test that an externally-provided SCT verifies over the LogEntry
114 // of a regular X.509 Certificate 114 // of a regular X.509 Certificate
115 TEST_F(CTObjectsExtractorTest, ComplementarySCTVerifies) { 115 TEST_F(CTObjectsExtractorTest, ComplementarySCTVerifies) {
116 scoped_refptr<ct::SignedCertificateTimestamp> sct( 116 scoped_refptr<ct::SignedCertificateTimestamp> sct(
117 new ct::SignedCertificateTimestamp()); 117 new ct::SignedCertificateTimestamp());
118 GetX509CertSCT(&sct); 118 GetX509CertSCT(&sct);
119 119
120 LogEntry entry; 120 LogEntry entry;
121 ASSERT_TRUE(GetX509LogEntry(test_cert_->os_cert_handle(), &entry)); 121 ASSERT_TRUE(GetX509LogEntry(test_cert_->os_cert_handle(), &entry));
122 122
123 EXPECT_TRUE(log_->Verify(entry, *sct)); 123 EXPECT_TRUE(log_->Verify(entry, *sct.get()));
124 } 124 }
125 125
126 // Test that the extractor can parse OCSP responses. 126 // Test that the extractor can parse OCSP responses.
127 TEST_F(CTObjectsExtractorTest, ExtractSCTListFromOCSPResponse) { 127 TEST_F(CTObjectsExtractorTest, ExtractSCTListFromOCSPResponse) {
128 std::string der_subject_cert(ct::GetDerEncodedFakeOCSPResponseCert()); 128 std::string der_subject_cert(ct::GetDerEncodedFakeOCSPResponseCert());
129 scoped_refptr<X509Certificate> subject_cert = 129 scoped_refptr<X509Certificate> subject_cert =
130 X509Certificate::CreateFromBytes(der_subject_cert.data(), 130 X509Certificate::CreateFromBytes(der_subject_cert.data(),
131 der_subject_cert.length()); 131 der_subject_cert.length());
132 std::string der_issuer_cert(ct::GetDerEncodedFakeOCSPResponseIssuerCert()); 132 std::string der_issuer_cert(ct::GetDerEncodedFakeOCSPResponseIssuerCert());
133 scoped_refptr<X509Certificate> issuer_cert = 133 scoped_refptr<X509Certificate> issuer_cert =
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 std::string extracted_sct_list; 172 std::string extracted_sct_list;
173 // Use test_cert_ for issuer - it is not the correct issuer of |subject_cert|. 173 // Use test_cert_ for issuer - it is not the correct issuer of |subject_cert|.
174 EXPECT_FALSE(ct::ExtractSCTListFromOCSPResponse( 174 EXPECT_FALSE(ct::ExtractSCTListFromOCSPResponse(
175 test_cert_->os_cert_handle(), subject_cert->serial_number(), 175 test_cert_->os_cert_handle(), subject_cert->serial_number(),
176 ocsp_response, &extracted_sct_list)); 176 ocsp_response, &extracted_sct_list));
177 } 177 }
178 178
179 } // namespace ct 179 } // namespace ct
180 180
181 } // namespace net 181 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/ct_log_verifier_unittest.cc ('k') | net/cert/multi_log_ct_verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698