summaryrefslogtreecommitdiffstats
path: root/net/proxy/proxy_config_service_win.cc
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 20:19:57 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 20:19:57 +0000
commit96ce2236c77dad045d6003848c4a15f067a992ff (patch)
tree3386773b3ad8ad69a0db793d74ef82d3e7c6cb01 /net/proxy/proxy_config_service_win.cc
parent899444114171abea60072f2b3980e3730c59058c (diff)
downloadchromium_src-96ce2236c77dad045d6003848c4a15f067a992ff.zip
chromium_src-96ce2236c77dad045d6003848c4a15f067a992ff.tar.gz
chromium_src-96ce2236c77dad045d6003848c4a15f067a992ff.tar.bz2
Add a unit test for ProxyConfigServiceWin.
Review URL: http://codereview.chromium.org/55001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12695 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_config_service_win.cc')
-rw-r--r--net/proxy/proxy_config_service_win.cc25
1 files changed, 15 insertions, 10 deletions
diff --git a/net/proxy/proxy_config_service_win.cc b/net/proxy/proxy_config_service_win.cc
index 0521f1d..ab02c66 100644
--- a/net/proxy/proxy_config_service_win.cc
+++ b/net/proxy/proxy_config_service_win.cc
@@ -17,13 +17,13 @@
namespace net {
-static void FreeConfig(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* config) {
- if (config->lpszAutoConfigUrl)
- GlobalFree(config->lpszAutoConfigUrl);
- if (config->lpszProxy)
- GlobalFree(config->lpszProxy);
- if (config->lpszProxyBypass)
- GlobalFree(config->lpszProxyBypass);
+static void FreeIEConfig(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* ie_config) {
+ if (ie_config->lpszAutoConfigUrl)
+ GlobalFree(ie_config->lpszAutoConfigUrl);
+ if (ie_config->lpszProxy)
+ GlobalFree(ie_config->lpszProxy);
+ if (ie_config->lpszProxyBypass)
+ GlobalFree(ie_config->lpszProxyBypass);
}
int ProxyConfigServiceWin::GetProxyConfig(ProxyConfig* config) {
@@ -33,7 +33,15 @@ int ProxyConfigServiceWin::GetProxyConfig(ProxyConfig* config) {
GetLastError();
return ERR_FAILED; // TODO(darin): Bug 1189288: translate error code.
}
+ SetFromIEConfig(config, ie_config);
+ FreeIEConfig(&ie_config);
+ return OK;
+}
+// static
+void ProxyConfigServiceWin::SetFromIEConfig(
+ ProxyConfig* config,
+ const WINHTTP_CURRENT_USER_IE_PROXY_CONFIG& ie_config) {
if (ie_config.fAutoDetect)
config->auto_detect = true;
if (ie_config.lpszProxy)
@@ -52,9 +60,6 @@ int ProxyConfigServiceWin::GetProxyConfig(ProxyConfig* config) {
}
if (ie_config.lpszAutoConfigUrl)
config->pac_url = GURL(ie_config.lpszAutoConfigUrl);
-
- FreeConfig(&ie_config);
- return OK;
}
} // namespace net