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/browser/data_reduction_proxy_protocol.
h" | 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.
h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 : net::NetworkDelegate(), | 52 : net::NetworkDelegate(), |
53 test_data_reduction_proxy_params_(test_params), | 53 test_data_reduction_proxy_params_(test_params), |
54 bypass_type_(bypass_type) { | 54 bypass_type_(bypass_type) { |
55 } | 55 } |
56 | 56 |
57 virtual int OnHeadersReceived( | 57 virtual int OnHeadersReceived( |
58 URLRequest* request, | 58 URLRequest* request, |
59 const net::CompletionCallback& callback, | 59 const net::CompletionCallback& callback, |
60 const HttpResponseHeaders* original_response_headers, | 60 const HttpResponseHeaders* original_response_headers, |
61 scoped_refptr<HttpResponseHeaders>* override_response_headers, | 61 scoped_refptr<HttpResponseHeaders>* override_response_headers, |
62 GURL* allowed_unsafe_redirect_url) OVERRIDE { | 62 GURL* allowed_unsafe_redirect_url) override { |
63 data_reduction_proxy::MaybeBypassProxyAndPrepareToRetry( | 63 data_reduction_proxy::MaybeBypassProxyAndPrepareToRetry( |
64 test_data_reduction_proxy_params_, | 64 test_data_reduction_proxy_params_, |
65 request, | 65 request, |
66 original_response_headers, | 66 original_response_headers, |
67 override_response_headers, | 67 override_response_headers, |
68 bypass_type_); | 68 bypass_type_); |
69 return net::OK; | 69 return net::OK; |
70 } | 70 } |
71 | 71 |
72 TestDataReductionProxyParams* test_data_reduction_proxy_params_; | 72 TestDataReductionProxyParams* test_data_reduction_proxy_params_; |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 | 806 |
807 // We should have no entries in our bad proxy list. | 807 // We should have no entries in our bad proxy list. |
808 TestBadProxies(0, -1, "", ""); | 808 TestBadProxies(0, -1, "", ""); |
809 } | 809 } |
810 | 810 |
811 class BadEntropyProvider : public base::FieldTrial::EntropyProvider { | 811 class BadEntropyProvider : public base::FieldTrial::EntropyProvider { |
812 public: | 812 public: |
813 virtual ~BadEntropyProvider() {} | 813 virtual ~BadEntropyProvider() {} |
814 | 814 |
815 virtual double GetEntropyForTrial(const std::string& trial_name, | 815 virtual double GetEntropyForTrial(const std::string& trial_name, |
816 uint32 randomization_seed) const OVERRIDE { | 816 uint32 randomization_seed) const override { |
817 return 0.5; | 817 return 0.5; |
818 } | 818 } |
819 }; | 819 }; |
820 | 820 |
821 TEST_F(DataReductionProxyProtocolTest, OnResolveProxyHandler) { | 821 TEST_F(DataReductionProxyProtocolTest, OnResolveProxyHandler) { |
822 int load_flags = net::LOAD_NORMAL; | 822 int load_flags = net::LOAD_NORMAL; |
823 GURL url("http://www.google.com/"); | 823 GURL url("http://www.google.com/"); |
824 | 824 |
825 TestDataReductionProxyParams test_params( | 825 TestDataReductionProxyParams test_params( |
826 DataReductionProxyParams::kAllowed | | 826 DataReductionProxyParams::kAllowed | |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 &other_proxy_info); | 947 &other_proxy_info); |
948 EXPECT_FALSE(other_proxy_info.is_direct()); | 948 EXPECT_FALSE(other_proxy_info.is_direct()); |
949 | 949 |
950 OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config, | 950 OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config, |
951 empty_proxy_retry_info, &test_params, | 951 empty_proxy_retry_info, &test_params, |
952 &data_reduction_proxy_info); | 952 &data_reduction_proxy_info); |
953 EXPECT_TRUE(data_reduction_proxy_info.is_direct()); | 953 EXPECT_TRUE(data_reduction_proxy_info.is_direct()); |
954 } | 954 } |
955 | 955 |
956 } // namespace data_reduction_proxy | 956 } // namespace data_reduction_proxy |
OLD | NEW |