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

Unified Diff: net/proxy/proxy_service_unittest.cc

Issue 545633002: Don't preresolve DNS if a fixed proxy configuration is in place. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remote superfluous net:: prefix Created 6 years, 2 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 f153fad2cceeda9189e621c575a9e8234993b90b..08454937c79c2c065447a2ed270816f777450f17 100644
--- a/net/proxy/proxy_service_unittest.cc
+++ b/net/proxy/proxy_service_unittest.cc
@@ -3081,4 +3081,56 @@ TEST_F(ProxyServiceTest, PACScriptRefetchAfterActivity) {
EXPECT_TRUE(info3.is_direct());
}
+// Test that the synchronous resolution fails when a PAC script is active.
+TEST_F(ProxyServiceTest, SynchronousWithPAC) {
+ MockProxyConfigService* config_service =
+ new MockProxyConfigService("http://foopy/proxy.pac");
+
+ MockAsyncProxyResolver* resolver = new MockAsyncProxyResolver();
+
+ ProxyService service(config_service, resolver, NULL);
+
+ GURL url("http://www.google.com/");
+
+ ProxyInfo info;
+ info.UseDirect();
+ CapturingBoundNetLog log;
+
+ bool synchronous_success = service.TryResolveProxySynchronously(
+ url, net::LOAD_NORMAL, &info, NULL, log.bound());
+ EXPECT_FALSE(synchronous_success);
+
+ // No request should have been queued.
+ EXPECT_EQ(0u, resolver->pending_requests().size());
+
+ // |info| should not have been modified.
+ EXPECT_TRUE(info.is_direct());
+}
+
+// Test that synchronous results are returned correctly if a fixed proxy
+// configuration is active.
+TEST_F(ProxyServiceTest, SynchronousWithFixedConfiguration) {
+ ProxyConfig config;
+ config.proxy_rules().ParseFromString("foopy1:8080");
+ config.set_auto_detect(false);
+
+ MockAsyncProxyResolver* resolver = new MockAsyncProxyResolver();
+
+ ProxyService service(new MockProxyConfigService(config), resolver, NULL);
+
+ GURL url("http://www.google.com/");
+
+ ProxyInfo info;
+ CapturingBoundNetLog log;
+
+ bool synchronous_success = service.TryResolveProxySynchronously(
+ url, net::LOAD_NORMAL, &info, NULL, log.bound());
+ EXPECT_TRUE(synchronous_success);
+ EXPECT_FALSE(info.is_direct());
+ EXPECT_EQ("foopy1", info.proxy_server().host_port_pair().host());
+
+ // No request should have been queued.
+ EXPECT_EQ(0u, resolver->pending_requests().size());
+}
+
} // namespace net
« 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