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

Unified Diff: net/proxy/proxy_list_unittest.cc

Issue 473513002: Keep track of network error in ProxyRetryInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor formatting Created 6 years, 4 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_list.cc ('k') | net/proxy/proxy_retry_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_list_unittest.cc
diff --git a/net/proxy/proxy_list_unittest.cc b/net/proxy/proxy_list_unittest.cc
index 9ccf9c4e4f795cfdd6cbb86d58e4634fc35ccdf7..23b823f916ea189fa95f388a3615a440c30bd52c 100644
--- a/net/proxy/proxy_list_unittest.cc
+++ b/net/proxy/proxy_list_unittest.cc
@@ -4,6 +4,7 @@
#include "net/proxy/proxy_list.h"
+#include "net/base/net_errors.h"
#include "net/base/net_log.h"
#include "net/proxy/proxy_retry_info.h"
#include "net/proxy/proxy_server.h"
@@ -172,13 +173,38 @@ TEST(ProxyListTest, UpdateRetryInfoOnFallback) {
ProxyList list;
ProxyRetryInfoMap retry_info_map;
BoundNetLog net_log;
+ ProxyServer proxy_server(
+ ProxyServer::FromURI("foopy1:80", ProxyServer::SCHEME_HTTP));
list.SetFromPacString("PROXY foopy1:80;PROXY foopy2:80;PROXY foopy3:80");
list.UpdateRetryInfoOnFallback(&retry_info_map,
base::TimeDelta::FromSeconds(60),
true,
- ProxyServer(),
+ proxy_server,
+ ERR_PROXY_CONNECTION_FAILED,
+ net_log);
+ EXPECT_TRUE(retry_info_map.end() != retry_info_map.find("foopy1:80"));
+ EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED,
+ retry_info_map[proxy_server.ToURI()].net_error);
+ EXPECT_TRUE(retry_info_map.end() == retry_info_map.find("foopy2:80"));
+ EXPECT_TRUE(retry_info_map.end() == retry_info_map.find("foopy3:80"));
+ }
+ // Retrying should put the first proxy on the retry list, even if there
+ // was no network error.
+ {
+ ProxyList list;
+ ProxyRetryInfoMap retry_info_map;
+ BoundNetLog net_log;
+ ProxyServer proxy_server(
+ ProxyServer::FromURI("foopy1:80", ProxyServer::SCHEME_HTTP));
+ list.SetFromPacString("PROXY foopy1:80;PROXY foopy2:80;PROXY foopy3:80");
+ list.UpdateRetryInfoOnFallback(&retry_info_map,
+ base::TimeDelta::FromSeconds(60),
+ true,
+ proxy_server,
+ OK,
net_log);
EXPECT_TRUE(retry_info_map.end() != retry_info_map.find("foopy1:80"));
+ EXPECT_EQ(OK, retry_info_map[proxy_server.ToURI()].net_error);
EXPECT_TRUE(retry_info_map.end() == retry_info_map.find("foopy2:80"));
EXPECT_TRUE(retry_info_map.end() == retry_info_map.find("foopy3:80"));
}
@@ -195,8 +221,11 @@ TEST(ProxyListTest, UpdateRetryInfoOnFallback) {
base::TimeDelta::FromSeconds(60),
true,
proxy_server,
+ ERR_NAME_RESOLUTION_FAILED,
net_log);
EXPECT_TRUE(retry_info_map.end() != retry_info_map.find("foopy1:80"));
+ EXPECT_EQ(ERR_NAME_RESOLUTION_FAILED,
+ retry_info_map[proxy_server.ToURI()].net_error);
EXPECT_TRUE(retry_info_map.end() == retry_info_map.find("foopy2:80"));
EXPECT_TRUE(retry_info_map.end() != retry_info_map.find("foopy3:80"));
}
@@ -213,6 +242,7 @@ TEST(ProxyListTest, UpdateRetryInfoOnFallback) {
base::TimeDelta::FromSeconds(60),
true,
proxy_server,
+ OK,
net_log);
EXPECT_TRUE(retry_info_map.end() == retry_info_map.find("foopy2:80"));
EXPECT_TRUE(retry_info_map.end() == retry_info_map.find("foopy3:80"));
« no previous file with comments | « net/proxy/proxy_list.cc ('k') | net/proxy/proxy_retry_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698