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

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

Issue 2918913002: Add path validation error expectations for PKITS tests. (Closed)
Patch Set: checkpoint 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..cbfe9b9dc377349b64b4ff96024a76f23c1ef05c 100644
--- a/net/cert/internal/test_helpers.cc
+++ b/net/cert/internal/test_helpers.cc
@@ -308,4 +308,43 @@ std::string ReadTestFileToString(const std::string& file_path_ascii) {
return file_data;
}
+void VerifyCertPathErrors(const std::string& expected_errors,
mattm 2017/06/02 21:09:07 maybe name this expected_errors_str to match actua
eroman 2017/06/02 23:16:17 Done.
+ const CertPathErrors& actual_errors,
+ const ParsedCertificateList& chain,
+ const std::string& errors_file_path) {
+ std::string actual_errors_str = actual_errors.ToDebugString(chain);
+ bool matches = expected_errors == actual_errors_str;
+
+ if (!matches) {
mattm 2017/06/02 21:09:07 optional: dunno if using the separate |matches| va
eroman 2017/06/02 23:16:17 Done.
+ ADD_FAILURE() << "Cert path errors don't match expectations ("
+ << errors_file_path << ")\n\n"
+ << "EXPECTED:\n\n"
+ << expected_errors << "\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,
+ const CertErrors& actual_errors,
+ const std::string& errors_file_path) {
+ std::string actual_errors_str = actual_errors.ToDebugString();
+ bool matches = expected_errors == actual_errors_str;
+
+ if (!matches) {
+ ADD_FAILURE() << "Cert errors don't match expectations ("
+ << errors_file_path << ")\n\n"
+ << "EXPECTED:\n\n"
+ << expected_errors << "\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