diff options
author | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-01 12:44:40 +0000 |
---|---|---|
committer | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-01 12:44:40 +0000 |
commit | 42fdb45bfed58abde34584ef81506f93e78cb3ff (patch) | |
tree | 142313abbcd7c6ebe3a863691e8bc3f8733000fa /net/base | |
parent | 75a5591a6b329b8b12605ea4500c487e3789295c (diff) | |
download | chromium_src-42fdb45bfed58abde34584ef81506f93e78cb3ff.zip chromium_src-42fdb45bfed58abde34584ef81506f93e78cb3ff.tar.gz chromium_src-42fdb45bfed58abde34584ef81506f93e78cb3ff.tar.bz2 |
Add net/base/test_data_directory.h
- move GetTestCertsDirectory() from net/base/certs_test_util
BUG=157531
TEST=build all
TBR=wtc@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11342034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165348 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r-- | net/base/cert_test_util.cc | 10 | ||||
-rw-r--r-- | net/base/cert_test_util.h | 9 | ||||
-rw-r--r-- | net/base/cert_verify_proc_unittest.cc | 1 | ||||
-rw-r--r-- | net/base/multi_threaded_cert_verifier_unittest.cc | 1 | ||||
-rw-r--r-- | net/base/nss_cert_database_unittest.cc | 1 | ||||
-rw-r--r-- | net/base/test_data_directory.cc | 18 | ||||
-rw-r--r-- | net/base/test_data_directory.h | 18 | ||||
-rw-r--r-- | net/base/transport_security_state_unittest.cc | 1 | ||||
-rw-r--r-- | net/base/x509_certificate_unittest.cc | 1 |
9 files changed, 44 insertions, 16 deletions
diff --git a/net/base/cert_test_util.cc b/net/base/cert_test_util.cc index 7815872..74b4a95 100644 --- a/net/base/cert_test_util.cc +++ b/net/base/cert_test_util.cc @@ -13,16 +13,6 @@ namespace net { -FilePath GetTestCertsDirectory() { - FilePath certs_dir; - PathService::Get(base::DIR_SOURCE_ROOT, &certs_dir); - certs_dir = certs_dir.AppendASCII("net"); - certs_dir = certs_dir.AppendASCII("data"); - certs_dir = certs_dir.AppendASCII("ssl"); - certs_dir = certs_dir.AppendASCII("certificates"); - return certs_dir; -} - CertificateList CreateCertificateListFromFile( const FilePath& certs_dir, const std::string& cert_file, diff --git a/net/base/cert_test_util.h b/net/base/cert_test_util.h index eb9e7eb..9f23b7d 100644 --- a/net/base/cert_test_util.h +++ b/net/base/cert_test_util.h @@ -17,16 +17,13 @@ namespace net { class EVRootCAMetadata; -// Returns a FilePath object representing the src/net/data/ssl/certificates -// directory in the source tree. -FilePath GetTestCertsDirectory(); - CertificateList CreateCertificateListFromFile(const FilePath& certs_dir, const std::string& cert_file, int format); -// Imports a certificate file in the src/net/data/ssl/certificates directory. -// certs_dir represents the test certificates directory. cert_file is the +// Imports a certificate file in the directory net::GetTestCertsDirectory() +// returns. +// |certs_dir| represents the test certificates directory. |cert_file| is the // name of the certificate file. If cert_file contains multiple certificates, // the first certificate found will be returned. scoped_refptr<X509Certificate> ImportCertFromFile(const FilePath& certs_dir, diff --git a/net/base/cert_verify_proc_unittest.cc b/net/base/cert_verify_proc_unittest.cc index 8c83ec1..1a33182 100644 --- a/net/base/cert_verify_proc_unittest.cc +++ b/net/base/cert_verify_proc_unittest.cc @@ -17,6 +17,7 @@ #include "net/base/crl_set.h" #include "net/base/net_errors.h" #include "net/base/test_certificate_data.h" +#include "net/base/test_data_directory.h" #include "net/base/test_root_certs.h" #include "net/base/x509_certificate.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/net/base/multi_threaded_cert_verifier_unittest.cc b/net/base/multi_threaded_cert_verifier_unittest.cc index 8946b66..6b0570c 100644 --- a/net/base/multi_threaded_cert_verifier_unittest.cc +++ b/net/base/multi_threaded_cert_verifier_unittest.cc @@ -14,6 +14,7 @@ #include "net/base/net_errors.h" #include "net/base/net_log.h" #include "net/base/test_completion_callback.h" +#include "net/base/test_data_directory.h" #include "net/base/x509_certificate.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/net/base/nss_cert_database_unittest.cc b/net/base/nss_cert_database_unittest.cc index 9cdbb95..a3f6096 100644 --- a/net/base/nss_cert_database_unittest.cc +++ b/net/base/nss_cert_database_unittest.cc @@ -26,6 +26,7 @@ #include "net/base/crypto_module.h" #include "net/base/net_errors.h" #include "net/base/nss_cert_database.h" +#include "net/base/test_data_directory.h" #include "net/base/x509_certificate.h" #include "net/third_party/mozilla_security_manager/nsNSSCertificateDB.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/net/base/test_data_directory.cc b/net/base/test_data_directory.cc new file mode 100644 index 0000000..7acd02a --- /dev/null +++ b/net/base/test_data_directory.cc @@ -0,0 +1,18 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/base/test_data_directory.h" + +#include "base/base_paths.h" +#include "base/path_service.h" + +namespace net { + +FilePath GetTestCertsDirectory() { + FilePath certs_dir; + PathService::Get(base::DIR_SOURCE_ROOT, &certs_dir); + return certs_dir.Append(FILE_PATH_LITERAL("net/data/ssl/certificates")); +} + +} // namespace net diff --git a/net/base/test_data_directory.h b/net/base/test_data_directory.h new file mode 100644 index 0000000..728e8d6 --- /dev/null +++ b/net/base/test_data_directory.h @@ -0,0 +1,18 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_BASE_TEST_DATA_DIRECTORY_H_ +#define NET_BASE_TEST_DATA_DIRECTORY_H_ + +#include "base/file_path.h" + +namespace net { + +// Returns the FilePath object representing the absolute path in the source +// tree that contains certificates for testing. +FilePath GetTestCertsDirectory(); + +} // namespace net + +#endif // NET_BASE_TEST_DATA_DIRECTORY_H_ diff --git a/net/base/transport_security_state_unittest.cc b/net/base/transport_security_state_unittest.cc index 3458d5d..3192f01 100644 --- a/net/base/transport_security_state_unittest.cc +++ b/net/base/transport_security_state_unittest.cc @@ -21,6 +21,7 @@ #include "net/base/net_log.h" #include "net/base/ssl_info.h" #include "net/base/test_completion_callback.h" +#include "net/base/test_data_directory.h" #include "net/base/test_root_certs.h" #include "net/base/x509_cert_types.h" #include "net/base/x509_certificate.h" diff --git a/net/base/x509_certificate_unittest.cc b/net/base/x509_certificate_unittest.cc index c16ad87..63f51a8 100644 --- a/net/base/x509_certificate_unittest.cc +++ b/net/base/x509_certificate_unittest.cc @@ -16,6 +16,7 @@ #include "net/base/cert_test_util.h" #include "net/base/net_errors.h" #include "net/base/test_certificate_data.h" +#include "net/base/test_data_directory.h" #include "testing/gtest/include/gtest/gtest.h" #if defined(USE_NSS) |