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

Unified Diff: net/test/cert_test_util.cc

Issue 2670643008: Move CertVerifyProcMac unit-tests to their own file. (Closed)
Patch Set: Rebase + add missing include Created 3 years, 10 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/test/cert_test_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/test/cert_test_util.cc
diff --git a/net/test/cert_test_util.cc b/net/test/cert_test_util.cc
index c6c412d60e3e26cdac90211df4302111e547d881..8da3aecf2d4060ae27ba647a7f2e8e6dcf43ba60 100644
--- a/net/test/cert_test_util.cc
+++ b/net/test/cert_test_util.cc
@@ -8,7 +8,7 @@
#include "base/files/file_util.h"
#include "net/cert/ev_root_ca_metadata.h"
#include "net/cert/x509_certificate.h"
-#include "testing/gtest/include/gtest/gtest.h"
+#include "net/test/test_data_directory.h"
namespace net {
@@ -25,6 +25,23 @@ CertificateList CreateCertificateListFromFile(
format);
}
+::testing::AssertionResult LoadCertificateFiles(
+ const std::vector<std::string>& cert_filenames,
+ CertificateList* certs) {
+ certs->clear();
+ for (const std::string& filename : cert_filenames) {
+ scoped_refptr<X509Certificate> cert = CreateCertificateChainFromFile(
+ GetTestCertsDirectory(), filename, X509Certificate::FORMAT_AUTO);
+ if (!cert)
+ return ::testing::AssertionFailure()
+ << "Failed loading certificate from file: " << filename
+ << " (in directory: " << GetTestCertsDirectory().value() << ")";
+ certs->push_back(cert);
+ }
+
+ return ::testing::AssertionSuccess();
+}
+
scoped_refptr<X509Certificate> CreateCertificateChainFromFile(
const base::FilePath& certs_dir,
const std::string& cert_file,
« no previous file with comments | « net/test/cert_test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698