| 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 18 matching lines...) Expand all Loading... |
| 29 #include "net/http/transport_security_state.h" | 29 #include "net/http/transport_security_state.h" |
| 30 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" | 30 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" |
| 31 #include "net/proxy/proxy_config_service_fixed.h" | 31 #include "net/proxy/proxy_config_service_fixed.h" |
| 32 #include "net/proxy/proxy_script_fetcher_impl.h" | 32 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 33 #include "net/proxy/proxy_service.h" | 33 #include "net/proxy/proxy_service.h" |
| 34 #include "net/proxy/proxy_service_v8.h" | 34 #include "net/proxy/proxy_service_v8.h" |
| 35 #include "net/ssl/ssl_config_service_defaults.h" | 35 #include "net/ssl/ssl_config_service_defaults.h" |
| 36 #include "net/url_request/url_request.h" | 36 #include "net/url_request/url_request.h" |
| 37 #include "net/url_request/url_request_context.h" | 37 #include "net/url_request/url_request_context.h" |
| 38 #include "net/url_request/url_request_context_storage.h" | 38 #include "net/url_request/url_request_context_storage.h" |
| 39 #include "net/url_request/url_request_job_factory_impl.h" |
| 39 | 40 |
| 40 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 41 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 41 #include "chrome/browser/net/firefox_proxy_settings.h" | 42 #include "chrome/browser/net/firefox_proxy_settings.h" |
| 42 #endif | 43 #endif |
| 43 | 44 |
| 44 namespace { | 45 namespace { |
| 45 | 46 |
| 46 // ExperimentURLRequestContext ------------------------------------------------ | 47 // ExperimentURLRequestContext ------------------------------------------------ |
| 47 | 48 |
| 48 // An instance of ExperimentURLRequestContext is created for each experiment | 49 // An instance of ExperimentURLRequestContext is created for each experiment |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 session_params.http_auth_handler_factory = http_auth_handler_factory(); | 128 session_params.http_auth_handler_factory = http_auth_handler_factory(); |
| 128 session_params.http_server_properties = http_server_properties(); | 129 session_params.http_server_properties = http_server_properties(); |
| 129 session_params.net_log = net_log; | 130 session_params.net_log = net_log; |
| 130 scoped_refptr<net::HttpNetworkSession> network_session( | 131 scoped_refptr<net::HttpNetworkSession> network_session( |
| 131 new net::HttpNetworkSession(session_params)); | 132 new net::HttpNetworkSession(session_params)); |
| 132 storage_.set_http_transaction_factory(new net::HttpCache( | 133 storage_.set_http_transaction_factory(new net::HttpCache( |
| 133 network_session.get(), net::HttpCache::DefaultBackend::InMemory(0))); | 134 network_session.get(), net::HttpCache::DefaultBackend::InMemory(0))); |
| 134 // In-memory cookie store. | 135 // In-memory cookie store. |
| 135 storage_.set_cookie_store( | 136 storage_.set_cookie_store( |
| 136 content::CreateCookieStore(content::CookieStoreConfig())); | 137 content::CreateCookieStore(content::CookieStoreConfig())); |
| 138 // Creating a new job factory avoids added ProtocolHandlers and |
| 139 // layered URLRequestInterceptingJobFactories. |
| 140 storage_.set_job_factory(new net::URLRequestJobFactoryImpl()); |
| 137 | 141 |
| 138 return net::OK; | 142 return net::OK; |
| 139 } | 143 } |
| 140 | 144 |
| 141 private: | 145 private: |
| 142 // Creates a host resolver for |experiment|. On success returns net::OK and | 146 // Creates a host resolver for |experiment|. On success returns net::OK and |
| 143 // fills |host_resolver| with a new pointer. Otherwise returns a network | 147 // fills |host_resolver| with a new pointer. Otherwise returns a network |
| 144 // error code. | 148 // error code. |
| 145 int CreateHostResolver( | 149 int CreateHostResolver( |
| 146 ConnectionTester::HostResolverExperiment experiment, | 150 ConnectionTester::HostResolverExperiment experiment, |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 | 534 |
| 531 // Notify the delegate of completion. | 535 // Notify the delegate of completion. |
| 532 delegate_->OnCompletedConnectionTestExperiment(current, result); | 536 delegate_->OnCompletedConnectionTestExperiment(current, result); |
| 533 | 537 |
| 534 if (remaining_experiments_.empty()) { | 538 if (remaining_experiments_.empty()) { |
| 535 delegate_->OnCompletedConnectionTestSuite(); | 539 delegate_->OnCompletedConnectionTestSuite(); |
| 536 } else { | 540 } else { |
| 537 StartNextExperiment(); | 541 StartNextExperiment(); |
| 538 } | 542 } |
| 539 } | 543 } |
| OLD | NEW |