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

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: even more rebase Created 4 years, 8 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::WrapUnique(new net::TestNetworkDelegate()), true)); 602 base::WrapUnique(new net::TestNetworkDelegate()), true));
603 603
604 std::unique_ptr<net::URLRequestJobFactory> job_factory_impl =
605 net::URLRequestJobFactoryImpl::CreateWithDefaultProtocolHandlers();
606
604 request_context_storage->set_job_factory( 607 request_context_storage->set_job_factory(
605 base::WrapUnique(new net::URLRequestInterceptingJobFactory( 608 base::WrapUnique(new 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 // This won't actually update the proxy config when using a test configurator. 615 // This won't actually update the proxy config when using a test configurator.
615 DCHECK(!(test_context_flags_ & 616 DCHECK(!(test_context_flags_ &
616 DataReductionProxyTestContext::USE_TEST_CONFIGURATOR)); 617 DataReductionProxyTestContext::USE_TEST_CONFIGURATOR));
617 // |settings_| needs to have been initialized, since a 618 // |settings_| needs to have been initialized, since a
618 // |DataReductionProxyService| is needed in order to issue the secure proxy 619 // |DataReductionProxyService| is needed in order to issue the secure proxy
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 : prefs_(prefs) { 704 : prefs_(prefs) {
704 DCHECK(prefs); 705 DCHECK(prefs);
705 } 706 }
706 707
707 void DataReductionProxyTestContext::TestConfigStorer::StoreSerializedConfig( 708 void DataReductionProxyTestContext::TestConfigStorer::StoreSerializedConfig(
708 const std::string& serialized_config) { 709 const std::string& serialized_config) {
709 prefs_->SetString(prefs::kDataReductionProxyConfig, serialized_config); 710 prefs_->SetString(prefs::kDataReductionProxyConfig, serialized_config);
710 } 711 }
711 712
712 } // namespace data_reduction_proxy 713 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698