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

Unified Diff: net/proxy/proxy_config_unittest.cc

Issue 10310179: Track sources of proxy settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update copyright Created 8 years, 6 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
Index: net/proxy/proxy_config_unittest.cc
diff --git a/net/proxy/proxy_config_unittest.cc b/net/proxy/proxy_config_unittest.cc
index 1947ce4acf2510c389d10b4da362d59efe54c13e..47ea68946f671c8842901e206f82941074d0956c 100644
--- a/net/proxy/proxy_config_unittest.cc
+++ b/net/proxy/proxy_config_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -251,6 +251,33 @@ TEST(ProxyConfigTest, ParseProxyRules) {
}
}
+TEST(ProxyConfigTest, ProxyRulesSetBypassFlag) {
+ // Test whether the did_bypass_proxy() flag is set in proxy info correctly.
+ ProxyConfig::ProxyRules rules;
+ ProxyInfo result;
+
+ rules.ParseFromString("http=httpproxy:80");
+ rules.bypass_rules.AddRuleFromString(".com");
+
+ rules.Apply(GURL("http://example.com"), &result);
+ EXPECT_TRUE(result.is_direct_only());
+ EXPECT_TRUE(result.did_bypass_proxy());
+
+ rules.Apply(GURL("http://example.org"), &result);
+ EXPECT_FALSE(result.is_direct());
+ EXPECT_FALSE(result.did_bypass_proxy());
+
+ // Try with reversed bypass rules.
+ rules.reverse_bypass = true;
+
+ rules.Apply(GURL("http://example.org"), &result);
+ EXPECT_TRUE(result.is_direct_only());
+ EXPECT_TRUE(result.did_bypass_proxy());
+
+ rules.Apply(GURL("http://example.com"), &result);
+ EXPECT_FALSE(result.is_direct());
+ EXPECT_FALSE(result.did_bypass_proxy());
+}
+
} // namespace
} // namespace net
-

Powered by Google App Engine
This is Rietveld 408576698