| 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_inte
rceptor.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_inte
rceptor.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
| 16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
| 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig_test_utils.h" | 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig_test_utils.h" |
| 18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator.h" | 18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator.h" |
| 19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
| 20 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test
_utils.h" | 20 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test
_utils.h" |
| 21 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 21 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 22 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s_test_utils.h" | 22 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s_test_utils.h" |
| 23 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_
names.h" | 23 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_
names.h" |
| 24 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
| 25 #include "net/base/request_priority.h" | 25 #include "net/base/request_priority.h" |
| 26 #include "net/http/http_response_headers.h" | 26 #include "net/http/http_response_headers.h" |
| 27 #include "net/log/capturing_net_log.h" | 27 #include "net/log/test_net_log.h" |
| 28 #include "net/proxy/proxy_server.h" | 28 #include "net/proxy/proxy_server.h" |
| 29 #include "net/socket/socket_test_util.h" | 29 #include "net/socket/socket_test_util.h" |
| 30 #include "net/test/embedded_test_server/embedded_test_server.h" | 30 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 31 #include "net/url_request/url_request.h" | 31 #include "net/url_request/url_request.h" |
| 32 #include "net/url_request/url_request_context_storage.h" | 32 #include "net/url_request/url_request_context_storage.h" |
| 33 #include "net/url_request/url_request_intercepting_job_factory.h" | 33 #include "net/url_request/url_request_intercepting_job_factory.h" |
| 34 #include "net/url_request/url_request_interceptor.h" | 34 #include "net/url_request/url_request_interceptor.h" |
| 35 #include "net/url_request/url_request_job.h" | 35 #include "net/url_request/url_request_job.h" |
| 36 #include "net/url_request/url_request_job_factory.h" | 36 #include "net/url_request/url_request_job_factory.h" |
| 37 #include "net/url_request/url_request_job_factory_impl.h" | 37 #include "net/url_request/url_request_job_factory_impl.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 228 |
| 229 const net::TestURLRequestContext& context() { | 229 const net::TestURLRequestContext& context() { |
| 230 return context_; | 230 return context_; |
| 231 } | 231 } |
| 232 | 232 |
| 233 const net::test_server::EmbeddedTestServer& direct() { | 233 const net::test_server::EmbeddedTestServer& direct() { |
| 234 return direct_; | 234 return direct_; |
| 235 } | 235 } |
| 236 | 236 |
| 237 private: | 237 private: |
| 238 net::CapturingNetLog net_log_; | 238 net::TestNetLog net_log_; |
| 239 net::TestNetworkDelegate network_delegate_; | 239 net::TestNetworkDelegate network_delegate_; |
| 240 net::TestURLRequestContext context_; | 240 net::TestURLRequestContext context_; |
| 241 net::test_server::EmbeddedTestServer proxy_; | 241 net::test_server::EmbeddedTestServer proxy_; |
| 242 net::test_server::EmbeddedTestServer direct_; | 242 net::test_server::EmbeddedTestServer direct_; |
| 243 scoped_ptr<net::ProxyService> proxy_service_; | 243 scoped_ptr<net::ProxyService> proxy_service_; |
| 244 scoped_ptr<net::URLRequestJobFactory> job_factory_; | 244 scoped_ptr<net::URLRequestJobFactory> job_factory_; |
| 245 scoped_ptr<DataReductionProxyTestContext> test_context_; | 245 scoped_ptr<DataReductionProxyTestContext> test_context_; |
| 246 }; | 246 }; |
| 247 | 247 |
| 248 TEST_F(DataReductionProxyInterceptorWithServerTest, TestBypass) { | 248 TEST_F(DataReductionProxyInterceptorWithServerTest, TestBypass) { |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 EXPECT_FALSE(request->was_fetched_via_proxy()); | 472 EXPECT_FALSE(request->was_fetched_via_proxy()); |
| 473 | 473 |
| 474 // Each of the redirects should have been intercepted before being followed. | 474 // Each of the redirects should have been intercepted before being followed. |
| 475 EXPECT_EQ(0, delegate().received_redirect_count()); | 475 EXPECT_EQ(0, delegate().received_redirect_count()); |
| 476 EXPECT_EQ(std::vector<GURL>(1, GURL("http://foo.com")), request->url_chain()); | 476 EXPECT_EQ(std::vector<GURL>(1, GURL("http://foo.com")), request->url_chain()); |
| 477 } | 477 } |
| 478 | 478 |
| 479 } // namespace | 479 } // namespace |
| 480 | 480 |
| 481 } // namespace data_reduction_proxy | 481 } // namespace data_reduction_proxy |
| OLD | NEW |