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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 namespace { | 43 namespace { |
44 | 44 |
45 // ExperimentURLRequestContext ------------------------------------------------ | 45 // ExperimentURLRequestContext ------------------------------------------------ |
46 | 46 |
47 // An instance of ExperimentURLRequestContext is created for each experiment | 47 // An instance of ExperimentURLRequestContext is created for each experiment |
48 // run by ConnectionTester. The class initializes network dependencies according | 48 // run by ConnectionTester. The class initializes network dependencies according |
49 // to the specified "experiment". | 49 // to the specified "experiment". |
50 class ExperimentURLRequestContext : public net::URLRequestContext { | 50 class ExperimentURLRequestContext : public net::URLRequestContext { |
51 public: | 51 public: |
52 explicit ExperimentURLRequestContext( | 52 explicit ExperimentURLRequestContext( |
53 net::URLRequestContext* proxy_request_context) | 53 net::URLRequestContext* proxy_request_context) : |
54 : proxy_request_context_(proxy_request_context), | 54 #if !defined(OS_IOS) |
55 proxy_request_context_(proxy_request_context), | |
wtc
2013/01/04 00:58:36
Does the compiler warn about an unused class membe
justincohen
2013/01/04 03:54:10
Correct:
chrome/browser/net/connection_tester.cc:2
| |
56 #endif | |
55 ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)), | 57 ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)), |
56 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {} | 58 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {} |
57 | 59 |
58 virtual ~ExperimentURLRequestContext() {} | 60 virtual ~ExperimentURLRequestContext() {} |
59 | 61 |
60 // Creates a proxy config service for |experiment|. On success returns net::OK | 62 // Creates a proxy config service for |experiment|. On success returns net::OK |
61 // and fills |config_service| with a new pointer. Otherwise returns a network | 63 // and fills |config_service| with a new pointer. Otherwise returns a network |
62 // error code. | 64 // error code. |
63 int CreateProxyConfigService( | 65 int CreateProxyConfigService( |
64 ConnectionTester::ProxySettingsExperiment experiment, | 66 ConnectionTester::ProxySettingsExperiment experiment, |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
279 &ExperimentURLRequestContext::FirefoxProxySettingsReply, | 281 &ExperimentURLRequestContext::FirefoxProxySettingsReply, |
280 weak_factory_.GetWeakPtr(), config_service, | 282 weak_factory_.GetWeakPtr(), config_service, |
281 base::Owned(ff_settings), callback); | 283 base::Owned(ff_settings), callback); |
282 if (!content::BrowserThread::PostTaskAndReplyWithResult<int>( | 284 if (!content::BrowserThread::PostTaskAndReplyWithResult<int>( |
283 content::BrowserThread::FILE, FROM_HERE, task, reply)) | 285 content::BrowserThread::FILE, FROM_HERE, task, reply)) |
284 return net::ERR_FAILED; | 286 return net::ERR_FAILED; |
285 return net::ERR_IO_PENDING; | 287 return net::ERR_IO_PENDING; |
286 #endif | 288 #endif |
287 } | 289 } |
288 | 290 |
291 #if !defined(OS_IOS) | |
289 net::URLRequestContext* const proxy_request_context_; | 292 net::URLRequestContext* const proxy_request_context_; |
293 #endif | |
290 net::URLRequestContextStorage storage_; | 294 net::URLRequestContextStorage storage_; |
291 base::WeakPtrFactory<ExperimentURLRequestContext> weak_factory_; | 295 base::WeakPtrFactory<ExperimentURLRequestContext> weak_factory_; |
292 }; | 296 }; |
293 | 297 |
294 } // namespace | 298 } // namespace |
295 | 299 |
296 // ConnectionTester::TestRunner ---------------------------------------------- | 300 // ConnectionTester::TestRunner ---------------------------------------------- |
297 | 301 |
298 // TestRunner is a helper class for running an individual experiment. It can | 302 // TestRunner is a helper class for running an individual experiment. It can |
299 // be deleted any time after it is started, and this will abort the request. | 303 // be deleted any time after it is started, and this will abort the request. |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
534 | 538 |
535 // Notify the delegate of completion. | 539 // Notify the delegate of completion. |
536 delegate_->OnCompletedConnectionTestExperiment(current, result); | 540 delegate_->OnCompletedConnectionTestExperiment(current, result); |
537 | 541 |
538 if (remaining_experiments_.empty()) { | 542 if (remaining_experiments_.empty()) { |
539 delegate_->OnCompletedConnectionTestSuite(); | 543 delegate_->OnCompletedConnectionTestSuite(); |
540 } else { | 544 } else { |
541 StartNextExperiment(); | 545 StartNextExperiment(); |
542 } | 546 } |
543 } | 547 } |
OLD | NEW |