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

Unified Diff: net/cert/internal/test_helpers.cc

Issue 2282183004: Add error information to VerifyCertificateChain(). (Closed)
Patch Set: fix typo in README Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cert/internal/test_helpers.h ('k') | net/cert/internal/verify_certificate_chain.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/test_helpers.cc
diff --git a/net/cert/internal/test_helpers.cc b/net/cert/internal/test_helpers.cc
index 2891dd40e02c23f31902e7bf33a602d0cb179dbc..28534bd822a3f05f3b09bf5038d319849a733e60 100644
--- a/net/cert/internal/test_helpers.cc
+++ b/net/cert/internal/test_helpers.cc
@@ -104,9 +104,11 @@ void ReadVerifyCertChainTestFromFile(const std::string& file_name,
ParsedCertificateList* chain,
scoped_refptr<TrustAnchor>* trust_anchor,
der::GeneralizedTime* time,
- bool* verify_result) {
+ bool* verify_result,
+ std::string* expected_errors) {
chain->clear();
*trust_anchor = nullptr;
+ expected_errors->clear();
std::string file_data = ReadTestFileToString(
std::string("net/data/verify_certificate_chain_unittest/") + file_name);
@@ -120,15 +122,18 @@ void ReadVerifyCertChainTestFromFile(const std::string& file_name,
const char kTrustAnchorConstrained[] = "TRUST_ANCHOR_CONSTRAINED";
const char kTimeHeader[] = "TIME";
const char kResultHeader[] = "VERIFY_RESULT";
+ const char kErrorsHeader[] = "ERRORS";
pem_headers.push_back(kCertificateHeader);
pem_headers.push_back(kTrustAnchorUnconstrained);
pem_headers.push_back(kTrustAnchorConstrained);
pem_headers.push_back(kTimeHeader);
pem_headers.push_back(kResultHeader);
+ pem_headers.push_back(kErrorsHeader);
bool has_time = false;
bool has_result = false;
+ bool has_errors = false;
PEMTokenizer pem_tokenizer(file_data, pem_headers);
while (pem_tokenizer.GetNext()) {
@@ -164,6 +169,10 @@ void ReadVerifyCertChainTestFromFile(const std::string& file_name,
<< "Unrecognized result: " << block_data;
has_result = true;
*verify_result = block_data == "SUCCESS";
+ } else if (block_type == kErrorsHeader) {
+ ASSERT_FALSE(has_errors) << "Duplicate " << kErrorsHeader;
+ has_errors = true;
+ *expected_errors = block_data;
}
}
« no previous file with comments | « net/cert/internal/test_helpers.h ('k') | net/cert/internal/verify_certificate_chain.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698