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

Side by Side Diff: net/proxy/proxy_config_service_common_unittest.cc

Issue 149191: Whenever proxy configurations contain socks and http/https/ftp proxies, socks... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/proxy/proxy_config_service_common_unittest.h" 5 #include "net/proxy/proxy_config_service_common_unittest.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "net/proxy/proxy_config.h" 10 #include "net/proxy/proxy_config.h"
11 11
12 namespace net { 12 namespace net {
13 13
14 ProxyConfig::ProxyRules MakeProxyRules( 14 ProxyConfig::ProxyRules MakeProxyRules(
15 ProxyConfig::ProxyRules::Type type, 15 ProxyConfig::ProxyRules::Type type,
16 const char* single_proxy, 16 const char* single_proxy,
17 const char* proxy_for_http, 17 const char* proxy_for_http,
18 const char* proxy_for_https, 18 const char* proxy_for_https,
19 const char* proxy_for_ftp) { 19 const char* proxy_for_ftp,
20 const char* socks_proxy) {
20 ProxyConfig::ProxyRules rules; 21 ProxyConfig::ProxyRules rules;
21 rules.type = type; 22 rules.type = type;
22 rules.single_proxy = ProxyServer::FromURI(single_proxy); 23 rules.single_proxy = ProxyServer::FromURI(single_proxy,
23 rules.proxy_for_http = ProxyServer::FromURI(proxy_for_http); 24 ProxyServer::SCHEME_HTTP);
24 rules.proxy_for_https = ProxyServer::FromURI(proxy_for_https); 25 rules.proxy_for_http = ProxyServer::FromURI(proxy_for_http,
25 rules.proxy_for_ftp = ProxyServer::FromURI(proxy_for_ftp); 26 ProxyServer::SCHEME_HTTP);
27 rules.proxy_for_https = ProxyServer::FromURI(proxy_for_https,
28 ProxyServer::SCHEME_HTTP);
29 rules.proxy_for_ftp = ProxyServer::FromURI(proxy_for_ftp,
30 ProxyServer::SCHEME_HTTP);
31 rules.socks_proxy = ProxyServer::FromURI(socks_proxy,
32 ProxyServer::SCHEME_SOCKS4);
26 return rules; 33 return rules;
27 } 34 }
28 35
29 ProxyConfig::ProxyRules MakeSingleProxyRules(const char* single_proxy) { 36 ProxyConfig::ProxyRules MakeSingleProxyRules(const char* single_proxy) {
30 return MakeProxyRules(ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY, 37 return MakeProxyRules(ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY,
31 single_proxy, "", "", ""); 38 single_proxy, "", "", "", "");
32 } 39 }
33 40
34 ProxyConfig::ProxyRules MakeProxyPerSchemeRules( 41 ProxyConfig::ProxyRules MakeProxyPerSchemeRules(
35 const char* proxy_http, 42 const char* proxy_http,
36 const char* proxy_https, 43 const char* proxy_https,
37 const char* proxy_ftp) { 44 const char* proxy_ftp) {
38 return MakeProxyRules(ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME, 45 return MakeProxyRules(ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
39 "", proxy_http, proxy_https, proxy_ftp); 46 "", proxy_http, proxy_https, proxy_ftp, "");
47 }
48 ProxyConfig::ProxyRules MakeProxyPerSchemeRules(
49 const char* proxy_http,
50 const char* proxy_https,
51 const char* proxy_ftp,
52 const char* socks_proxy) {
53 return MakeProxyRules(ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
54 "", proxy_http, proxy_https, proxy_ftp, socks_proxy);
40 } 55 }
41 56
42 std::string FlattenProxyBypass(const BypassList& proxy_bypass) { 57 std::string FlattenProxyBypass(const BypassList& proxy_bypass) {
43 std::string flattened_proxy_bypass; 58 std::string flattened_proxy_bypass;
44 for (BypassList::const_iterator it = proxy_bypass.begin(); 59 for (BypassList::const_iterator it = proxy_bypass.begin();
45 it != proxy_bypass.end(); ++it) { 60 it != proxy_bypass.end(); ++it) {
46 flattened_proxy_bypass += *it + "\n"; 61 flattened_proxy_bypass += *it + "\n";
47 } 62 }
48 return flattened_proxy_bypass; 63 return flattened_proxy_bypass;
49 } 64 }
50 65
51 } // namespace net 66 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_config_service_common_unittest.h ('k') | net/proxy/proxy_config_service_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698