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

Unified Diff: chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc

Issue 12315019: Change ProxyRules to handle ProxyLists rather than just single ProxyServer instances. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 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: chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc
diff --git a/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc b/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc
index 4c8874200d6b9e435fe8d562791a0b99eaa1c0d8..116f85adb545a03c1204d7c5d3091213ad5c4b92 100644
--- a/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc
+++ b/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc
@@ -328,6 +328,33 @@ TEST(ExtensionProxyApiHelpers, CreateProxyRulesDict) {
EXPECT_TRUE(Value::Equals(expected.get(), extension_pref.get()));
}
+// Test multiple proxies per scheme -- expect that only the first is returned.
+TEST(ExtensionProxyApiHelpers, CreateProxyRulesDictMultipleProxies) {
+ scoped_ptr<DictionaryValue> browser_pref(
+ ProxyConfigDictionary::CreateFixedServers(
+ "http=proxy1:80,default://;https=proxy2:80,proxy1:80;ftp=proxy3:80,"
+ "https://proxy5:443;socks=proxy4:80,proxy1:80",
+ "localhost"));
+ ProxyConfigDictionary config(browser_pref.get());
+ scoped_ptr<DictionaryValue> extension_pref(CreateProxyRulesDict(config));
+ ASSERT_TRUE(extension_pref.get());
+
+ scoped_ptr<DictionaryValue> expected(new DictionaryValue);
+ expected->Set("proxyForHttp",
+ CreateTestProxyServerDict("http", "proxy1", 80));
+ expected->Set("proxyForHttps",
+ CreateTestProxyServerDict("http", "proxy2", 80));
+ expected->Set("proxyForFtp",
+ CreateTestProxyServerDict("http", "proxy3", 80));
+ expected->Set("fallbackProxy",
+ CreateTestProxyServerDict("socks4", "proxy4", 80));
+ ListValue* bypass_list = new ListValue;
+ bypass_list->Append(Value::CreateStringValue("localhost"));
+ expected->Set(keys::kProxyConfigBypassList, bypass_list);
+
+ EXPECT_TRUE(Value::Equals(expected.get(), extension_pref.get()));
+}
+
// Test if a PAC script URL is specified.
TEST(ExtensionProxyApiHelpers, CreatePacScriptDictWithUrl) {
scoped_ptr<DictionaryValue> browser_pref(
« no previous file with comments | « chrome/browser/extensions/api/proxy/proxy_api_helpers.cc ('k') | chrome/browser/importer/firefox_proxy_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698