OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "chrome/browser/importer/firefox_proxy_settings.h" | 15 #include "chrome/browser/importer/firefox_proxy_settings.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "net/base/cert_verifier.h" | 17 #include "net/base/cert_verifier.h" |
18 #include "net/base/cookie_monster.h" | 18 #include "net/base/cookie_monster.h" |
19 #include "net/base/host_resolver.h" | 19 #include "net/base/host_resolver.h" |
20 #include "net/base/host_resolver_impl.h" | |
21 #include "net/base/io_buffer.h" | 20 #include "net/base/io_buffer.h" |
22 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
23 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
24 #include "net/base/ssl_config_service_defaults.h" | 23 #include "net/base/ssl_config_service_defaults.h" |
25 #include "net/ftp/ftp_network_layer.h" | 24 #include "net/ftp/ftp_network_layer.h" |
26 #include "net/http/http_auth_handler_factory.h" | 25 #include "net/http/http_auth_handler_factory.h" |
27 #include "net/http/http_cache.h" | 26 #include "net/http/http_cache.h" |
28 #include "net/http/http_network_session.h" | 27 #include "net/http/http_network_session.h" |
29 #include "net/http/http_server_properties_impl.h" | 28 #include "net/http/http_server_properties_impl.h" |
30 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" | 29 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 private: | 102 private: |
104 // Creates a host resolver for |experiment|. On success returns net::OK and | 103 // Creates a host resolver for |experiment|. On success returns net::OK and |
105 // fills |host_resolver| with a new pointer. Otherwise returns a network | 104 // fills |host_resolver| with a new pointer. Otherwise returns a network |
106 // error code. | 105 // error code. |
107 int CreateHostResolver( | 106 int CreateHostResolver( |
108 ConnectionTester::HostResolverExperiment experiment, | 107 ConnectionTester::HostResolverExperiment experiment, |
109 scoped_ptr<net::HostResolver>* host_resolver) { | 108 scoped_ptr<net::HostResolver>* host_resolver) { |
110 // Create a vanilla HostResolver that disables caching. | 109 // Create a vanilla HostResolver that disables caching. |
111 const size_t kMaxJobs = 50u; | 110 const size_t kMaxJobs = 50u; |
112 const size_t kMaxRetryAttempts = 4u; | 111 const size_t kMaxRetryAttempts = 4u; |
113 net::HostResolverImpl* impl = | 112 net::HostResolver* impl = net::CreateNonCachingSystemHostResolver( |
114 new net::HostResolverImpl(NULL, NULL, kMaxJobs, kMaxRetryAttempts, | 113 kMaxJobs, |
115 NULL); | 114 kMaxRetryAttempts, |
| 115 NULL /* NetLog */); |
116 | 116 |
117 host_resolver->reset(impl); | 117 host_resolver->reset(impl); |
118 | 118 |
119 // Modify it slightly based on the experiment being run. | 119 // Modify it slightly based on the experiment being run. |
120 switch (experiment) { | 120 switch (experiment) { |
121 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_PLAIN: | 121 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_PLAIN: |
122 return net::OK; | 122 return net::OK; |
123 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_DISABLE_IPV6: | 123 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_DISABLE_IPV6: |
124 impl->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); | 124 impl->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); |
125 return net::OK; | 125 return net::OK; |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 | 461 |
462 // Notify the delegate of completion. | 462 // Notify the delegate of completion. |
463 delegate_->OnCompletedConnectionTestExperiment(current, result); | 463 delegate_->OnCompletedConnectionTestExperiment(current, result); |
464 | 464 |
465 if (remaining_experiments_.empty()) { | 465 if (remaining_experiments_.empty()) { |
466 delegate_->OnCompletedConnectionTestSuite(); | 466 delegate_->OnCompletedConnectionTestSuite(); |
467 } else { | 467 } else { |
468 StartNextExperiment(); | 468 StartNextExperiment(); |
469 } | 469 } |
470 } | 470 } |
OLD | NEW |