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

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

Issue 2233233002: Refactor some certificate verification tests in preparation to adding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@trust_anchor
Patch Set: moar Created 4 years, 4 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 | « no previous file | net/cert/internal/path_builder_unittest.cc » ('j') | net/cert/internal/test_helpers.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/nist_pkits_unittest.h
diff --git a/net/cert/internal/nist_pkits_unittest.h b/net/cert/internal/nist_pkits_unittest.h
index aaf3992b645ba875cbf3592d7383218addc5eecb..47fd46274d6777d5980fb73a331f09463e452d0c 100644
--- a/net/cert/internal/nist_pkits_unittest.h
+++ b/net/cert/internal/nist_pkits_unittest.h
@@ -5,9 +5,7 @@
#ifndef NET_CERT_INTERNAL_NIST_PKITS_UNITTEST_H
#define NET_CERT_INTERNAL_NIST_PKITS_UNITTEST_H
-#include "base/base_paths.h"
-#include "base/files/file_util.h"
-#include "base/path_service.h"
+#include "net/cert/internal/test_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
// Parameterized test class for PKITS tests.
@@ -22,30 +20,14 @@ class PkitsTest : public ::testing::Test {
const char* const (&crl_names)[num_crls]) {
std::vector<std::string> cert_ders;
for (const std::string& s : cert_names)
- cert_ders.push_back(ReadTestFileToString("certs/" + s + ".crt"));
+ cert_ders.push_back(net::ReadTestFileToString(
+ "net/third_party/nist-pkits/certs/" + s + ".crt"));
std::vector<std::string> crl_ders;
for (const std::string& s : crl_names)
- crl_ders.push_back(ReadTestFileToString("crls/" + s + ".crl"));
+ crl_ders.push_back(net::ReadTestFileToString(
+ "net/third_party/nist-pkits/crls/" + s + ".crl"));
return PkitsTestDelegate::Verify(cert_ders, crl_ders);
}
-
- private:
- std::string ReadTestFileToString(const std::string& file_name) {
- // Compute the full path, relative to the src/ directory.
- base::FilePath src_root;
- PathService::Get(base::DIR_SOURCE_ROOT, &src_root);
- base::FilePath filepath = src_root.AppendASCII(
- std::string("net/third_party/nist-pkits/") + file_name);
-
- // Read the full contents of the file.
- std::string file_data;
- if (!base::ReadFileToString(filepath, &file_data)) {
- ADD_FAILURE() << "Couldn't read file: " << filepath.value();
- return std::string();
- }
-
- return file_data;
- }
};
// Inline the generated test code:
« no previous file with comments | « no previous file | net/cert/internal/path_builder_unittest.cc » ('j') | net/cert/internal/test_helpers.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698