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

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

Issue 2918913002: Add path validation error expectations for PKITS tests. (Closed)
Patch Set: Address Matt's 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/cert/internal/test_helpers.h ('k') | net/cert/internal/verify_certificate_chain_pkits_unittest.cc » ('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 70bd644708137d4a5d9b30958380f8278523977f..979cccaf8cced4948b17983715830dcf32f6d298 100644
--- a/net/cert/internal/test_helpers.cc
+++ b/net/cert/internal/test_helpers.cc
@@ -308,4 +308,41 @@ std::string ReadTestFileToString(const std::string& file_path_ascii) {
return file_data;
}
+void VerifyCertPathErrors(const std::string& expected_errors_str,
+ const CertPathErrors& actual_errors,
+ const ParsedCertificateList& chain,
+ const std::string& errors_file_path) {
+ std::string actual_errors_str = actual_errors.ToDebugString(chain);
+
+ if (expected_errors_str != actual_errors_str) {
+ ADD_FAILURE() << "Cert path errors don't match expectations ("
+ << errors_file_path << ")\n\n"
+ << "EXPECTED:\n\n"
+ << expected_errors_str << "\n"
+ << "ACTUAL:\n\n"
+ << actual_errors_str << "\n"
+ << "===> Use "
+ "net/data/verify_certificate_chain_unittest/"
+ "rebase-errors.py to rebaseline.\n";
+ }
+}
+
+void VerifyCertErrors(const std::string& expected_errors_str,
+ const CertErrors& actual_errors,
+ const std::string& errors_file_path) {
+ std::string actual_errors_str = actual_errors.ToDebugString();
+
+ if (expected_errors_str != actual_errors_str) {
+ ADD_FAILURE() << "Cert errors don't match expectations ("
+ << errors_file_path << ")\n\n"
+ << "EXPECTED:\n\n"
+ << expected_errors_str << "\n"
+ << "ACTUAL:\n\n"
+ << actual_errors_str << "\n"
+ << "===> Use "
+ "net/data/parse_certificate_unittest/"
+ "rebase-errors.py to rebaseline.\n";
+ }
+}
+
} // namespace net
« no previous file with comments | « net/cert/internal/test_helpers.h ('k') | net/cert/internal/verify_certificate_chain_pkits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698