| 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 <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 // Disabled on Mac due to flakiness. See crbug.com/601562. | 142 // Disabled on Mac due to flakiness. See crbug.com/601562. |
| 143 #if defined(OS_MACOSX) | 143 #if defined(OS_MACOSX) |
| 144 #define MAYBE_TestJobFactoryChaining DISABLED_TestJobFactoryChaining | 144 #define MAYBE_TestJobFactoryChaining DISABLED_TestJobFactoryChaining |
| 145 #else | 145 #else |
| 146 #define MAYBE_TestJobFactoryChaining TestJobFactoryChaining | 146 #define MAYBE_TestJobFactoryChaining TestJobFactoryChaining |
| 147 #endif | 147 #endif |
| 148 TEST_F(DataReductionProxyInterceptorTest, MAYBE_TestJobFactoryChaining) { | 148 TEST_F(DataReductionProxyInterceptorTest, MAYBE_TestJobFactoryChaining) { |
| 149 // Verifies that job factories can be chained. | 149 // Verifies that job factories can be chained. |
| 150 std::unique_ptr<net::URLRequestJobFactory> impl( | 150 std::unique_ptr<net::URLRequestJobFactory> impl = |
| 151 new net::URLRequestJobFactoryImpl()); | 151 net::URLRequestJobFactoryImpl::CreateWithDefaultProtocolHandlers(); |
| 152 | 152 |
| 153 CountingURLRequestInterceptor* interceptor2 = | 153 CountingURLRequestInterceptor* interceptor2 = |
| 154 new CountingURLRequestInterceptor(); | 154 new CountingURLRequestInterceptor(); |
| 155 std::unique_ptr<net::URLRequestJobFactory> factory2( | 155 std::unique_ptr<net::URLRequestJobFactory> factory2( |
| 156 new net::URLRequestInterceptingJobFactory( | 156 new net::URLRequestInterceptingJobFactory( |
| 157 std::move(impl), base::WrapUnique(interceptor2))); | 157 std::move(impl), base::WrapUnique(interceptor2))); |
| 158 | 158 |
| 159 CountingURLRequestInterceptor* interceptor1 = | 159 CountingURLRequestInterceptor* interceptor1 = |
| 160 new CountingURLRequestInterceptor(); | 160 new CountingURLRequestInterceptor(); |
| 161 std::unique_ptr<net::URLRequestJobFactory> factory1( | 161 std::unique_ptr<net::URLRequestJobFactory> factory1( |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 net::ProxyServer::FromURI(spec, net::ProxyServer::SCHEME_HTTP); | 215 net::ProxyServer::FromURI(spec, net::ProxyServer::SCHEME_HTTP); |
| 216 std::vector<net::ProxyServer> proxies_for_http; | 216 std::vector<net::ProxyServer> proxies_for_http; |
| 217 proxies_for_http.push_back(origin); | 217 proxies_for_http.push_back(origin); |
| 218 test_context_->config()->test_params()->SetProxiesForHttp(proxies_for_http); | 218 test_context_->config()->test_params()->SetProxiesForHttp(proxies_for_http); |
| 219 std::string proxy_name = origin.ToURI(); | 219 std::string proxy_name = origin.ToURI(); |
| 220 proxy_service_ = net::ProxyService::CreateFixedFromPacResult( | 220 proxy_service_ = net::ProxyService::CreateFixedFromPacResult( |
| 221 "PROXY " + proxy_name + "; DIRECT"); | 221 "PROXY " + proxy_name + "; DIRECT"); |
| 222 | 222 |
| 223 context_.set_proxy_service(proxy_service_.get()); | 223 context_.set_proxy_service(proxy_service_.get()); |
| 224 | 224 |
| 225 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory_impl( | 225 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory_impl = |
| 226 new net::URLRequestJobFactoryImpl()); | 226 net::URLRequestJobFactoryImpl::CreateWithDefaultProtocolHandlers(); |
| 227 job_factory_.reset(new net::URLRequestInterceptingJobFactory( | 227 job_factory_.reset(new net::URLRequestInterceptingJobFactory( |
| 228 std::move(job_factory_impl), | 228 std::move(job_factory_impl), |
| 229 test_context_->io_data()->CreateInterceptor())); | 229 test_context_->io_data()->CreateInterceptor())); |
| 230 context_.set_job_factory(job_factory_.get()); | 230 context_.set_job_factory(job_factory_.get()); |
| 231 context_.Init(); | 231 context_.Init(); |
| 232 } | 232 } |
| 233 | 233 |
| 234 const net::TestURLRequestContext& context() { | 234 const net::TestURLRequestContext& context() { |
| 235 return context_; | 235 return context_; |
| 236 } | 236 } |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 std::vector<GURL> expected_url_chain; | 519 std::vector<GURL> expected_url_chain; |
| 520 expected_url_chain.push_back(GURL("http://music.google.com")); | 520 expected_url_chain.push_back(GURL("http://music.google.com")); |
| 521 expected_url_chain.push_back(GURL("http://play.google.com")); | 521 expected_url_chain.push_back(GURL("http://play.google.com")); |
| 522 expected_url_chain.push_back(GURL("https://play.google.com")); | 522 expected_url_chain.push_back(GURL("https://play.google.com")); |
| 523 EXPECT_EQ(expected_url_chain, request->url_chain()); | 523 EXPECT_EQ(expected_url_chain, request->url_chain()); |
| 524 } | 524 } |
| 525 | 525 |
| 526 } // namespace | 526 } // namespace |
| 527 | 527 |
| 528 } // namespace data_reduction_proxy | 528 } // namespace data_reduction_proxy |
| OLD | NEW |