OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 return false; | 324 return false; |
325 } | 325 } |
326 if ((port <= 0) || (port > kuint16max)) { | 326 if ((port <= 0) || (port > kuint16max)) { |
327 LOG(ERROR) << "Invalid port value: " << port; | 327 LOG(ERROR) << "Invalid port value: " << port; |
328 return false; | 328 return false; |
329 } | 329 } |
330 host_port_pair_.set_port(port); | 330 host_port_pair_.set_port(port); |
331 return true; | 331 return true; |
332 } | 332 } |
333 | 333 |
334 FilePath TestServer::GetRootCertificatePath() { | 334 FilePath TestServer::GetRootCertificatePath() const { |
335 return certificates_dir_.AppendASCII("root_ca_cert.crt"); | 335 return certificates_dir_.AppendASCII("root_ca_cert.crt"); |
336 } | 336 } |
337 | 337 |
338 bool TestServer::LoadTestRootCert() { | 338 bool TestServer::LoadTestRootCert() { |
339 TestRootCerts* root_certs = TestRootCerts::GetInstance(); | 339 TestRootCerts* root_certs = TestRootCerts::GetInstance(); |
340 return root_certs->AddFromFile(GetRootCertificatePath()); | 340 return root_certs->AddFromFile(GetRootCertificatePath()); |
341 } | 341 } |
342 | 342 |
343 bool TestServer::AddCommandLineArguments(CommandLine* command_line) const { | 343 bool TestServer::AddCommandLineArguments(CommandLine* command_line) const { |
344 command_line->AppendSwitchASCII("port", | 344 command_line->AppendSwitchASCII("port", |
345 base::IntToString(host_port_pair_.port())); | 345 base::IntToString(host_port_pair_.port())); |
346 command_line->AppendSwitchPath("data-dir", document_root_); | 346 command_line->AppendSwitchPath("data-dir", document_root_); |
| 347 command_line->AppendSwitchPath("policy-cert-chain", GetRootCertificatePath()); |
| 348 command_line->AppendSwitchPath("policy-cert-chain", |
| 349 certificates_dir_.AppendASCII("ok_cert.pem")); |
347 | 350 |
348 if (type_ == TYPE_FTP) { | 351 if (type_ == TYPE_FTP) { |
349 command_line->AppendArg("-f"); | 352 command_line->AppendArg("-f"); |
350 } else if (type_ == TYPE_SYNC) { | 353 } else if (type_ == TYPE_SYNC) { |
351 command_line->AppendArg("--sync"); | 354 command_line->AppendArg("--sync"); |
352 } else if (type_ == TYPE_HTTPS) { | 355 } else if (type_ == TYPE_HTTPS) { |
353 FilePath certificate_path(certificates_dir_); | 356 FilePath certificate_path(certificates_dir_); |
354 certificate_path = certificate_path.Append( | 357 certificate_path = certificate_path.Append( |
355 https_options_.GetCertificateFile()); | 358 https_options_.GetCertificateFile()); |
356 if (!file_util::PathExists(certificate_path)) { | 359 if (!file_util::PathExists(certificate_path)) { |
(...skipping 26 matching lines...) Expand all Loading... |
383 if (https_options_.bulk_ciphers & HTTPSOptions::BULK_CIPHER_AES256) | 386 if (https_options_.bulk_ciphers & HTTPSOptions::BULK_CIPHER_AES256) |
384 command_line->AppendSwitchASCII(kBulkCipherSwitch, "aes256"); | 387 command_line->AppendSwitchASCII(kBulkCipherSwitch, "aes256"); |
385 if (https_options_.bulk_ciphers & HTTPSOptions::BULK_CIPHER_3DES) | 388 if (https_options_.bulk_ciphers & HTTPSOptions::BULK_CIPHER_3DES) |
386 command_line->AppendSwitchASCII(kBulkCipherSwitch, "3des"); | 389 command_line->AppendSwitchASCII(kBulkCipherSwitch, "3des"); |
387 } | 390 } |
388 | 391 |
389 return true; | 392 return true; |
390 } | 393 } |
391 | 394 |
392 } // namespace net | 395 } // namespace net |
OLD | NEW |