OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/test/test_server.h" | 5 #include "net/test/test_server.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 FILE_PATH_LITERAL("device_management_pb"))); | 307 FILE_PATH_LITERAL("device_management_pb"))); |
308 | 308 |
309 return true; | 309 return true; |
310 } | 310 } |
311 | 311 |
312 FilePath TestServer::GetRootCertificatePath() { | 312 FilePath TestServer::GetRootCertificatePath() { |
313 return certificates_dir_.AppendASCII("root_ca_cert.crt"); | 313 return certificates_dir_.AppendASCII("root_ca_cert.crt"); |
314 } | 314 } |
315 | 315 |
316 bool TestServer::LoadTestRootCert() { | 316 bool TestServer::LoadTestRootCert() { |
317 #if defined(USE_NSS) | 317 #if defined(USE_OPENSSL) || defined(USE_NSS) |
318 if (cert_) | 318 if (cert_) |
319 return true; | 319 return true; |
320 | 320 |
321 // TODO(dkegel): figure out how to get this to only happen once? | 321 // TODO(dkegel): figure out how to get this to only happen once? |
322 | 322 |
323 // This currently leaks a little memory. | 323 // This currently leaks a little memory. |
324 // TODO(dkegel): fix the leak and remove the entry in | 324 // TODO(dkegel): fix the leak and remove the entry in |
325 // tools/valgrind/memcheck/suppressions.txt | 325 // tools/valgrind/memcheck/suppressions.txt |
326 ANNOTATE_SCOPED_MEMORY_LEAK; // Tell heap checker about the leak. | 326 ANNOTATE_SCOPED_MEMORY_LEAK; // Tell heap checker about the leak. |
327 cert_ = LoadTemporaryRootCert(GetRootCertificatePath()); | 327 cert_ = LoadTemporaryRootCert(GetRootCertificatePath()); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 } | 404 } |
405 if ((port <= 0) || (port > kuint16max)) { | 405 if ((port <= 0) || (port > kuint16max)) { |
406 LOG(ERROR) << "Invalid port value: " << port; | 406 LOG(ERROR) << "Invalid port value: " << port; |
407 return false; | 407 return false; |
408 } | 408 } |
409 host_port_pair_.set_port(port); | 409 host_port_pair_.set_port(port); |
410 return true; | 410 return true; |
411 } | 411 } |
412 | 412 |
413 } // namespace net | 413 } // namespace net |
OLD | NEW |