| OLD | NEW |
| 1 // Copyright (c) 2012 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" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 net::HostResolver::CreateSystemResolver(options, NULL /* NetLog */)); | 152 net::HostResolver::CreateSystemResolver(options, NULL /* NetLog */)); |
| 153 | 153 |
| 154 // Modify it slightly based on the experiment being run. | 154 // Modify it slightly based on the experiment being run. |
| 155 switch (experiment) { | 155 switch (experiment) { |
| 156 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_PLAIN: | 156 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_PLAIN: |
| 157 break; | 157 break; |
| 158 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_DISABLE_IPV6: | 158 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_DISABLE_IPV6: |
| 159 resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); | 159 resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); |
| 160 break; | 160 break; |
| 161 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_IPV6_PROBE: { | 161 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_IPV6_PROBE: { |
| 162 // Note that we don't use impl->ProbeIPv6Support() since that finishes | 162 // The system HostResolver will probe by default. |
| 163 // asynchronously and may not take effect in time for the test. | |
| 164 // So instead we will probe synchronously (might take 100-200 ms). | |
| 165 net::AddressFamily family = net::TestIPv6Support().ipv6_supported ? | |
| 166 net::ADDRESS_FAMILY_UNSPECIFIED : net::ADDRESS_FAMILY_IPV4; | |
| 167 resolver->SetDefaultAddressFamily(family); | |
| 168 break; | 163 break; |
| 169 } | 164 } |
| 170 default: | 165 default: |
| 171 NOTREACHED(); | 166 NOTREACHED(); |
| 172 return net::ERR_UNEXPECTED; | 167 return net::ERR_UNEXPECTED; |
| 173 } | 168 } |
| 174 host_resolver->swap(resolver); | 169 host_resolver->swap(resolver); |
| 175 return net::OK; | 170 return net::OK; |
| 176 } | 171 } |
| 177 | 172 |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 | 529 |
| 535 // Notify the delegate of completion. | 530 // Notify the delegate of completion. |
| 536 delegate_->OnCompletedConnectionTestExperiment(current, result); | 531 delegate_->OnCompletedConnectionTestExperiment(current, result); |
| 537 | 532 |
| 538 if (remaining_experiments_.empty()) { | 533 if (remaining_experiments_.empty()) { |
| 539 delegate_->OnCompletedConnectionTestSuite(); | 534 delegate_->OnCompletedConnectionTestSuite(); |
| 540 } else { | 535 } else { |
| 541 StartNextExperiment(); | 536 StartNextExperiment(); |
| 542 } | 537 } |
| 543 } | 538 } |
| OLD | NEW |