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

Side by Side Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc

Issue 1888963004: Add HttpProtocolHandler and convert everything to use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-supports-scheme
Patch Set: rebase (needs fixing) Created 4 years, 2 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_test _utils.h" 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test _utils.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 594
595 void DataReductionProxyTestContext::AttachToURLRequestContext( 595 void DataReductionProxyTestContext::AttachToURLRequestContext(
596 net::URLRequestContextStorage* request_context_storage) const { 596 net::URLRequestContextStorage* request_context_storage) const {
597 DCHECK(request_context_storage); 597 DCHECK(request_context_storage);
598 598
599 // |request_context_storage| takes ownership of the network delegate. 599 // |request_context_storage| takes ownership of the network delegate.
600 request_context_storage->set_network_delegate( 600 request_context_storage->set_network_delegate(
601 io_data()->CreateNetworkDelegate( 601 io_data()->CreateNetworkDelegate(
602 base::MakeUnique<net::TestNetworkDelegate>(), true)); 602 base::MakeUnique<net::TestNetworkDelegate>(), true));
603 603
604 std::unique_ptr<net::URLRequestJobFactory> job_factory_impl =
605 net::URLRequestJobFactoryImpl::CreateWithHttpProtocolHandlers();
606
604 request_context_storage->set_job_factory( 607 request_context_storage->set_job_factory(
605 base::MakeUnique<net::URLRequestInterceptingJobFactory>( 608 base::MakeUnique<net::URLRequestInterceptingJobFactory>(
606 std::unique_ptr<net::URLRequestJobFactory>( 609 std::move(job_factory_impl), io_data()->CreateInterceptor()));
607 new net::URLRequestJobFactoryImpl()),
608 io_data()->CreateInterceptor()));
609 } 610 }
610 611
611 void DataReductionProxyTestContext:: 612 void DataReductionProxyTestContext::
612 EnableDataReductionProxyWithSecureProxyCheckSuccess() { 613 EnableDataReductionProxyWithSecureProxyCheckSuccess() {
613 DCHECK(mock_socket_factory_); 614 DCHECK(mock_socket_factory_);
614 // |settings_| needs to have been initialized, since a 615 // |settings_| needs to have been initialized, since a
615 // |DataReductionProxyService| is needed in order to issue the secure proxy 616 // |DataReductionProxyService| is needed in order to issue the secure proxy
616 // check. 617 // check.
617 DCHECK(data_reduction_proxy_service()); 618 DCHECK(data_reduction_proxy_service());
618 619
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 configurator()->GetProxyConfig().proxy_rules().Apply(kHttpUrl, &proxy_info); 710 configurator()->GetProxyConfig().proxy_rules().Apply(kHttpUrl, &proxy_info);
710 711
711 std::vector<net::ProxyServer> proxies_without_direct; 712 std::vector<net::ProxyServer> proxies_without_direct;
712 for (const net::ProxyServer& proxy : proxy_info.proxy_list().GetAll()) 713 for (const net::ProxyServer& proxy : proxy_info.proxy_list().GetAll())
713 if (proxy.is_valid() && !proxy.is_direct()) 714 if (proxy.is_valid() && !proxy.is_direct())
714 proxies_without_direct.push_back(proxy); 715 proxies_without_direct.push_back(proxy);
715 return proxies_without_direct; 716 return proxies_without_direct;
716 } 717 }
717 718
718 } // namespace data_reduction_proxy 719 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698