Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Unified Diff: net/proxy/proxy_service_unittest.cc

Issue 1128823005: Update marking proxies as bad in ProxyList/ProxyService to use a std::vector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit test failure Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_service_unittest.cc
diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc
index 609067145b5ac42e39026c7f284dd5a6fb32aee1..dfb53da181ffbc498b38c59b4890b3d329e9eeeb 100644
--- a/net/proxy/proxy_service_unittest.cc
+++ b/net/proxy/proxy_service_unittest.cc
@@ -1576,6 +1576,39 @@ TEST_F(ProxyServiceTest, ProxyBypassList) {
EXPECT_EQ("foopy1:8080", info[1].proxy_server().ToURI());
}
+TEST_F(ProxyServiceTest, MarkProxiesAsBadTests) {
+ ProxyConfig config;
+ config.proxy_rules().ParseFromString(
+ "http=foopy1:8080;http=foopy2:8080;http=foopy3.8080;http=foopy4:8080");
+ config.set_auto_detect(false);
+
+ ProxyList proxy_list;
+ std::vector<ProxyServer> additional_bad_proxies;
+ for (const ProxyServer& proxy_server :
+ config.proxy_rules().proxies_for_http.GetAll()) {
+ proxy_list.AddProxyServer(proxy_server);
+ if (proxy_server == config.proxy_rules().proxies_for_http.Get())
+ continue;
+
+ additional_bad_proxies.push_back(proxy_server);
+ }
+
+ EXPECT_EQ(3u, additional_bad_proxies.size());
+
+ ProxyService service(new MockProxyConfigService(config), nullptr, NULL);
+ ProxyInfo proxy_info;
+ proxy_info.UseProxyList(proxy_list);
+ const ProxyRetryInfoMap& retry_info = service.proxy_retry_info();
+ service.MarkProxiesAsBadUntil(proxy_info, base::TimeDelta::FromSeconds(1),
+ additional_bad_proxies, BoundNetLog());
+ ASSERT_EQ(4u, retry_info.size());
+ for (const ProxyServer& proxy_server :
+ config.proxy_rules().proxies_for_http.GetAll()) {
+ ProxyRetryInfoMap::const_iterator i =
+ retry_info.find(proxy_server.host_port_pair().ToString());
+ ASSERT_TRUE(i != retry_info.end());
+ }
+}
TEST_F(ProxyServiceTest, PerProtocolProxyTests) {
ProxyConfig config;
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698