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

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

Issue 1680893002: Moving proxy resolution logic out of NetworkDelegate and into ProxyDelegate for DataReductionProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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
« no previous file with comments | « net/url_request/url_request_test_util.h ('k') | net/websockets/websocket_end_to_end_test.cc » ('j') | 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) 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 <utility> 7 #include <utility>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 const int kStageResponseStarted = 1 << 6; 45 const int kStageResponseStarted = 1 << 6;
46 const int kStageCompletedSuccess = 1 << 7; 46 const int kStageCompletedSuccess = 1 << 7;
47 const int kStageCompletedError = 1 << 8; 47 const int kStageCompletedError = 1 << 8;
48 const int kStageURLRequestDestroyed = 1 << 9; 48 const int kStageURLRequestDestroyed = 1 << 9;
49 const int kStageDestruction = 1 << 10; 49 const int kStageDestruction = 1 << 10;
50 50
51 } // namespace 51 } // namespace
52 52
53 TestURLRequestContext::TestURLRequestContext() 53 TestURLRequestContext::TestURLRequestContext()
54 : initialized_(false), 54 : initialized_(false),
55 client_socket_factory_(NULL), 55 client_socket_factory_(nullptr),
56 proxy_delegate_(nullptr),
56 context_storage_(this) { 57 context_storage_(this) {
57 Init(); 58 Init();
58 } 59 }
59 60
60 TestURLRequestContext::TestURLRequestContext(bool delay_initialization) 61 TestURLRequestContext::TestURLRequestContext(bool delay_initialization)
61 : initialized_(false), 62 : initialized_(false),
62 client_socket_factory_(NULL), 63 client_socket_factory_(nullptr),
64 proxy_delegate_(nullptr),
63 context_storage_(this) { 65 context_storage_(this) {
64 if (!delay_initialization) 66 if (!delay_initialization)
65 Init(); 67 Init();
66 } 68 }
67 69
68 TestURLRequestContext::~TestURLRequestContext() { 70 TestURLRequestContext::~TestURLRequestContext() {
69 DCHECK(initialized_); 71 DCHECK(initialized_);
70 AssertNoURLRequests(); 72 AssertNoURLRequests();
71 } 73 }
72 74
(...skipping 19 matching lines...) Expand all
92 } 94 }
93 if (!http_server_properties()) { 95 if (!http_server_properties()) {
94 context_storage_.set_http_server_properties( 96 context_storage_.set_http_server_properties(
95 scoped_ptr<HttpServerProperties>(new HttpServerPropertiesImpl())); 97 scoped_ptr<HttpServerProperties>(new HttpServerPropertiesImpl()));
96 } 98 }
97 if (http_transaction_factory()) { 99 if (http_transaction_factory()) {
98 // Make sure we haven't been passed an object we're not going to use. 100 // Make sure we haven't been passed an object we're not going to use.
99 EXPECT_FALSE(client_socket_factory_); 101 EXPECT_FALSE(client_socket_factory_);
100 } else { 102 } else {
101 HttpNetworkSession::Params params; 103 HttpNetworkSession::Params params;
104
102 if (http_network_session_params_) 105 if (http_network_session_params_)
103 params = *http_network_session_params_; 106 params = *http_network_session_params_;
104 params.client_socket_factory = client_socket_factory(); 107 params.client_socket_factory = client_socket_factory();
108 params.proxy_delegate = proxy_delegate();
105 params.host_resolver = host_resolver(); 109 params.host_resolver = host_resolver();
106 params.cert_verifier = cert_verifier(); 110 params.cert_verifier = cert_verifier();
107 params.transport_security_state = transport_security_state(); 111 params.transport_security_state = transport_security_state();
108 params.proxy_service = proxy_service(); 112 params.proxy_service = proxy_service();
109 params.ssl_config_service = ssl_config_service(); 113 params.ssl_config_service = ssl_config_service();
110 params.http_auth_handler_factory = http_auth_handler_factory(); 114 params.http_auth_handler_factory = http_auth_handler_factory();
111 params.network_delegate = network_delegate(); 115 params.network_delegate = network_delegate();
112 params.http_server_properties = http_server_properties(); 116 params.http_server_properties = http_server_properties();
113 params.net_log = net_log(); 117 params.net_log = net_log();
114 params.channel_id_service = channel_id_service(); 118 params.channel_id_service = channel_id_service();
115 context_storage_.set_http_network_session( 119 context_storage_.set_http_network_session(
116 make_scoped_ptr(new HttpNetworkSession(params))); 120 make_scoped_ptr(new HttpNetworkSession(params)));
117 context_storage_.set_http_transaction_factory(make_scoped_ptr( 121 context_storage_.set_http_transaction_factory(make_scoped_ptr(
118 new HttpCache(context_storage_.http_network_session(), 122 new HttpCache(context_storage_.http_network_session(),
119 HttpCache::DefaultBackend::InMemory(0), false))); 123 HttpCache::DefaultBackend::InMemory(0), false)));
120 } 124 }
121 // In-memory cookie store. 125 // In-memory cookie store.
122 if (!cookie_store()) 126 if (!cookie_store())
123 context_storage_.set_cookie_store(new CookieMonster(NULL, NULL)); 127 context_storage_.set_cookie_store(new CookieMonster(nullptr, nullptr));
124 // In-memory Channel ID service. 128 // In-memory Channel ID service.
125 if (!channel_id_service()) { 129 if (!channel_id_service()) {
126 context_storage_.set_channel_id_service(make_scoped_ptr( 130 context_storage_.set_channel_id_service(make_scoped_ptr(
127 new ChannelIDService(new DefaultChannelIDStore(NULL), 131 new ChannelIDService(new DefaultChannelIDStore(nullptr),
128 base::WorkerPool::GetTaskRunner(true)))); 132 base::WorkerPool::GetTaskRunner(true))));
129 } 133 }
130 if (!http_user_agent_settings()) { 134 if (!http_user_agent_settings()) {
131 context_storage_.set_http_user_agent_settings(make_scoped_ptr( 135 context_storage_.set_http_user_agent_settings(make_scoped_ptr(
132 new StaticHttpUserAgentSettings("en-us,fr", std::string()))); 136 new StaticHttpUserAgentSettings("en-us,fr", std::string())));
133 } 137 }
134 if (!job_factory()) { 138 if (!job_factory()) {
135 context_storage_.set_job_factory( 139 context_storage_.set_job_factory(
136 make_scoped_ptr(new URLRequestJobFactoryImpl())); 140 make_scoped_ptr(new URLRequestJobFactoryImpl()));
137 } 141 }
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 URLRequest* request, 653 URLRequest* request,
650 NetworkDelegate* network_delegate) const { 654 NetworkDelegate* network_delegate) const {
651 return main_intercept_job_.release(); 655 return main_intercept_job_.release();
652 } 656 }
653 657
654 void TestJobInterceptor::set_main_intercept_job(scoped_ptr<URLRequestJob> job) { 658 void TestJobInterceptor::set_main_intercept_job(scoped_ptr<URLRequestJob> job) {
655 main_intercept_job_ = std::move(job); 659 main_intercept_job_ = std::move(job);
656 } 660 }
657 661
658 } // namespace net 662 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_test_util.h ('k') | net/websockets/websocket_end_to_end_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698