OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/data_reduction_proxy/core/browser/data_reduction_proxy_inte
rceptor.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_inte
rceptor.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 .WithURLRequestContext(&context_) | 203 .WithURLRequestContext(&context_) |
204 .Build(); | 204 .Build(); |
205 std::string spec; | 205 std::string spec; |
206 base::TrimString(proxy_.GetURL("/").spec(), "/", &spec); | 206 base::TrimString(proxy_.GetURL("/").spec(), "/", &spec); |
207 net::ProxyServer origin = | 207 net::ProxyServer origin = |
208 net::ProxyServer::FromURI(spec, net::ProxyServer::SCHEME_HTTP); | 208 net::ProxyServer::FromURI(spec, net::ProxyServer::SCHEME_HTTP); |
209 std::vector<net::ProxyServer> proxies_for_http; | 209 std::vector<net::ProxyServer> proxies_for_http; |
210 proxies_for_http.push_back(origin); | 210 proxies_for_http.push_back(origin); |
211 test_context_->config()->test_params()->SetProxiesForHttp(proxies_for_http); | 211 test_context_->config()->test_params()->SetProxiesForHttp(proxies_for_http); |
212 std::string proxy_name = origin.ToURI(); | 212 std::string proxy_name = origin.ToURI(); |
213 proxy_service_.reset( | 213 proxy_service_ = net::ProxyService::CreateFixedFromPacResult( |
214 net::ProxyService::CreateFixedFromPacResult( | 214 "PROXY " + proxy_name + "; DIRECT"); |
215 "PROXY " + proxy_name + "; DIRECT")); | |
216 | 215 |
217 context_.set_proxy_service(proxy_service_.get()); | 216 context_.set_proxy_service(proxy_service_.get()); |
218 | 217 |
219 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory_impl( | 218 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory_impl( |
220 new net::URLRequestJobFactoryImpl()); | 219 new net::URLRequestJobFactoryImpl()); |
221 job_factory_.reset(new net::URLRequestInterceptingJobFactory( | 220 job_factory_.reset(new net::URLRequestInterceptingJobFactory( |
222 job_factory_impl.Pass(), | 221 job_factory_impl.Pass(), |
223 test_context_->io_data()->CreateInterceptor())); | 222 test_context_->io_data()->CreateInterceptor())); |
224 context_.set_job_factory(job_factory_.get()); | 223 context_.set_job_factory(job_factory_.get()); |
225 context_.Init(); | 224 context_.Init(); |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 std::vector<GURL> expected_url_chain; | 512 std::vector<GURL> expected_url_chain; |
514 expected_url_chain.push_back(GURL("http://music.google.com")); | 513 expected_url_chain.push_back(GURL("http://music.google.com")); |
515 expected_url_chain.push_back(GURL("http://play.google.com")); | 514 expected_url_chain.push_back(GURL("http://play.google.com")); |
516 expected_url_chain.push_back(GURL("https://play.google.com")); | 515 expected_url_chain.push_back(GURL("https://play.google.com")); |
517 EXPECT_EQ(expected_url_chain, request->url_chain()); | 516 EXPECT_EQ(expected_url_chain, request->url_chain()); |
518 } | 517 } |
519 | 518 |
520 } // namespace | 519 } // namespace |
521 | 520 |
522 } // namespace data_reduction_proxy | 521 } // namespace data_reduction_proxy |
OLD | NEW |