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

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

Issue 2801813004: Refactor VerifyCertificateChain test data to include a key purpose (Closed)
Patch Set: Address mattm's comment Created 3 years, 8 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
Index: net/cert/internal/test_helpers.h
diff --git a/net/cert/internal/test_helpers.h b/net/cert/internal/test_helpers.h
index 0e4cd17a58d8bd4f259a1b9267738858bf23b7ae..0cd2f70d2c54ffd70eb8a59e9028ff5f57df5f81 100644
--- a/net/cert/internal/test_helpers.h
+++ b/net/cert/internal/test_helpers.h
@@ -76,17 +76,33 @@ template <size_t N>
return ReadTestDataFromPemFile(file_path_ascii, mappings, N);
}
-// Reads a test case from |file_path_ascii| (which is relative to //src). Test
-// cases are comprised of a certificate chain, trust anchor, a timestamp to
-// validate at, and the expected result of verification.
+// Test cases are comprised of all the parameters to certificate
+// verification, as well as the expected outputs.
+struct VerifyCertChainTest {
+ VerifyCertChainTest();
+ ~VerifyCertChainTest();
+
+ // The chain of certificates (with the zero-th being the target).
+ ParsedCertificateList chain;
+
+ // The trust anchor to use when verifying the chain.
+ scoped_refptr<TrustAnchor> trust_anchor;
+
+ // The time to use when verifying the chain.
+ der::GeneralizedTime time;
+
+ // The expected result from verification.
+ bool expected_result = false;
+
+ // The expected errors from verification (as a string).
+ std::string expected_errors;
+};
+
+// Reads a test case from |file_path_ascii| (which is relative to //src).
// Generally |file_path_ascii| will start with:
// net/data/verify_certificate_chain_unittest/
void ReadVerifyCertChainTestFromFile(const std::string& file_path_ascii,
- ParsedCertificateList* chain,
- scoped_refptr<TrustAnchor>* trust_anchor,
- der::GeneralizedTime* time,
- bool* verify_result,
- std::string* expected_errors);
+ VerifyCertChainTest* test);
// Reads a data file relative to the src root directory.
std::string ReadTestFileToString(const std::string& file_path_ascii);
« no previous file with comments | « net/cert/internal/path_builder_verify_certificate_chain_unittest.cc ('k') | net/cert/internal/test_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698