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

Unified Diff: net/cert/multi_log_ct_verifier_unittest.cc

Issue 2400183002: Cleanup: More accurate output parameter type for CTVerifier (Closed)
Patch Set: IWYU, review comments Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cert/multi_log_ct_verifier.cc ('k') | net/quic/chromium/crypto/proof_verifier_chromium.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/multi_log_ct_verifier_unittest.cc
diff --git a/net/cert/multi_log_ct_verifier_unittest.cc b/net/cert/multi_log_ct_verifier_unittest.cc
index 7186a3a22e6052245b4fca09e66c49d98fc9336f..2efd7012a46155c25617a32e3ab6f2357d627e89 100644
--- a/net/cert/multi_log_ct_verifier_unittest.cc
+++ b/net/cert/multi_log_ct_verifier_unittest.cc
@@ -16,10 +16,10 @@
#include "net/base/net_errors.h"
#include "net/cert/ct_log_verifier.h"
#include "net/cert/ct_serialization.h"
-#include "net/cert/ct_verify_result.h"
#include "net/cert/pem_tokenizer.h"
#include "net/cert/sct_status_flags.h"
#include "net/cert/signed_certificate_timestamp.h"
+#include "net/cert/signed_certificate_timestamp_and_status.h"
#include "net/cert/x509_certificate.h"
#include "net/log/net_log_source_type.h"
#include "net/log/net_log_with_source.h"
@@ -111,32 +111,33 @@ class MultiLogCTVerifierTest : public ::testing::Test {
return true;
}
- bool VerifySinglePrecertificateChain(scoped_refptr<X509Certificate> chain,
- const NetLogWithSource& net_log,
- ct::CTVerifyResult* result) {
- return verifier_->Verify(chain.get(), std::string(), std::string(), result,
- net_log) == OK;
+ bool VerifySinglePrecertificateChain(
+ scoped_refptr<X509Certificate> chain,
+ const NetLogWithSource& net_log,
+ SignedCertificateTimestampAndStatusList* output_scts) {
+ return verifier_->Verify(chain.get(), std::string(), std::string(),
+ output_scts, net_log) == OK;
}
bool VerifySinglePrecertificateChain(scoped_refptr<X509Certificate> chain) {
- ct::CTVerifyResult result;
+ SignedCertificateTimestampAndStatusList scts;
TestNetLog test_net_log;
NetLogWithSource net_log =
NetLogWithSource::Make(&test_net_log, NetLogSourceType::CONNECT_JOB);
- return verifier_->Verify(chain.get(), std::string(), std::string(), &result,
+ return verifier_->Verify(chain.get(), std::string(), std::string(), &scts,
net_log) == OK;
}
bool CheckPrecertificateVerification(scoped_refptr<X509Certificate> chain) {
- ct::CTVerifyResult result;
+ SignedCertificateTimestampAndStatusList scts;
TestNetLog test_net_log;
NetLogWithSource net_log =
NetLogWithSource::Make(&test_net_log, NetLogSourceType::CONNECT_JOB);
- return (VerifySinglePrecertificateChain(chain, net_log, &result) &&
- ct::CheckForSingleVerifiedSCTInResult(result, kLogDescription) &&
+ return (VerifySinglePrecertificateChain(chain, net_log, &scts) &&
+ ct::CheckForSingleVerifiedSCTInResult(scts, kLogDescription) &&
ct::CheckForSCTOrigin(
- result, ct::SignedCertificateTimestamp::SCT_EMBEDDED) &&
+ scts, ct::SignedCertificateTimestamp::SCT_EMBEDDED) &&
CheckForEmbeddedSCTInNetLog(test_net_log));
}
@@ -210,23 +211,23 @@ TEST_F(MultiLogCTVerifierTest,
TEST_F(MultiLogCTVerifierTest, VerifiesSCTOverX509Cert) {
std::string sct_list = ct::GetSCTListForTesting();
- ct::CTVerifyResult result;
- EXPECT_EQ(OK, verifier_->Verify(chain_.get(), std::string(), sct_list,
- &result, NetLogWithSource()));
- ASSERT_TRUE(ct::CheckForSingleVerifiedSCTInResult(result, kLogDescription));
+ SignedCertificateTimestampAndStatusList scts;
+ EXPECT_EQ(OK, verifier_->Verify(chain_.get(), std::string(), sct_list, &scts,
+ NetLogWithSource()));
+ ASSERT_TRUE(ct::CheckForSingleVerifiedSCTInResult(scts, kLogDescription));
ASSERT_TRUE(ct::CheckForSCTOrigin(
- result, ct::SignedCertificateTimestamp::SCT_FROM_TLS_EXTENSION));
+ scts, ct::SignedCertificateTimestamp::SCT_FROM_TLS_EXTENSION));
}
TEST_F(MultiLogCTVerifierTest, IdentifiesSCTFromUnknownLog) {
std::string sct_list = ct::GetSCTListWithInvalidSCT();
- ct::CTVerifyResult result;
+ SignedCertificateTimestampAndStatusList scts;
- EXPECT_NE(OK, verifier_->Verify(chain_.get(), std::string(), sct_list,
- &result, NetLogWithSource()));
- EXPECT_EQ(1U, result.scts.size());
- EXPECT_EQ("", result.scts[0].sct->log_description);
- EXPECT_EQ(ct::SCT_STATUS_LOG_UNKNOWN, result.scts[0].status);
+ EXPECT_NE(OK, verifier_->Verify(chain_.get(), std::string(), sct_list, &scts,
+ NetLogWithSource()));
+ EXPECT_EQ(1U, scts.size());
+ EXPECT_EQ("", scts[0].sct->log_description);
+ EXPECT_EQ(ct::SCT_STATUS_LOG_UNKNOWN, scts[0].status);
}
TEST_F(MultiLogCTVerifierTest, CountsValidSCTsInStatusHistogram) {
@@ -239,13 +240,14 @@ TEST_F(MultiLogCTVerifierTest, CountsValidSCTsInStatusHistogram) {
TEST_F(MultiLogCTVerifierTest, CountsInvalidSCTsInStatusHistogram) {
std::string sct_list = ct::GetSCTListWithInvalidSCT();
- ct::CTVerifyResult result;
+ SignedCertificateTimestampAndStatusList scts;
+
int num_valid_scts = NumValidSCTsInStatusHistogram();
int num_invalid_scts = GetValueFromHistogram(
"Net.CertificateTransparency.SCTStatus", ct::SCT_STATUS_LOG_UNKNOWN);
- EXPECT_NE(OK, verifier_->Verify(chain_.get(), std::string(), sct_list,
- &result, NetLogWithSource()));
+ EXPECT_NE(OK, verifier_->Verify(chain_.get(), std::string(), sct_list, &scts,
+ NetLogWithSource()));
ASSERT_EQ(num_valid_scts, NumValidSCTsInStatusHistogram());
ASSERT_EQ(num_invalid_scts + 1,
« no previous file with comments | « net/cert/multi_log_ct_verifier.cc ('k') | net/quic/chromium/crypto/proof_verifier_chromium.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698