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

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

Issue 1279963003: Add a function for parsing RFC 5280's "TBSCertificate". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert_mapper
Patch Set: one more comment fix Created 5 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/parse_certificate_unittest.cc ('k') | net/cert/internal/test_helpers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/test_helpers.h
diff --git a/net/cert/internal/test_helpers.h b/net/cert/internal/test_helpers.h
index 9e5ddfbf09ebf0ae45d1f89321d8f62d89a2ed2b..d10148191a4f8a1bb6c9a05ebaa2edaea3c291c5 100644
--- a/net/cert/internal/test_helpers.h
+++ b/net/cert/internal/test_helpers.h
@@ -36,8 +36,15 @@ der::Input InputFromString(const std::string* s);
// Helper structure that maps a PEM block header (for instance "CERTIFICATE") to
// the destination where the value for that block should be written.
struct PemBlockMapping {
+ // The name of the PEM header. Example "CERTIFICATE".
const char* block_name;
+
+ // The destination where the read value should be written to.
std::string* value;
+
+ // True to indicate that the block is not required to be present. If the
+ // block is optional and is not present, then |value| will not be modified.
+ bool optional;
};
// ReadTestDataFromPemFile() is a helper function that reads a PEM test file
@@ -52,8 +59,8 @@ struct PemBlockMapping {
// headers to the destination to write its data.
//
// The function ensures that each of the chosen mappings is satisfied exactly
-// once. In other words, the header must be present, have valid data, and
-// appear no more than once.
+// once. In other words, the header must be present (unless marked as
+// optional=true), have valid data, and appear no more than once.
::testing::AssertionResult ReadTestDataFromPemFile(
const std::string& file_path_ascii,
const PemBlockMapping* mappings,
« no previous file with comments | « net/cert/internal/parse_certificate_unittest.cc ('k') | net/cert/internal/test_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698