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 "chrome/test/base/testing_pref_service.h" | 7 #include "chrome/test/base/testing_pref_service.h" |
8 #include "content/browser/browser_thread.h" | 8 #include "content/browser/browser_thread.h" |
9 #include "net/base/cert_verifier.h" | 9 #include "net/base/cert_verifier.h" |
10 #include "net/base/cookie_monster.h" | 10 #include "net/base/cookie_monster.h" |
11 #include "net/base/dnsrr_resolver.h" | 11 #include "net/base/dnsrr_resolver.h" |
12 #include "net/base/mock_host_resolver.h" | 12 #include "net/base/mock_host_resolver.h" |
| 13 #include "net/spdy/spdy_config_service_defaults.h" |
13 #include "net/base/ssl_config_service_defaults.h" | 14 #include "net/base/ssl_config_service_defaults.h" |
14 #include "net/ftp/ftp_network_layer.h" | 15 #include "net/ftp/ftp_network_layer.h" |
15 #include "net/http/http_auth_handler_factory.h" | 16 #include "net/http/http_auth_handler_factory.h" |
16 #include "net/http/http_network_layer.h" | 17 #include "net/http/http_network_layer.h" |
17 #include "net/http/http_network_session.h" | 18 #include "net/http/http_network_session.h" |
18 #include "net/proxy/proxy_config_service_fixed.h" | 19 #include "net/proxy/proxy_config_service_fixed.h" |
19 #include "net/proxy/proxy_service.h" | 20 #include "net/proxy/proxy_service.h" |
20 #include "net/test/test_server.h" | 21 #include "net/test/test_server.h" |
21 #include "net/url_request/url_request_context.h" | 22 #include "net/url_request/url_request_context.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // MessageLoop is already destroyed, then the RemoveObserver will be a | 101 // MessageLoop is already destroyed, then the RemoveObserver will be a |
101 // no-op, and the ObserverList will contain invalid entries. | 102 // no-op, and the ObserverList will contain invalid entries. |
102 MessageLoop message_loop_; | 103 MessageLoop message_loop_; |
103 BrowserThread io_thread_; | 104 BrowserThread io_thread_; |
104 net::TestServer test_server_; | 105 net::TestServer test_server_; |
105 ConnectionTesterDelegate test_delegate_; | 106 ConnectionTesterDelegate test_delegate_; |
106 net::MockHostResolver host_resolver_; | 107 net::MockHostResolver host_resolver_; |
107 net::CertVerifier cert_verifier_; | 108 net::CertVerifier cert_verifier_; |
108 net::DnsRRResolver dnsrr_resolver_; | 109 net::DnsRRResolver dnsrr_resolver_; |
109 scoped_ptr<net::ProxyService> proxy_service_; | 110 scoped_ptr<net::ProxyService> proxy_service_; |
| 111 scoped_refptr<net::SpdyConfigService> spdy_config_service_; |
110 scoped_refptr<net::SSLConfigService> ssl_config_service_; | 112 scoped_refptr<net::SSLConfigService> ssl_config_service_; |
111 scoped_ptr<net::HttpTransactionFactory> http_transaction_factory_; | 113 scoped_ptr<net::HttpTransactionFactory> http_transaction_factory_; |
112 net::HttpAuthHandlerRegistryFactory http_auth_handler_factory_; | 114 net::HttpAuthHandlerRegistryFactory http_auth_handler_factory_; |
113 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context_; | 115 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context_; |
114 | 116 |
115 private: | 117 private: |
116 void InitializeRequestContext() { | 118 void InitializeRequestContext() { |
117 proxy_script_fetcher_context_->set_host_resolver(&host_resolver_); | 119 proxy_script_fetcher_context_->set_host_resolver(&host_resolver_); |
118 proxy_script_fetcher_context_->set_cert_verifier(&cert_verifier_); | 120 proxy_script_fetcher_context_->set_cert_verifier(&cert_verifier_); |
119 proxy_script_fetcher_context_->set_dnsrr_resolver(&dnsrr_resolver_); | 121 proxy_script_fetcher_context_->set_dnsrr_resolver(&dnsrr_resolver_); |
120 proxy_script_fetcher_context_->set_http_auth_handler_factory( | 122 proxy_script_fetcher_context_->set_http_auth_handler_factory( |
121 &http_auth_handler_factory_); | 123 &http_auth_handler_factory_); |
122 proxy_service_.reset(net::ProxyService::CreateDirect()); | 124 proxy_service_.reset(net::ProxyService::CreateDirect()); |
123 proxy_script_fetcher_context_->set_proxy_service(proxy_service_.get()); | 125 proxy_script_fetcher_context_->set_proxy_service(proxy_service_.get()); |
| 126 spdy_config_service_ = new net::SpdyConfigServiceDefaults; |
124 ssl_config_service_ = new net::SSLConfigServiceDefaults; | 127 ssl_config_service_ = new net::SSLConfigServiceDefaults; |
125 net::HttpNetworkSession::Params session_params; | 128 net::HttpNetworkSession::Params session_params; |
126 session_params.host_resolver = &host_resolver_; | 129 session_params.host_resolver = &host_resolver_; |
127 session_params.cert_verifier = &cert_verifier_; | 130 session_params.cert_verifier = &cert_verifier_; |
128 session_params.dnsrr_resolver = &dnsrr_resolver_; | 131 session_params.dnsrr_resolver = &dnsrr_resolver_; |
129 session_params.http_auth_handler_factory = &http_auth_handler_factory_; | 132 session_params.http_auth_handler_factory = &http_auth_handler_factory_; |
130 session_params.ssl_config_service = ssl_config_service_; | 133 session_params.ssl_config_service = ssl_config_service_; |
131 session_params.proxy_service = proxy_service_.get(); | 134 session_params.proxy_service = proxy_service_.get(); |
132 scoped_refptr<net::HttpNetworkSession> network_session( | 135 scoped_refptr<net::HttpNetworkSession> network_session( |
133 new net::HttpNetworkSession(session_params)); | 136 new net::HttpNetworkSession(session_params)); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // any pending tasks instead of running them. This causes a problem with | 194 // any pending tasks instead of running them. This causes a problem with |
192 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer | 195 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer |
193 // |backup_task| that it will try to deref during the destructor, but | 196 // |backup_task| that it will try to deref during the destructor, but |
194 // depending on the order that pending tasks were deleted in, it might | 197 // depending on the order that pending tasks were deleted in, it might |
195 // already be invalid! See http://crbug.com/43291. | 198 // already be invalid! See http://crbug.com/43291. |
196 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 199 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); |
197 MessageLoop::current()->Run(); | 200 MessageLoop::current()->Run(); |
198 } | 201 } |
199 | 202 |
200 } // namespace | 203 } // namespace |
OLD | NEW |