| OLD | NEW |
| 1 // Copyright (c) 2011 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 "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/task.h" | 11 #include "base/task.h" |
| 12 #include "base/threading/thread_restrictions.h" | 12 #include "base/threading/thread_restrictions.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/browser/importer/firefox_proxy_settings.h" | 14 #include "chrome/browser/importer/firefox_proxy_settings.h" |
| 15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 16 #include "net/base/cert_verifier.h" | 16 #include "net/base/cert_verifier.h" |
| 17 #include "net/base/cookie_monster.h" | 17 #include "net/base/cookie_monster.h" |
| 18 #include "net/base/dnsrr_resolver.h" | 18 #include "net/base/dnsrr_resolver.h" |
| 19 #include "net/base/host_resolver.h" | 19 #include "net/base/host_resolver.h" |
| 20 #include "net/base/host_resolver_impl.h" | 20 #include "net/base/host_resolver_impl.h" |
| 21 #include "net/base/io_buffer.h" | 21 #include "net/base/io_buffer.h" |
| 22 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
| 23 #include "net/base/net_util.h" | 23 #include "net/base/net_util.h" |
| 24 #include "net/base/ssl_config_service_defaults.h" | 24 #include "net/base/ssl_config_service_defaults.h" |
| 25 #include "net/ftp/ftp_network_layer.h" | 25 #include "net/ftp/ftp_network_layer.h" |
| 26 #include "net/http/http_auth_handler_factory.h" | 26 #include "net/http/http_auth_handler_factory.h" |
| 27 #include "net/http/http_cache.h" | 27 #include "net/http/http_cache.h" |
| 28 #include "net/http/http_network_session.h" | 28 #include "net/http/http_network_session.h" |
| 29 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" | |
| 30 #include "net/proxy/proxy_config_service_fixed.h" | 29 #include "net/proxy/proxy_config_service_fixed.h" |
| 31 #include "net/proxy/proxy_script_fetcher_impl.h" | 30 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 32 #include "net/proxy/proxy_service.h" | 31 #include "net/proxy/proxy_service.h" |
| 33 #include "net/url_request/url_request.h" | 32 #include "net/url_request/url_request.h" |
| 34 #include "net/url_request/url_request_context.h" | 33 #include "net/url_request/url_request_context.h" |
| 35 #include "net/url_request/url_request_context_storage.h" | 34 #include "net/url_request/url_request_context_storage.h" |
| 36 | 35 |
| 37 namespace { | 36 namespace { |
| 38 | 37 |
| 39 // ExperimentURLRequestContext ------------------------------------------------ | 38 // ExperimentURLRequestContext ------------------------------------------------ |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 if (rv != net::OK) | 175 if (rv != net::OK) |
| 177 return rv; // Failure. | 176 return rv; // Failure. |
| 178 | 177 |
| 179 if (CommandLine::ForCurrentProcess()->HasSwitch( | 178 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 180 switches::kSingleProcess)) { | 179 switches::kSingleProcess)) { |
| 181 // We can't create a standard proxy resolver in single-process mode. | 180 // We can't create a standard proxy resolver in single-process mode. |
| 182 // Rather than falling-back to some other implementation, fail. | 181 // Rather than falling-back to some other implementation, fail. |
| 183 return net::ERR_NOT_IMPLEMENTED; | 182 return net::ERR_NOT_IMPLEMENTED; |
| 184 } | 183 } |
| 185 | 184 |
| 186 net::DhcpProxyScriptFetcherFactory dhcp_factory; | |
| 187 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 188 switches::kEnableDhcpWpad)) { | |
| 189 dhcp_factory.set_enabled(true); | |
| 190 } | |
| 191 | |
| 192 proxy_service->reset(net::ProxyService::CreateUsingV8ProxyResolver( | 185 proxy_service->reset(net::ProxyService::CreateUsingV8ProxyResolver( |
| 193 config_service.release(), | 186 config_service.release(), |
| 194 0u, | 187 0u, |
| 195 new net::ProxyScriptFetcherImpl(proxy_request_context_), | 188 new net::ProxyScriptFetcherImpl(proxy_request_context_), |
| 196 dhcp_factory.Create(proxy_request_context_), | |
| 197 host_resolver(), | 189 host_resolver(), |
| 198 NULL, | 190 NULL, |
| 199 NULL)); | 191 NULL)); |
| 200 | 192 |
| 201 return net::OK; | 193 return net::OK; |
| 202 } | 194 } |
| 203 | 195 |
| 204 // Creates a proxy config service that pulls from the system proxy settings. | 196 // Creates a proxy config service that pulls from the system proxy settings. |
| 205 // On success returns net::OK and fills |config_service| with a new pointer. | 197 // On success returns net::OK and fills |config_service| with a new pointer. |
| 206 // Otherwise returns a network error code. | 198 // Otherwise returns a network error code. |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 | 450 |
| 459 // Notify the delegate of completion. | 451 // Notify the delegate of completion. |
| 460 delegate_->OnCompletedConnectionTestExperiment(current, result); | 452 delegate_->OnCompletedConnectionTestExperiment(current, result); |
| 461 | 453 |
| 462 if (remaining_experiments_.empty()) { | 454 if (remaining_experiments_.empty()) { |
| 463 delegate_->OnCompletedConnectionTestSuite(); | 455 delegate_->OnCompletedConnectionTestSuite(); |
| 464 } else { | 456 } else { |
| 465 StartNextExperiment(); | 457 StartNextExperiment(); |
| 466 } | 458 } |
| 467 } | 459 } |
| OLD | NEW |