| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |