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 |