| 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_io_d
ata.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 drp_test_context->InitSettings(); | 159 drp_test_context->InitSettings(); |
| 160 DataReductionProxyIOData* io_data = drp_test_context->io_data(); | 160 DataReductionProxyIOData* io_data = drp_test_context->io_data(); |
| 161 std::vector<net::ProxyServer> proxies; | 161 std::vector<net::ProxyServer> proxies; |
| 162 proxies.push_back(net::ProxyServer::FromURI("http://foo1.com", | 162 proxies.push_back(net::ProxyServer::FromURI("http://foo1.com", |
| 163 net::ProxyServer::SCHEME_HTTP)); | 163 net::ProxyServer::SCHEME_HTTP)); |
| 164 net::ProxyService* proxy_service = | 164 net::ProxyService* proxy_service = |
| 165 io_data->url_request_context_getter_->GetURLRequestContext() | 165 io_data->url_request_context_getter_->GetURLRequestContext() |
| 166 ->proxy_service(); | 166 ->proxy_service(); |
| 167 net::ProxyInfo proxy_info; | 167 net::ProxyInfo proxy_info; |
| 168 proxy_info.UseNamedProxy("http://foo2.com"); | 168 proxy_info.UseNamedProxy("http://foo2.com"); |
| 169 net::BoundNetLog bound_net_log; | 169 net::NetLogWithSource net_log_with_source; |
| 170 const net::ProxyRetryInfoMap& bad_proxy_list = | 170 const net::ProxyRetryInfoMap& bad_proxy_list = |
| 171 proxy_service->proxy_retry_info(); | 171 proxy_service->proxy_retry_info(); |
| 172 | 172 |
| 173 // Simulate network error to add proxies to the bad proxy list. | 173 // Simulate network error to add proxies to the bad proxy list. |
| 174 proxy_service->MarkProxiesAsBadUntil(proxy_info, base::TimeDelta::FromDays(1), | 174 proxy_service->MarkProxiesAsBadUntil(proxy_info, base::TimeDelta::FromDays(1), |
| 175 proxies, bound_net_log); | 175 proxies, net_log_with_source); |
| 176 base::RunLoop().RunUntilIdle(); | 176 base::RunLoop().RunUntilIdle(); |
| 177 | 177 |
| 178 // Verify that there are 2 proxies in the bad proxies list. | 178 // Verify that there are 2 proxies in the bad proxies list. |
| 179 EXPECT_EQ(2UL, bad_proxy_list.size()); | 179 EXPECT_EQ(2UL, bad_proxy_list.size()); |
| 180 | 180 |
| 181 // Turn Data Saver off. | 181 // Turn Data Saver off. |
| 182 drp_test_context->settings()->SetDataReductionProxyEnabled(false); | 182 drp_test_context->settings()->SetDataReductionProxyEnabled(false); |
| 183 base::RunLoop().RunUntilIdle(); | 183 base::RunLoop().RunUntilIdle(); |
| 184 | 184 |
| 185 // Verify that bad proxy list is empty. | 185 // Verify that bad proxy list is empty. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 197 .WithURLRequestContext(&context) | 197 .WithURLRequestContext(&context) |
| 198 .SkipSettingsInitialization() | 198 .SkipSettingsInitialization() |
| 199 .Build(); | 199 .Build(); |
| 200 | 200 |
| 201 EXPECT_TRUE(drp_test_context->test_params()->proxies_for_http().size() > 0); | 201 EXPECT_TRUE(drp_test_context->test_params()->proxies_for_http().size() > 0); |
| 202 EXPECT_FALSE( | 202 EXPECT_FALSE( |
| 203 drp_test_context->test_params()->proxies_for_http().front().is_direct()); | 203 drp_test_context->test_params()->proxies_for_http().front().is_direct()); |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace data_reduction_proxy | 206 } // namespace data_reduction_proxy |
| OLD | NEW |