| 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 "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/prefs/testing_pref_service.h" | 8 #include "base/prefs/testing_pref_service.h" |
| 9 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp
ression_stats.h" | 9 #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_conf
ig_service_client.h" | 10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig_service_client.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 // Check for invalid builder combinations. | 293 // Check for invalid builder combinations. |
| 294 DCHECK(!(use_mock_config_ && use_config_client_)); | 294 DCHECK(!(use_mock_config_ && use_config_client_)); |
| 295 scoped_ptr<base::MessageLoopForIO> loop(new base::MessageLoopForIO()); | 295 scoped_ptr<base::MessageLoopForIO> loop(new base::MessageLoopForIO()); |
| 296 | 296 |
| 297 unsigned int test_context_flags = 0; | 297 unsigned int test_context_flags = 0; |
| 298 scoped_refptr<base::SingleThreadTaskRunner> task_runner = | 298 scoped_refptr<base::SingleThreadTaskRunner> task_runner = |
| 299 base::MessageLoopProxy::current(); | 299 base::MessageLoopProxy::current(); |
| 300 scoped_refptr<net::URLRequestContextGetter> request_context_getter; | 300 scoped_refptr<net::URLRequestContextGetter> request_context_getter; |
| 301 scoped_ptr<TestingPrefServiceSimple> pref_service( | 301 scoped_ptr<TestingPrefServiceSimple> pref_service( |
| 302 new TestingPrefServiceSimple()); | 302 new TestingPrefServiceSimple()); |
| 303 scoped_ptr<net::CapturingNetLog> net_log(new net::CapturingNetLog()); | 303 scoped_ptr<net::TestNetLog> net_log(new net::TestNetLog()); |
| 304 if (request_context_) { | 304 if (request_context_) { |
| 305 request_context_getter = new net::TrivialURLRequestContextGetter( | 305 request_context_getter = new net::TrivialURLRequestContextGetter( |
| 306 request_context_, task_runner); | 306 request_context_, task_runner); |
| 307 } else { | 307 } else { |
| 308 scoped_ptr<net::TestURLRequestContext> test_request_context( | 308 scoped_ptr<net::TestURLRequestContext> test_request_context( |
| 309 new net::TestURLRequestContext(true)); | 309 new net::TestURLRequestContext(true)); |
| 310 if (mock_socket_factory_) | 310 if (mock_socket_factory_) |
| 311 test_request_context->set_client_socket_factory(mock_socket_factory_); | 311 test_request_context->set_client_socket_factory(mock_socket_factory_); |
| 312 test_request_context->Init(); | 312 test_request_context->Init(); |
| 313 request_context_getter = new net::TestURLRequestContextGetter( | 313 request_context_getter = new net::TestURLRequestContextGetter( |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 if (!skip_settings_initialization_) | 398 if (!skip_settings_initialization_) |
| 399 test_context->InitSettingsWithoutCheck(); | 399 test_context->InitSettingsWithoutCheck(); |
| 400 | 400 |
| 401 return test_context.Pass(); | 401 return test_context.Pass(); |
| 402 } | 402 } |
| 403 | 403 |
| 404 DataReductionProxyTestContext::DataReductionProxyTestContext( | 404 DataReductionProxyTestContext::DataReductionProxyTestContext( |
| 405 scoped_ptr<base::MessageLoop> loop, | 405 scoped_ptr<base::MessageLoop> loop, |
| 406 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 406 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 407 scoped_ptr<TestingPrefServiceSimple> simple_pref_service, | 407 scoped_ptr<TestingPrefServiceSimple> simple_pref_service, |
| 408 scoped_ptr<net::CapturingNetLog> net_log, | 408 scoped_ptr<net::TestNetLog> net_log, |
| 409 scoped_refptr<net::URLRequestContextGetter> request_context_getter, | 409 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
| 410 net::MockClientSocketFactory* mock_socket_factory, | 410 net::MockClientSocketFactory* mock_socket_factory, |
| 411 scoped_ptr<TestDataReductionProxyIOData> io_data, | 411 scoped_ptr<TestDataReductionProxyIOData> io_data, |
| 412 scoped_ptr<DataReductionProxySettings> settings, | 412 scoped_ptr<DataReductionProxySettings> settings, |
| 413 TestDataReductionProxyParams* params, | 413 TestDataReductionProxyParams* params, |
| 414 unsigned int test_context_flags) | 414 unsigned int test_context_flags) |
| 415 : test_context_flags_(test_context_flags), | 415 : test_context_flags_(test_context_flags), |
| 416 loop_(loop.Pass()), | 416 loop_(loop.Pass()), |
| 417 task_runner_(task_runner), | 417 task_runner_(task_runner), |
| 418 simple_pref_service_(simple_pref_service.Pass()), | 418 simple_pref_service_(simple_pref_service.Pass()), |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 io_data_->config_client()); | 572 io_data_->config_client()); |
| 573 } | 573 } |
| 574 | 574 |
| 575 DataReductionProxyBypassStats::UnreachableCallback | 575 DataReductionProxyBypassStats::UnreachableCallback |
| 576 DataReductionProxyTestContext::unreachable_callback() const { | 576 DataReductionProxyTestContext::unreachable_callback() const { |
| 577 return base::Bind(&DataReductionProxySettings::SetUnreachable, | 577 return base::Bind(&DataReductionProxySettings::SetUnreachable, |
| 578 base::Unretained(settings_.get())); | 578 base::Unretained(settings_.get())); |
| 579 } | 579 } |
| 580 | 580 |
| 581 } // namespace data_reduction_proxy | 581 } // namespace data_reduction_proxy |
| OLD | NEW |