diff options
author | sdoyon@chromium.org <sdoyon@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-20 16:50:56 +0000 |
---|---|---|
committer | sdoyon@chromium.org <sdoyon@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-20 16:50:56 +0000 |
commit | 861c6c6d56add9157e04aa2ac43bec8e33bf1cc1 (patch) | |
tree | 835dd6466912cd073e3ac16177252fe0c8865c93 /net/proxy/proxy_config_service_common_unittest.cc | |
parent | bc1529bbafc42d96d9ac0839bcb0ba1ab9328445 (diff) | |
download | chromium_src-861c6c6d56add9157e04aa2ac43bec8e33bf1cc1.zip chromium_src-861c6c6d56add9157e04aa2ac43bec8e33bf1cc1.tar.gz chromium_src-861c6c6d56add9157e04aa2ac43bec8e33bf1cc1.tar.bz2 |
ProxyConfigService for Linux.
Establishes a ProxyConfig by reading settings from gconf or consulting
environment variables.
BUG=8143
Thanks to ermilov.maxim@gmail.com for his contribution: some ideas<
and code snippets from his patch were folded into this one.
(See http://codereview.chromium.org/49009)
Review URL: http://codereview.chromium.org/60009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14034 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_config_service_common_unittest.cc')
-rw-r--r-- | net/proxy/proxy_config_service_common_unittest.cc | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/net/proxy/proxy_config_service_common_unittest.cc b/net/proxy/proxy_config_service_common_unittest.cc new file mode 100644 index 0000000..06f1c6a --- /dev/null +++ b/net/proxy/proxy_config_service_common_unittest.cc @@ -0,0 +1,51 @@ +// Copyright (c) 2009 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. + +#include "net/proxy/proxy_config_service_common_unittest.h" + +#include <string> +#include <vector> + +#include "net/proxy/proxy_config.h" + +namespace net { + +ProxyConfig::ProxyRules MakeProxyRules( + ProxyConfig::ProxyRules::Type type, + const char* single_proxy, + const char* proxy_for_http, + const char* proxy_for_https, + const char* proxy_for_ftp) { + ProxyConfig::ProxyRules rules; + rules.type = type; + rules.single_proxy = ProxyServer::FromURI(single_proxy); + rules.proxy_for_http = ProxyServer::FromURI(proxy_for_http); + rules.proxy_for_https = ProxyServer::FromURI(proxy_for_https); + rules.proxy_for_ftp = ProxyServer::FromURI(proxy_for_ftp); + return rules; +} + +ProxyConfig::ProxyRules MakeSingleProxyRules(const char* single_proxy) { + return MakeProxyRules(ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY, + single_proxy, "", "", ""); +} + +ProxyConfig::ProxyRules MakeProxyPerSchemeRules( + const char* proxy_http, + const char* proxy_https, + const char* proxy_ftp) { + return MakeProxyRules(ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME, + "", proxy_http, proxy_https, proxy_ftp); +} + +std::string FlattenProxyBypass(const BypassList& proxy_bypass) { + std::string flattened_proxy_bypass; + for (BypassList::const_iterator it = proxy_bypass.begin(); + it != proxy_bypass.end(); ++it) { + flattened_proxy_bypass += *it + "\n"; + } + return flattened_proxy_bypass; +} + +} // namespace net |