OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "net/proxy/proxy_config_service_common_unittest.h" |
| 6 |
| 7 #include <string> |
| 8 #include <vector> |
| 9 |
| 10 #include "net/proxy/proxy_config.h" |
| 11 |
| 12 namespace net { |
| 13 |
| 14 ProxyConfig::ProxyRules MakeProxyRules( |
| 15 ProxyConfig::ProxyRules::Type type, |
| 16 const char* single_proxy, |
| 17 const char* proxy_for_http, |
| 18 const char* proxy_for_https, |
| 19 const char* proxy_for_ftp) { |
| 20 ProxyConfig::ProxyRules rules; |
| 21 rules.type = type; |
| 22 rules.single_proxy = ProxyServer::FromURI(single_proxy); |
| 23 rules.proxy_for_http = ProxyServer::FromURI(proxy_for_http); |
| 24 rules.proxy_for_https = ProxyServer::FromURI(proxy_for_https); |
| 25 rules.proxy_for_ftp = ProxyServer::FromURI(proxy_for_ftp); |
| 26 return rules; |
| 27 } |
| 28 |
| 29 ProxyConfig::ProxyRules MakeSingleProxyRules(const char* single_proxy) { |
| 30 return MakeProxyRules(ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY, |
| 31 single_proxy, "", "", ""); |
| 32 } |
| 33 |
| 34 ProxyConfig::ProxyRules MakeProxyPerSchemeRules( |
| 35 const char* proxy_http, |
| 36 const char* proxy_https, |
| 37 const char* proxy_ftp) { |
| 38 return MakeProxyRules(ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME, |
| 39 "", proxy_http, proxy_https, proxy_ftp); |
| 40 } |
| 41 |
| 42 std::string FlattenProxyBypass(const BypassList& proxy_bypass) { |
| 43 std::string flattened_proxy_bypass; |
| 44 for (BypassList::const_iterator it = proxy_bypass.begin(); |
| 45 it != proxy_bypass.end(); ++it) { |
| 46 flattened_proxy_bypass += *it + "\n"; |
| 47 } |
| 48 return flattened_proxy_bypass; |
| 49 } |
| 50 |
| 51 } // namespace net |
OLD | NEW |