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

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

Issue 1290243007: Shift URLRequestContextStorage over to taking scoped_ptrs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Paul_BuilderGrab
Patch Set: Sync'd to revision p349162. Created 5 years, 3 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 8
9 #include "base/prefs/testing_pref_service.h" 9 #include "base/prefs/testing_pref_service.h"
10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h" 10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h"
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 task_runner_, base::TimeDelta())); 545 task_runner_, base::TimeDelta()));
546 } 546 }
547 } 547 }
548 548
549 void DataReductionProxyTestContext::AttachToURLRequestContext( 549 void DataReductionProxyTestContext::AttachToURLRequestContext(
550 net::URLRequestContextStorage* request_context_storage) const { 550 net::URLRequestContextStorage* request_context_storage) const {
551 DCHECK(request_context_storage); 551 DCHECK(request_context_storage);
552 552
553 // |request_context_storage| takes ownership of the network delegate. 553 // |request_context_storage| takes ownership of the network delegate.
554 request_context_storage->set_network_delegate( 554 request_context_storage->set_network_delegate(
555 io_data()->CreateNetworkDelegate( 555 io_data()
556 scoped_ptr<net::NetworkDelegate>(new net::TestNetworkDelegate()), 556 ->CreateNetworkDelegate(
557 true).release()); 557 make_scoped_ptr(new net::TestNetworkDelegate()).Pass(), true)
558 .Pass());
558 559
559 // |request_context_storage| takes ownership of the job factory.
560 request_context_storage->set_job_factory( 560 request_context_storage->set_job_factory(
561 new net::URLRequestInterceptingJobFactory( 561 make_scoped_ptr(new net::URLRequestInterceptingJobFactory(
562 scoped_ptr<net::URLRequestJobFactory>( 562 scoped_ptr<net::URLRequestJobFactory>(
563 new net::URLRequestJobFactoryImpl()), 563 new net::URLRequestJobFactoryImpl()),
564 io_data()->CreateInterceptor().Pass())); 564 io_data()->CreateInterceptor().Pass())));
565 } 565 }
566 566
567 void DataReductionProxyTestContext:: 567 void DataReductionProxyTestContext::
568 EnableDataReductionProxyWithSecureProxyCheckSuccess() { 568 EnableDataReductionProxyWithSecureProxyCheckSuccess() {
569 DCHECK(mock_socket_factory_); 569 DCHECK(mock_socket_factory_);
570 // This won't actually update the proxy config when using a test configurator. 570 // This won't actually update the proxy config when using a test configurator.
571 DCHECK(!(test_context_flags_ & 571 DCHECK(!(test_context_flags_ &
572 DataReductionProxyTestContext::USE_TEST_CONFIGURATOR)); 572 DataReductionProxyTestContext::USE_TEST_CONFIGURATOR));
573 // |settings_| needs to have been initialized, since a 573 // |settings_| needs to have been initialized, since a
574 // |DataReductionProxyService| is needed in order to issue the secure proxy 574 // |DataReductionProxyService| is needed in order to issue the secure proxy
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 : prefs_(prefs) { 659 : prefs_(prefs) {
660 DCHECK(prefs); 660 DCHECK(prefs);
661 } 661 }
662 662
663 void DataReductionProxyTestContext::TestConfigStorer::StoreSerializedConfig( 663 void DataReductionProxyTestContext::TestConfigStorer::StoreSerializedConfig(
664 const std::string& serialized_config) { 664 const std::string& serialized_config) {
665 prefs_->SetString(prefs::kDataReductionProxyConfig, serialized_config); 665 prefs_->SetString(prefs::kDataReductionProxyConfig, serialized_config);
666 } 666 }
667 667
668 } // namespace data_reduction_proxy 668 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698