| 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 "chrome/browser/net/connection_tester.h" | 5 #include "chrome/browser/net/connection_tester.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/importer/firefox_proxy_settings.h" | 12 #include "chrome/browser/importer/firefox_proxy_settings.h" |
| 13 #include "chrome/browser/io_thread.h" | 13 #include "chrome/browser/io_thread.h" |
| 14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 15 #include "net/base/cert_verifier.h" |
| 15 #include "net/base/cookie_monster.h" | 16 #include "net/base/cookie_monster.h" |
| 16 #include "net/base/dnsrr_resolver.h" | 17 #include "net/base/dnsrr_resolver.h" |
| 17 #include "net/base/host_resolver.h" | 18 #include "net/base/host_resolver.h" |
| 18 #include "net/base/host_resolver_impl.h" | 19 #include "net/base/host_resolver_impl.h" |
| 19 #include "net/base/io_buffer.h" | 20 #include "net/base/io_buffer.h" |
| 20 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
| 21 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
| 22 #include "net/base/ssl_config_service_defaults.h" | 23 #include "net/base/ssl_config_service_defaults.h" |
| 23 #include "net/disk_cache/disk_cache.h" | 24 #include "net/disk_cache/disk_cache.h" |
| 24 #include "net/ftp/ftp_network_layer.h" | 25 #include "net/ftp/ftp_network_layer.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 51 return rv; // Failure. | 52 return rv; // Failure. |
| 52 | 53 |
| 53 // Create a custom ProxyService for this this experiment. | 54 // Create a custom ProxyService for this this experiment. |
| 54 rv = CreateProxyService(experiment.proxy_settings_experiment, | 55 rv = CreateProxyService(experiment.proxy_settings_experiment, |
| 55 &proxy_service_); | 56 &proxy_service_); |
| 56 if (rv != net::OK) | 57 if (rv != net::OK) |
| 57 return rv; // Failure. | 58 return rv; // Failure. |
| 58 | 59 |
| 59 // The rest of the dependencies are standard, and don't depend on the | 60 // The rest of the dependencies are standard, and don't depend on the |
| 60 // experiment being run. | 61 // experiment being run. |
| 62 cert_verifier_ = new net::CertVerifier; |
| 61 dnsrr_resolver_ = new net::DnsRRResolver; | 63 dnsrr_resolver_ = new net::DnsRRResolver; |
| 62 ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); | 64 ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); |
| 63 ssl_config_service_ = new net::SSLConfigServiceDefaults; | 65 ssl_config_service_ = new net::SSLConfigServiceDefaults; |
| 64 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault( | 66 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault( |
| 65 host_resolver_); | 67 host_resolver_); |
| 66 http_transaction_factory_ = new net::HttpCache( | 68 http_transaction_factory_ = new net::HttpCache( |
| 67 net::HttpNetworkLayer::CreateFactory(host_resolver_, dnsrr_resolver_, | 69 net::HttpNetworkLayer::CreateFactory(host_resolver_, cert_verifier_, |
| 68 NULL /* dns_cert_checker */, | 70 dnsrr_resolver_, NULL /* dns_cert_checker */, |
| 69 NULL /* ssl_host_info_factory */, proxy_service_, | 71 NULL /* ssl_host_info_factory */, proxy_service_, |
| 70 ssl_config_service_, http_auth_handler_factory_, NULL, NULL), | 72 ssl_config_service_, http_auth_handler_factory_, NULL, NULL), |
| 71 net::HttpCache::DefaultBackend::InMemory(0)); | 73 net::HttpCache::DefaultBackend::InMemory(0)); |
| 72 // In-memory cookie store. | 74 // In-memory cookie store. |
| 73 cookie_store_ = new net::CookieMonster(NULL, NULL); | 75 cookie_store_ = new net::CookieMonster(NULL, NULL); |
| 74 | 76 |
| 75 return net::OK; | 77 return net::OK; |
| 76 } | 78 } |
| 77 | 79 |
| 78 protected: | 80 protected: |
| 79 virtual ~ExperimentURLRequestContext() { | 81 virtual ~ExperimentURLRequestContext() { |
| 80 delete ftp_transaction_factory_; | 82 delete ftp_transaction_factory_; |
| 81 delete http_transaction_factory_; | 83 delete http_transaction_factory_; |
| 82 delete http_auth_handler_factory_; | 84 delete http_auth_handler_factory_; |
| 83 delete dnsrr_resolver_; | 85 delete dnsrr_resolver_; |
| 86 delete cert_verifier_; |
| 84 delete host_resolver_; | 87 delete host_resolver_; |
| 85 } | 88 } |
| 86 | 89 |
| 87 private: | 90 private: |
| 88 // Creates a host resolver for |experiment|. On success returns net::OK and | 91 // Creates a host resolver for |experiment|. On success returns net::OK and |
| 89 // fills |host_resolver| with a new pointer. Otherwise returns a network | 92 // fills |host_resolver| with a new pointer. Otherwise returns a network |
| 90 // error code. | 93 // error code. |
| 91 int CreateHostResolver( | 94 int CreateHostResolver( |
| 92 ConnectionTester::HostResolverExperiment experiment, | 95 ConnectionTester::HostResolverExperiment experiment, |
| 93 net::HostResolver** host_resolver) { | 96 net::HostResolver** host_resolver) { |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 | 415 |
| 413 // Notify the delegate of completion. | 416 // Notify the delegate of completion. |
| 414 delegate_->OnCompletedConnectionTestExperiment(current, result); | 417 delegate_->OnCompletedConnectionTestExperiment(current, result); |
| 415 | 418 |
| 416 if (remaining_experiments_.empty()) { | 419 if (remaining_experiments_.empty()) { |
| 417 delegate_->OnCompletedConnectionTestSuite(); | 420 delegate_->OnCompletedConnectionTestSuite(); |
| 418 } else { | 421 } else { |
| 419 StartNextExperiment(); | 422 StartNextExperiment(); |
| 420 } | 423 } |
| 421 } | 424 } |
| OLD | NEW |