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

Side by Side Diff: net/url_request/url_request_test_util.cc

Issue 10918279: Provide mutable members of UrlRequestContext via pure-virtual interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add TODO Created 8 years, 1 month 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) 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 "net/url_request/url_request_test_util.h" 5 #include "net/url_request/url_request_test_util.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "base/threading/worker_pool.h" 11 #include "base/threading/worker_pool.h"
12 #include "net/base/cert_verifier.h" 12 #include "net/base/cert_verifier.h"
13 #include "net/base/default_server_bound_cert_store.h" 13 #include "net/base/default_server_bound_cert_store.h"
14 #include "net/base/host_port_pair.h" 14 #include "net/base/host_port_pair.h"
15 #include "net/base/mock_host_resolver.h" 15 #include "net/base/mock_host_resolver.h"
16 #include "net/base/server_bound_cert_service.h" 16 #include "net/base/server_bound_cert_service.h"
17 #include "net/http/http_network_session.h" 17 #include "net/http/http_network_session.h"
18 #include "net/http/http_server_properties_impl.h" 18 #include "net/http/http_server_properties_impl.h"
19 #include "net/url_request/static_http_user_agent_settings.h"
19 #include "net/url_request/url_request_job_factory_impl.h" 20 #include "net/url_request/url_request_job_factory_impl.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 22
22 namespace { 23 namespace {
23 24
24 // These constants put the net::NetworkDelegate events of TestNetworkDelegate 25 // These constants put the net::NetworkDelegate events of TestNetworkDelegate
25 // into an order. They are used in conjunction with 26 // into an order. They are used in conjunction with
26 // |TestNetworkDelegate::next_states_| to check that we do not send 27 // |TestNetworkDelegate::next_states_| to check that we do not send
27 // events in the wrong order. 28 // events in the wrong order.
28 const int kStageBeforeURLRequest = 1 << 0; 29 const int kStageBeforeURLRequest = 1 << 0;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // In-memory cookie store. 103 // In-memory cookie store.
103 if (!cookie_store()) 104 if (!cookie_store())
104 context_storage_.set_cookie_store(new net::CookieMonster(NULL, NULL)); 105 context_storage_.set_cookie_store(new net::CookieMonster(NULL, NULL));
105 // In-memory origin bound cert service. 106 // In-memory origin bound cert service.
106 if (!server_bound_cert_service()) { 107 if (!server_bound_cert_service()) {
107 context_storage_.set_server_bound_cert_service( 108 context_storage_.set_server_bound_cert_service(
108 new net::ServerBoundCertService( 109 new net::ServerBoundCertService(
109 new net::DefaultServerBoundCertStore(NULL), 110 new net::DefaultServerBoundCertStore(NULL),
110 base::WorkerPool::GetTaskRunner(true))); 111 base::WorkerPool::GetTaskRunner(true)));
111 } 112 }
112 if (accept_language().empty()) 113 if (!http_user_agent_settings()) {
113 set_accept_language("en-us,fr"); 114 context_storage_.set_http_user_agent_settings(
114 if (accept_charset().empty()) 115 new net::StaticHttpUserAgentSettings(
115 set_accept_charset("iso-8859-1,*,utf-8"); 116 "en-us,fr", "iso-8859-1,*,utf-8", EmptyString()));
117 }
116 if (!job_factory()) 118 if (!job_factory())
117 context_storage_.set_job_factory(new net::URLRequestJobFactoryImpl); 119 context_storage_.set_job_factory(new net::URLRequestJobFactoryImpl);
118 } 120 }
119 121
120 TestURLRequest::TestURLRequest(const GURL& url, 122 TestURLRequest::TestURLRequest(const GURL& url,
121 Delegate* delegate, 123 Delegate* delegate,
122 TestURLRequestContext* context) 124 TestURLRequestContext* context)
123 : net::URLRequest(url, delegate, context) { 125 : net::URLRequest(url, delegate, context) {
124 } 126 }
125 127
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 553
552 net::URLRequestJob* TestJobInterceptor::MaybeInterceptResponse( 554 net::URLRequestJob* TestJobInterceptor::MaybeInterceptResponse(
553 net::URLRequest* request, 555 net::URLRequest* request,
554 net::NetworkDelegate* network_delegate) const { 556 net::NetworkDelegate* network_delegate) const {
555 return NULL; 557 return NULL;
556 } 558 }
557 559
558 void TestJobInterceptor::set_main_intercept_job(net::URLRequestJob* job) { 560 void TestJobInterceptor::set_main_intercept_job(net::URLRequestJob* job) {
559 main_intercept_job_ = job; 561 main_intercept_job_ = job;
560 } 562 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698