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" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 private: | 101 private: |
102 // Creates a host resolver for |experiment|. On success returns net::OK and | 102 // Creates a host resolver for |experiment|. On success returns net::OK and |
103 // fills |host_resolver| with a new pointer. Otherwise returns a network | 103 // fills |host_resolver| with a new pointer. Otherwise returns a network |
104 // error code. | 104 // error code. |
105 int CreateHostResolver( | 105 int CreateHostResolver( |
106 ConnectionTester::HostResolverExperiment experiment, | 106 ConnectionTester::HostResolverExperiment experiment, |
107 scoped_ptr<net::HostResolver>* host_resolver) { | 107 scoped_ptr<net::HostResolver>* host_resolver) { |
108 // Create a vanilla HostResolver that disables caching. | 108 // Create a vanilla HostResolver that disables caching. |
109 const size_t kMaxJobs = 50u; | 109 const size_t kMaxJobs = 50u; |
| 110 const size_t kMaxRetryAttempts = 4u; |
110 net::HostResolverImpl* impl = | 111 net::HostResolverImpl* impl = |
111 new net::HostResolverImpl(NULL, NULL, kMaxJobs, NULL); | 112 new net::HostResolverImpl(NULL, NULL, kMaxJobs, kMaxRetryAttempts, |
| 113 NULL); |
112 | 114 |
113 host_resolver->reset(impl); | 115 host_resolver->reset(impl); |
114 | 116 |
115 // Modify it slightly based on the experiment being run. | 117 // Modify it slightly based on the experiment being run. |
116 switch (experiment) { | 118 switch (experiment) { |
117 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_PLAIN: | 119 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_PLAIN: |
118 return net::OK; | 120 return net::OK; |
119 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_DISABLE_IPV6: | 121 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_DISABLE_IPV6: |
120 impl->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); | 122 impl->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); |
121 return net::OK; | 123 return net::OK; |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 | 452 |
451 // Notify the delegate of completion. | 453 // Notify the delegate of completion. |
452 delegate_->OnCompletedConnectionTestExperiment(current, result); | 454 delegate_->OnCompletedConnectionTestExperiment(current, result); |
453 | 455 |
454 if (remaining_experiments_.empty()) { | 456 if (remaining_experiments_.empty()) { |
455 delegate_->OnCompletedConnectionTestSuite(); | 457 delegate_->OnCompletedConnectionTestSuite(); |
456 } else { | 458 } else { |
457 StartNextExperiment(); | 459 StartNextExperiment(); |
458 } | 460 } |
459 } | 461 } |
OLD | NEW |