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

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

Issue 2903633005: Add generated PKITS tests relating to certificate policies. (Closed)
Patch Set: Update comments Created 3 years, 7 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/BUILD.gn ('k') | net/cert/internal/nist_pkits_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/nist_pkits_unittest.h
diff --git a/net/cert/internal/nist_pkits_unittest.h b/net/cert/internal/nist_pkits_unittest.h
index 6a454020ffb486876f34fd2c4b9923680d43c1d6..265f332bbd94ca3ccf8d368741d718dfc8a55771 100644
--- a/net/cert/internal/nist_pkits_unittest.h
+++ b/net/cert/internal/nist_pkits_unittest.h
@@ -5,9 +5,38 @@
#ifndef NET_CERT_INTERNAL_NIST_PKITS_UNITTEST_H_
#define NET_CERT_INTERNAL_NIST_PKITS_UNITTEST_H_
+#include <set>
+
#include "net/cert/internal/test_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace net {
+
+// Describes additional inputs to verification in the PKITS tests
+// (which are referred to as "settings" in that document).
+struct PkitsTestSettings {
+ // Default construction results in the "default settings".
+ PkitsTestSettings();
+ ~PkitsTestSettings();
+
+ // Sets |initial_policy_set| to the specified policies. The
+ // policies are described as comma-separated symbolic strings like
+ // "anyPolicy" and "NIST-test-policy-1".
+ void SetInitialPolicySet(const char* const policy_names);
+
+ // A set of policy OIDs to use for "initial-policy-set".
+ std::set<der::Input> initial_policy_set;
+
+ // The value of "initial-explicit-policy".
+ bool initial_explicit_policy = false;
+
+ // The value of "initial-policy-mapping-inhibit".
+ bool initial_policy_mapping_inhibit = false;
+
+ // The value of "initial-inhibit-any-policy".
+ bool initial_inhibit_any_policy = false;
+};
+
// Parameterized test class for PKITS tests.
// The instantiating code should define a PkitsTestDelegate with an appropriate
// static Verify method, and then INSTANTIATE_TYPED_TEST_CASE_P for each
@@ -17,7 +46,8 @@ class PkitsTest : public ::testing::Test {
public:
template <size_t num_certs, size_t num_crls>
bool Verify(const char* const (&cert_names)[num_certs],
- const char* const (&crl_names)[num_crls]) {
+ const char* const (&crl_names)[num_crls],
+ const PkitsTestSettings& settings) {
std::vector<std::string> cert_ders;
for (const std::string& s : cert_names)
cert_ders.push_back(net::ReadTestFileToString(
@@ -26,11 +56,13 @@ class PkitsTest : public ::testing::Test {
for (const std::string& s : crl_names)
crl_ders.push_back(net::ReadTestFileToString(
"net/third_party/nist-pkits/crls/" + s + ".crl"));
- return PkitsTestDelegate::Verify(cert_ders, crl_ders);
+ return PkitsTestDelegate::Verify(cert_ders, crl_ders, settings);
}
};
// Inline the generated test code:
#include "net/third_party/nist-pkits/pkits_testcases-inl.h"
+} // namespace net
+
#endif // NET_CERT_INTERNAL_NIST_PKITS_UNITTEST_H_
« no previous file with comments | « net/BUILD.gn ('k') | net/cert/internal/nist_pkits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698