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

Side by Side Diff: net/url_request/url_request_test_util.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, 11 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
« no previous file with comments | « net/tools/fetch/fetch_client.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "net/url_request/url_request_test_util.h" 5 #include "net/url_request/url_request_test_util.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "net/http/http_network_session.h"
11 #include "net/socket/client_socket_factory.h"
12 #include "net/spdy/spdy_session_pool.h"
10 13
11 TestCookiePolicy::TestCookiePolicy(int options_bit_mask) 14 TestCookiePolicy::TestCookiePolicy(int options_bit_mask)
12 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), 15 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
13 options_(options_bit_mask), 16 options_(options_bit_mask),
14 callback_(NULL) { 17 callback_(NULL) {
15 } 18 }
16 19
17 TestCookiePolicy::~TestCookiePolicy() {} 20 TestCookiePolicy::~TestCookiePolicy() {}
18 21
19 int TestCookiePolicy::CanGetCookies(const GURL& url, 22 int TestCookiePolicy::CanGetCookies(const GURL& url,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 delete host_resolver_; 106 delete host_resolver_;
104 } 107 }
105 108
106 void TestURLRequestContext::Init() { 109 void TestURLRequestContext::Init() {
107 cert_verifier_ = new net::CertVerifier; 110 cert_verifier_ = new net::CertVerifier;
108 ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); 111 ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_);
109 ssl_config_service_ = new net::SSLConfigServiceDefaults; 112 ssl_config_service_ = new net::SSLConfigServiceDefaults;
110 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault( 113 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault(
111 host_resolver_); 114 host_resolver_);
112 http_transaction_factory_ = new net::HttpCache( 115 http_transaction_factory_ = new net::HttpCache(
113 net::HttpNetworkLayer::CreateFactory(host_resolver_, 116 new net::HttpNetworkSession(
114 cert_verifier_, 117 host_resolver_,
115 NULL /* dnsrr_resolver */, 118 cert_verifier_,
116 NULL /* dns_cert_checker */, 119 NULL /* dnsrr_resolver */,
117 NULL /* ssl_host_info_factory */, 120 NULL /* dns_cert_checker */,
118 proxy_service_, 121 NULL /* ssl_host_info_factory */,
119 ssl_config_service_, 122 proxy_service_,
120 http_auth_handler_factory_, 123 net::ClientSocketFactory::GetDefaultFactory(),
121 network_delegate_, 124 ssl_config_service_,
122 NULL), 125 new net::SpdySessionPool(ssl_config_service_),
123 NULL /* net_log */, 126 http_auth_handler_factory_,
127 network_delegate_,
128 NULL),
124 net::HttpCache::DefaultBackend::InMemory(0)); 129 net::HttpCache::DefaultBackend::InMemory(0));
125 // In-memory cookie store. 130 // In-memory cookie store.
126 cookie_store_ = new net::CookieMonster(NULL, NULL); 131 cookie_store_ = new net::CookieMonster(NULL, NULL);
127 accept_language_ = "en-us,fr"; 132 accept_language_ = "en-us,fr";
128 accept_charset_ = "iso-8859-1,*,utf-8"; 133 accept_charset_ = "iso-8859-1,*,utf-8";
129 } 134 }
130 135
131 136
132 TestURLRequest::TestURLRequest(const GURL& url, Delegate* delegate) 137 TestURLRequest::TestURLRequest(const GURL& url, Delegate* delegate)
133 : net::URLRequest(url, delegate) { 138 : net::URLRequest(url, delegate) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 if (!request->status().is_io_pending()) 277 if (!request->status().is_io_pending())
273 OnResponseCompleted(request); 278 OnResponseCompleted(request);
274 else if (cancel_in_rd_pending_) 279 else if (cancel_in_rd_pending_)
275 request->Cancel(); 280 request->Cancel();
276 } 281 }
277 282
278 void TestDelegate::OnResponseCompleted(net::URLRequest* request) { 283 void TestDelegate::OnResponseCompleted(net::URLRequest* request) {
279 if (quit_on_complete_) 284 if (quit_on_complete_)
280 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); 285 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
281 } 286 }
OLDNEW
« no previous file with comments | « net/tools/fetch/fetch_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698