From 3f153007ba7c19fdb8b30c19143ad26e146c5eee Mon Sep 17 00:00:00 2001 From: Greg Geldorp Date: Wed, 19 Jan 2011 12:44:07 +0100 Subject: [PATCH] urlmon/tests: Fix tests when connecting via proxy. --- dlls/urlmon/tests/protocol.c | 24 +++++++++++++++++++++++- dlls/urlmon/tests/url.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c index dd8cbf9e70c..dcfe20c11a0 100644 --- a/dlls/urlmon/tests/protocol.c +++ b/dlls/urlmon/tests/protocol.c @@ -221,6 +221,25 @@ static int strcmp_ww(LPCWSTR strw1, LPCWSTR strw2) return lstrcmpA(stra1, stra2); } +static BOOL proxy_active(void) +{ + HKEY internet_settings; + DWORD proxy_enable; + DWORD size; + + if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", + 0, KEY_QUERY_VALUE, &internet_settings) != ERROR_SUCCESS) + return FALSE; + + size = sizeof(DWORD); + if (RegQueryValueExA(internet_settings, "ProxyEnable", NULL, NULL, (LPBYTE) &proxy_enable, &size) != ERROR_SUCCESS) + proxy_enable = 0; + + RegCloseKey(internet_settings); + + return proxy_enable != 0; +} + static HRESULT WINAPI HttpSecurity_QueryInterface(IHttpSecurity *iface, REFIID riid, void **ppv) { if(IsEqualGUID(&IID_IUnknown, riid) @@ -581,7 +600,10 @@ static void call_continue(PROTOCOLDATA *protocol_data) CLEAR_CALLED(ReportProgress_CONNECTING); CLEAR_CALLED(ReportProgress_PROXYDETECTING); }else if(test_redirect) { - CHECK_CALLED(ReportProgress_FINDINGRESOURCE); + if (! proxy_active()) + CHECK_CALLED(ReportProgress_FINDINGRESOURCE); + else + CLEAR_CALLED(ReportProgress_FINDINGRESOURCE); }else todo_wine { CHECK_NOT_CALLED(ReportProgress_FINDINGRESOURCE); /* IE7 does call this */ diff --git a/dlls/urlmon/tests/url.c b/dlls/urlmon/tests/url.c index 47b2e797f25..21d5fd636df 100644 --- a/dlls/urlmon/tests/url.c +++ b/dlls/urlmon/tests/url.c @@ -246,6 +246,25 @@ static const char *debugstr_guid(REFIID riid) return buf; } +static BOOL proxy_active(void) +{ + HKEY internet_settings; + DWORD proxy_enable; + DWORD size; + + if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", + 0, KEY_QUERY_VALUE, &internet_settings) != ERROR_SUCCESS) + return FALSE; + + size = sizeof(DWORD); + if (RegQueryValueExA(internet_settings, "ProxyEnable", NULL, NULL, (LPBYTE) &proxy_enable, &size) != ERROR_SUCCESS) + proxy_enable = 0; + + RegCloseKey(internet_settings); + + return proxy_enable != 0; +} + static BOOL is_urlmon_protocol(int prot) { return prot == FILE_TEST || prot == HTTP_TEST || prot == HTTPS_TEST || prot == FTP_TEST || prot == MK_TEST; @@ -2799,8 +2818,16 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t) CHECK_CALLED(GetRootSecurityId); } if(http_is_first || (test_protocol == HTTPS_TEST && !(flags & BINDTEST_INVALID_CN))) { - CHECK_CALLED(OnProgress_FINDINGRESOURCE); - CHECK_CALLED(OnProgress_CONNECTING); + if (! proxy_active()) + { + CHECK_CALLED(OnProgress_FINDINGRESOURCE); + CHECK_CALLED(OnProgress_CONNECTING); + } + else + { + CLEAR_CALLED(OnProgress_FINDINGRESOURCE); + CLEAR_CALLED(OnProgress_CONNECTING); + } }else todo_wine { CHECK_NOT_CALLED(OnProgress_FINDINGRESOURCE); /* IE7 does call this */