OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_bypa
ss_protocol.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypa
ss_protocol.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // to requests. | 110 // to requests. |
111 context_->set_http_user_agent_settings(&http_user_agent_settings_); | 111 context_->set_http_user_agent_settings(&http_user_agent_settings_); |
112 bypass_stats_.reset(new DataReductionProxyBypassStats( | 112 bypass_stats_.reset(new DataReductionProxyBypassStats( |
113 test_context_->config(), | 113 test_context_->config(), |
114 test_context_->unreachable_callback())); | 114 test_context_->unreachable_callback())); |
115 | 115 |
116 DataReductionProxyInterceptor* interceptor = | 116 DataReductionProxyInterceptor* interceptor = |
117 new DataReductionProxyInterceptor( | 117 new DataReductionProxyInterceptor( |
118 test_context_->config(), test_context_->io_data()->config_client(), | 118 test_context_->config(), test_context_->io_data()->config_client(), |
119 bypass_stats_.get(), test_context_->event_creator()); | 119 bypass_stats_.get(), test_context_->event_creator()); |
120 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory_impl( | 120 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory_impl = |
121 new net::URLRequestJobFactoryImpl()); | 121 net::URLRequestJobFactoryImpl::CreateWithDefaultProtocolHandlers(); |
122 job_factory_.reset(new net::URLRequestInterceptingJobFactory( | 122 job_factory_.reset(new net::URLRequestInterceptingJobFactory( |
123 std::move(job_factory_impl), base::WrapUnique(interceptor))); | 123 std::move(job_factory_impl), base::WrapUnique(interceptor))); |
124 | 124 |
125 context_->set_job_factory(job_factory_.get()); | 125 context_->set_job_factory(job_factory_.get()); |
126 context_->Init(); | 126 context_->Init(); |
127 } | 127 } |
128 | 128 |
129 // Simulates a request to a data reduction proxy that may result in bypassing | 129 // Simulates a request to a data reduction proxy that may result in bypassing |
130 // the proxy and retrying the the request. | 130 // the proxy and retrying the the request. |
131 // Runs a test with the given request |method| that expects the first response | 131 // Runs a test with the given request |method| that expects the first response |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 EXPECT_EQ(net::URLRequestStatus::SUCCESS, r->status().status()); | 983 EXPECT_EQ(net::URLRequestStatus::SUCCESS, r->status().status()); |
984 EXPECT_EQ(net::OK, r->status().error()); | 984 EXPECT_EQ(net::OK, r->status().error()); |
985 | 985 |
986 EXPECT_EQ("Bypass message", d.data_received()); | 986 EXPECT_EQ("Bypass message", d.data_received()); |
987 | 987 |
988 // We should have no entries in our bad proxy list. | 988 // We should have no entries in our bad proxy list. |
989 TestBadProxies(0, -1, "", ""); | 989 TestBadProxies(0, -1, "", ""); |
990 } | 990 } |
991 | 991 |
992 } // namespace data_reduction_proxy | 992 } // namespace data_reduction_proxy |
OLD | NEW |