Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(477)

Side by Side Diff: chrome/browser/net/connection_tester.cc

Issue 6402002: Simplify HttpCache/HttpNetworkLayer/HttpNetworkSession interaction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits. Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/threading/thread_restrictions.h" 11 #include "base/threading/thread_restrictions.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/importer/firefox_proxy_settings.h" 13 #include "chrome/browser/importer/firefox_proxy_settings.h"
14 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
15 #include "net/base/cert_verifier.h" 15 #include "net/base/cert_verifier.h"
16 #include "net/base/cookie_monster.h" 16 #include "net/base/cookie_monster.h"
17 #include "net/base/dnsrr_resolver.h" 17 #include "net/base/dnsrr_resolver.h"
18 #include "net/base/host_resolver.h" 18 #include "net/base/host_resolver.h"
19 #include "net/base/host_resolver_impl.h" 19 #include "net/base/host_resolver_impl.h"
20 #include "net/base/io_buffer.h" 20 #include "net/base/io_buffer.h"
21 #include "net/base/net_errors.h" 21 #include "net/base/net_errors.h"
22 #include "net/base/net_util.h" 22 #include "net/base/net_util.h"
23 #include "net/base/ssl_config_service_defaults.h" 23 #include "net/base/ssl_config_service_defaults.h"
24 #include "net/disk_cache/disk_cache.h" 24 #include "net/disk_cache/disk_cache.h"
25 #include "net/ftp/ftp_network_layer.h" 25 #include "net/ftp/ftp_network_layer.h"
26 #include "net/http/http_auth_handler_factory.h" 26 #include "net/http/http_auth_handler_factory.h"
27 #include "net/http/http_cache.h" 27 #include "net/http/http_cache.h"
28 #include "net/http/http_network_layer.h" 28 #include "net/http/http_network_session.h"
29 #include "net/proxy/proxy_config_service_fixed.h" 29 #include "net/proxy/proxy_config_service_fixed.h"
30 #include "net/proxy/proxy_script_fetcher_impl.h" 30 #include "net/proxy/proxy_script_fetcher_impl.h"
31 #include "net/socket/client_socket_factory.h"
32 #include "net/spdy/spdy_session_pool.h"
31 #include "net/url_request/url_request.h" 33 #include "net/url_request/url_request.h"
32 #include "net/url_request/url_request_context.h" 34 #include "net/url_request/url_request_context.h"
33 35
34 namespace { 36 namespace {
35 37
36 // ExperimentURLRequestContext ------------------------------------------------ 38 // ExperimentURLRequestContext ------------------------------------------------
37 39
38 // An instance of ExperimentURLRequestContext is created for each experiment 40 // An instance of ExperimentURLRequestContext is created for each experiment
39 // run by ConnectionTester. The class initializes network dependencies according 41 // run by ConnectionTester. The class initializes network dependencies according
40 // to the specified "experiment". 42 // to the specified "experiment".
(...skipping 19 matching lines...) Expand all
60 return rv; // Failure. 62 return rv; // Failure.
61 63
62 // The rest of the dependencies are standard, and don't depend on the 64 // The rest of the dependencies are standard, and don't depend on the
63 // experiment being run. 65 // experiment being run.
64 cert_verifier_ = new net::CertVerifier; 66 cert_verifier_ = new net::CertVerifier;
65 dnsrr_resolver_ = new net::DnsRRResolver; 67 dnsrr_resolver_ = new net::DnsRRResolver;
66 ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); 68 ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_);
67 ssl_config_service_ = new net::SSLConfigServiceDefaults; 69 ssl_config_service_ = new net::SSLConfigServiceDefaults;
68 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault( 70 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault(
69 host_resolver_); 71 host_resolver_);
72 scoped_refptr<net::HttpNetworkSession> network_session(
73 new net::HttpNetworkSession(
74 host_resolver_,
75 cert_verifier_,
76 dnsrr_resolver_,
77 NULL /* dns_cert_checker */,
78 NULL /* ssl_host_info_factory */,
79 proxy_service_,
80 net::ClientSocketFactory::GetDefaultFactory(),
81 ssl_config_service_,
82 new net::SpdySessionPool(NULL),
83 http_auth_handler_factory_,
84 NULL /* network_delegate */,
85 NULL /* net_log */));
70 http_transaction_factory_ = new net::HttpCache( 86 http_transaction_factory_ = new net::HttpCache(
71 net::HttpNetworkLayer::CreateFactory(host_resolver_, cert_verifier_, 87 network_session,
72 dnsrr_resolver_, NULL /* dns_cert_checker */,
73 NULL /* ssl_host_info_factory */, proxy_service_,
74 ssl_config_service_, http_auth_handler_factory_, NULL, NULL),
75 NULL /* net_log */,
76 net::HttpCache::DefaultBackend::InMemory(0)); 88 net::HttpCache::DefaultBackend::InMemory(0));
77 // In-memory cookie store. 89 // In-memory cookie store.
78 cookie_store_ = new net::CookieMonster(NULL, NULL); 90 cookie_store_ = new net::CookieMonster(NULL, NULL);
79 91
80 return net::OK; 92 return net::OK;
81 } 93 }
82 94
83 protected: 95 protected:
84 virtual ~ExperimentURLRequestContext() { 96 virtual ~ExperimentURLRequestContext() {
85 delete ftp_transaction_factory_; 97 delete ftp_transaction_factory_;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 436
425 // Notify the delegate of completion. 437 // Notify the delegate of completion.
426 delegate_->OnCompletedConnectionTestExperiment(current, result); 438 delegate_->OnCompletedConnectionTestExperiment(current, result);
427 439
428 if (remaining_experiments_.empty()) { 440 if (remaining_experiments_.empty()) {
429 delegate_->OnCompletedConnectionTestSuite(); 441 delegate_->OnCompletedConnectionTestSuite();
430 } else { 442 } else {
431 StartNextExperiment(); 443 StartNextExperiment();
432 } 444 }
433 } 445 }
OLDNEW
« no previous file with comments | « chrome/browser/net/chrome_url_request_context.cc ('k') | chrome/browser/net/connection_tester_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698