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/browser/browser_thread.h" | 7 #include "chrome/browser/browser_thread.h" |
8 #include "chrome/test/testing_pref_service.h" | 8 #include "chrome/test/testing_pref_service.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/base/ssl_config_service_defaults.h" | 13 #include "net/base/ssl_config_service_defaults.h" |
14 #include "net/ftp/ftp_network_layer.h" | 14 #include "net/ftp/ftp_network_layer.h" |
15 #include "net/http/http_auth_handler_factory.h" | 15 #include "net/http/http_auth_handler_factory.h" |
16 #include "net/http/http_network_layer.h" | 16 #include "net/http/http_network_layer.h" |
| 17 #include "net/http/http_network_session.h" |
17 #include "net/proxy/proxy_config_service_fixed.h" | 18 #include "net/proxy/proxy_config_service_fixed.h" |
18 #include "net/socket/client_socket_factory.h" | 19 #include "net/socket/client_socket_factory.h" |
19 #include "net/spdy/spdy_session_pool.h" | 20 #include "net/spdy/spdy_session_pool.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" |
23 #include "testing/platform_test.h" | 24 #include "testing/platform_test.h" |
24 | 25 |
25 namespace { | 26 namespace { |
26 | 27 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 private: | 111 private: |
111 void InitializeRequestContext() { | 112 void InitializeRequestContext() { |
112 proxy_script_fetcher_context_->set_host_resolver(&host_resolver_); | 113 proxy_script_fetcher_context_->set_host_resolver(&host_resolver_); |
113 proxy_script_fetcher_context_->set_cert_verifier(&cert_verifier_); | 114 proxy_script_fetcher_context_->set_cert_verifier(&cert_verifier_); |
114 proxy_script_fetcher_context_->set_dnsrr_resolver(&dnsrr_resolver_); | 115 proxy_script_fetcher_context_->set_dnsrr_resolver(&dnsrr_resolver_); |
115 proxy_script_fetcher_context_->set_http_auth_handler_factory( | 116 proxy_script_fetcher_context_->set_http_auth_handler_factory( |
116 &http_auth_handler_factory_); | 117 &http_auth_handler_factory_); |
117 proxy_service_ = net::ProxyService::CreateDirect(); | 118 proxy_service_ = net::ProxyService::CreateDirect(); |
118 proxy_script_fetcher_context_->set_proxy_service(proxy_service_); | 119 proxy_script_fetcher_context_->set_proxy_service(proxy_service_); |
119 ssl_config_service_ = net::SSLConfigService::CreateSystemSSLConfigService(); | 120 ssl_config_service_ = net::SSLConfigService::CreateSystemSSLConfigService(); |
120 http_transaction_factory_.reset( | 121 scoped_refptr<net::HttpNetworkSession> network_session( |
121 new net::HttpNetworkLayer( | 122 new net::HttpNetworkSession( |
122 client_socket_factory_, | |
123 &host_resolver_, | 123 &host_resolver_, |
124 &cert_verifier_, | 124 &cert_verifier_, |
125 &dnsrr_resolver_, | 125 &dnsrr_resolver_, |
126 NULL /* DNS cert provenance checker */, | 126 NULL /* dns_cert_checker */, |
127 NULL /* ssl_host_info_factory */, | 127 NULL /* ssl_host_info_factory */, |
128 proxy_service_.get(), | 128 proxy_service_.get(), |
| 129 client_socket_factory_, |
129 ssl_config_service_, | 130 ssl_config_service_, |
130 new net::SpdySessionPool(ssl_config_service_), | 131 new net::SpdySessionPool(ssl_config_service_), |
131 &http_auth_handler_factory_, | 132 &http_auth_handler_factory_, |
132 NULL /* NetworkDelegate */, | 133 NULL /* network_delegate */, |
133 NULL /* NetLog */)); | 134 NULL /* net_log */)); |
| 135 http_transaction_factory_.reset( |
| 136 new net::HttpNetworkLayer(network_session)); |
134 proxy_script_fetcher_context_->set_http_transaction_factory( | 137 proxy_script_fetcher_context_->set_http_transaction_factory( |
135 http_transaction_factory_.get()); | 138 http_transaction_factory_.get()); |
136 // In-memory cookie store. | 139 // In-memory cookie store. |
137 proxy_script_fetcher_context_->set_cookie_store( | 140 proxy_script_fetcher_context_->set_cookie_store( |
138 new net::CookieMonster(NULL, NULL)); | 141 new net::CookieMonster(NULL, NULL)); |
139 } | 142 } |
140 | 143 |
141 MessageLoop message_loop_; | 144 MessageLoop message_loop_; |
142 BrowserThread io_thread_; | 145 BrowserThread io_thread_; |
143 }; | 146 }; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // any pending tasks instead of running them. This causes a problem with | 195 // any pending tasks instead of running them. This causes a problem with |
193 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer | 196 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer |
194 // |backup_task| that it will try to deref during the destructor, but | 197 // |backup_task| that it will try to deref during the destructor, but |
195 // depending on the order that pending tasks were deleted in, it might | 198 // depending on the order that pending tasks were deleted in, it might |
196 // already be invalid! See http://crbug.com/43291. | 199 // already be invalid! See http://crbug.com/43291. |
197 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 200 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); |
198 MessageLoop::current()->Run(); | 201 MessageLoop::current()->Run(); |
199 } | 202 } |
200 | 203 |
201 } // namespace | 204 } // namespace |
OLD | NEW |