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

Unified Diff: net/test/test_server.cc

Issue 4646001: Implement LoadTemporaryRoot for Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/net/base
Patch Set: New Win method & unittests Created 10 years, 1 month 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
Index: net/test/test_server.cc
diff --git a/net/test/test_server.cc b/net/test/test_server.cc
index 0e8c4611e4e0a3c4e16924abf0b4f0b9a9f5ff4f..22a7ed6da1b46006ea3ac3f76580699c7e316852 100644
--- a/net/test/test_server.cc
+++ b/net/test/test_server.cc
@@ -23,10 +23,10 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "googleurl/src/gurl.h"
-#include "net/base/cert_test_util.h"
#include "net/base/host_port_pair.h"
#include "net/base/host_resolver.h"
#include "net/base/test_completion_callback.h"
+#include "net/base/test_root_certs.h"
#include "net/socket/tcp_client_socket.h"
#include "net/test/python_utils.h"
#include "testing/platform_test.h"
@@ -55,10 +55,6 @@ std::string GetHostname(TestServer::Type type,
} // namespace
-#if defined(OS_MACOSX)
-void SetMacTestCertificate(X509Certificate* cert);
-#endif
-
TestServer::HTTPSOptions::HTTPSOptions()
: server_certificate(CERT_OK),
request_client_certificate(false),
@@ -100,9 +96,8 @@ TestServer::TestServer(const HTTPSOptions& https_options,
}
TestServer::~TestServer() {
-#if defined(OS_MACOSX)
- SetMacTestCertificate(NULL);
-#endif
+ TestRootCerts* root_certs = TestRootCerts::GetInstance();
+ root_certs->Clear();
Stop();
}
@@ -129,8 +124,6 @@ bool TestServer::Start() {
if (type_ == TYPE_HTTPS) {
if (!LoadTestRootCert())
return false;
- if (!CheckCATrusted())
- return false;
}
// Get path to python server script
@@ -301,27 +294,8 @@ FilePath TestServer::GetRootCertificatePath() {
}
bool TestServer::LoadTestRootCert() {
-#if defined(USE_NSS)
- if (cert_)
- return true;
-
- // TODO(dkegel): figure out how to get this to only happen once?
-
- // This currently leaks a little memory.
- // TODO(dkegel): fix the leak and remove the entry in
- // tools/valgrind/memcheck/suppressions.txt
- ANNOTATE_SCOPED_MEMORY_LEAK; // Tell heap checker about the leak.
- cert_ = LoadTemporaryRootCert(GetRootCertificatePath());
- return (cert_ != NULL);
-#elif defined(OS_MACOSX)
- X509Certificate* cert = LoadTemporaryRootCert(GetRootCertificatePath());
- if (!cert)
- return false;
- SetMacTestCertificate(cert);
- return true;
-#else
- return true;
-#endif
+ TestRootCerts* root_certs = TestRootCerts::GetInstance();
+ return root_certs->AddFromFile(GetRootCertificatePath());
}
bool TestServer::AddCommandLineArguments(CommandLine* command_line) const {

Powered by Google App Engine
This is Rietveld 408576698