Jacek Caban : urlmon: Skip tests on very old IEs as soon as possible.

Alexandre Julliard julliard at winehq.org
Mon Sep 20 12:12:21 CDT 2010


Module: wine
Branch: master
Commit: 493a3172f47141ad48669987baf3cd87ccc4c0a3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=493a3172f47141ad48669987baf3cd87ccc4c0a3

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Sep 20 12:45:50 2010 +0200

urlmon: Skip tests on very old IEs as soon as possible.

---

 dlls/urlmon/tests/misc.c    |   51 ++----------------------------------------
 dlls/urlmon/tests/sec_mgr.c |   25 ++------------------
 2 files changed, 6 insertions(+), 70 deletions(-)

diff --git a/dlls/urlmon/tests/misc.c b/dlls/urlmon/tests/misc.c
index 7681b5c..558fc42 100644
--- a/dlls/urlmon/tests/misc.c
+++ b/dlls/urlmon/tests/misc.c
@@ -317,10 +317,6 @@ static void test_CoInternetParseUrl(void)
 
     static WCHAR buf[4096];
 
-    if (!pCoInternetParseUrl) {
-        return;
-    }
-
     memset(buf, 0xf0, sizeof(buf));
     hres = pCoInternetParseUrl(parse_tests[0].url, PARSE_SCHEMA, 0, buf,
             3, &size, 0);
@@ -380,10 +376,6 @@ static void test_CoInternetCompareUrl(void)
 {
     HRESULT hres;
 
-    if (!pCoInternetCompareUrl) {
-        return;
-    }
-
     hres = pCoInternetCompareUrl(url1, url1, 0);
     ok(hres == S_OK, "CoInternetCompareUrl failed: %08x\n", hres);
 
@@ -414,10 +406,6 @@ static void test_CoInternetQueryInfo(void)
     DWORD cb, i;
     HRESULT hres;
 
-    if (!pCoInternetQueryInfo) {
-        return;
-    }
-
     for(i=0; i < sizeof(query_info_tests)/sizeof(query_info_tests[0]); i++) {
         cb = 0xdeadbeef;
         memset(buf, '?', sizeof(buf));
@@ -665,10 +653,6 @@ static void test_FindMimeFromData(void)
     LPWSTR mime;
     int i;
 
-    if (!pFindMimeFromData) {
-        return;
-    }
-
     for(i=0; i<sizeof(mime_tests)/sizeof(mime_tests[0]); i++) {
         mime = (LPWSTR)0xf0f0f0f0;
         hres = pFindMimeFromData(NULL, mime_tests[i].url, NULL, 0, NULL, 0, &mime, 0);
@@ -770,10 +754,6 @@ static void register_protocols(void)
 
     static const WCHAR wszAbout[] = {'a','b','o','u','t',0};
 
-    if (!pCoInternetGetSession) {
-        return;
-    }
-
     hres = pCoInternetGetSession(0, &session, 0);
     ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
     if(FAILED(hres))
@@ -947,10 +927,6 @@ static void test_NameSpace(void)
 
     static const WCHAR wszTest[] = {'t','e','s','t',0};
 
-    if (!pCoInternetGetSession || !pCoInternetParseUrl) {
-        return;
-    }
-
     hres = pCoInternetGetSession(0, &session, 0);
     ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
     if(FAILED(hres))
@@ -1105,10 +1081,6 @@ static void test_MimeFilter(void)
 
     static const WCHAR mimeW[] = {'t','e','s','t','/','m','i','m','e',0};
 
-    if (!pCoInternetGetSession) {
-        return;
-    }
-
     hres = pCoInternetGetSession(0, &session, 0);
     ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
     if(FAILED(hres))
@@ -1146,10 +1118,6 @@ static void test_ReleaseBindInfo(void)
     BINDINFO bi;
     IUnknown unk = { &unk_vtbl };
 
-    if (!pReleaseBindInfo) {
-        return;
-    }
-
     pReleaseBindInfo(NULL); /* shouldn't crash */
 
     memset(&bi, 0, sizeof(bi));
@@ -1183,11 +1151,6 @@ static void test_CopyStgMedium(void)
 
     static WCHAR fileW[] = {'f','i','l','e',0};
 
-    if (!pCopyStgMedium) {
-        return;
-    }
-
-
     memset(&src, 0xf0, sizeof(src));
     memset(&dst, 0xe0, sizeof(dst));
     memset(&empty, 0xf0, sizeof(empty));
@@ -1231,11 +1194,6 @@ static void test_UrlMkGetSessionOption(void)
     DWORD encoding, size;
     HRESULT hres;
 
-
-    if (!pUrlMkGetSessionOption) {
-        return;
-    }
-
     size = encoding = 0xdeadbeef;
     hres = pUrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
                                  sizeof(encoding), &size, 0);
@@ -1281,10 +1239,6 @@ static void test_user_agent(void)
     HRESULT hres;
     DWORD size, saved;
 
-    if (!pObtainUserAgentString || !pUrlMkGetSessionOption) {
-        return;
-    }
-
     hres = pObtainUserAgentString(0, NULL, NULL);
     ok(hres == E_INVALIDARG, "ObtainUserAgentString failed: %08x\n", hres);
 
@@ -1507,8 +1461,6 @@ START_TEST(misc)
 {
     HMODULE hurlmon;
 
-    OleInitialize(NULL);
-
     hurlmon = GetModuleHandle("urlmon.dll");
     pCoInternetCompareUrl = (void *) GetProcAddress(hurlmon, "CoInternetCompareUrl");
     pCoInternetGetSecurityUrl = (void*) GetProcAddress(hurlmon, "CoInternetGetSecurityUrl");
@@ -1524,8 +1476,11 @@ START_TEST(misc)
     if (!pCoInternetCompareUrl || !pCoInternetGetSecurityUrl ||
         !pCoInternetGetSession || !pCoInternetParseUrl) {
         win_skip("Various needed functions not present in IE 4.0\n");
+        return;
     }
 
+    OleInitialize(NULL);
+
     register_protocols();
 
     test_CreateFormatEnum();
diff --git a/dlls/urlmon/tests/sec_mgr.c b/dlls/urlmon/tests/sec_mgr.c
index 5a1894b..f6e4abd 100644
--- a/dlls/urlmon/tests/sec_mgr.c
+++ b/dlls/urlmon/tests/sec_mgr.c
@@ -349,10 +349,6 @@ static void test_polices(void)
     IInternetSecurityManager *secmgr = NULL;
     HRESULT hres;
 
-    if(!pCoInternetCreateSecurityManager || !pCoInternetCreateZoneManager) {
-        return;
-    }
-
     hres = pCoInternetCreateSecurityManager(NULL, &secmgr, 0);
     ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08x\n", hres);
     hres = pCoInternetCreateZoneManager(NULL, &zonemgr, 0);
@@ -379,10 +375,6 @@ static void test_CoInternetCreateZoneManager(void)
     IUnknown *punk = NULL;
     HRESULT hr;
 
-    if(!pCoInternetCreateZoneManager) {
-        return;
-    }
-
     hr = pCoInternetCreateZoneManager(NULL, &zonemgr, 0);
     ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%x\n", hr);
     if (FAILED(hr))
@@ -427,10 +419,6 @@ static void test_CreateZoneEnumerator(void)
     DWORD dwCount;
     DWORD dwCount2;
 
-    if (!pCoInternetCreateZoneManager) {
-        return;
-    }
-
     hr = pCoInternetCreateZoneManager(NULL, &zonemgr, 0);
     ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%x\n", hr);
     if (FAILED(hr))
@@ -641,10 +629,6 @@ static void test_InternetSecurityMarshalling(void)
     IStream *stream;
     HRESULT hres;
 
-    if(!pCoInternetCreateSecurityManager) {
-        return;
-    }
-
     hres = pCoInternetCreateSecurityManager(NULL, &secmgr, 0);
     ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08x\n", hres);
     if(FAILED(hres))
@@ -680,10 +664,6 @@ static void test_InternetGetSecurityUrl(void)
     DWORD i;
     HRESULT hres;
 
-    if (!pCoInternetGetSecurityUrl) {
-        return;
-    }
-
     for(i=0; i<sizeof(in)/sizeof(WCHAR*); i++) {
         hres = pCoInternetGetSecurityUrl(in[i], &sec, PSU_DEFAULT, 0);
         ok(hres == S_OK, "(%d) CoInternetGetSecurityUrl returned: %08x\n", i, hres);
@@ -708,8 +688,6 @@ START_TEST(sec_mgr)
 {
     HMODULE hurlmon;
 
-    OleInitialize(NULL);
-
     hurlmon = GetModuleHandle("urlmon.dll");
     pCoInternetCreateSecurityManager = (void*) GetProcAddress(hurlmon, "CoInternetCreateSecurityManager");
     pCoInternetCreateZoneManager = (void*) GetProcAddress(hurlmon, "CoInternetCreateZoneManager");
@@ -718,8 +696,11 @@ START_TEST(sec_mgr)
     if (!pCoInternetCreateSecurityManager || !pCoInternetCreateZoneManager ||
         !pCoInternetGetSecurityUrl) {
         win_skip("Various CoInternet* functions not present in IE 4.0\n");
+        return;
     }
 
+    OleInitialize(NULL);
+
     test_InternetGetSecurityUrl();
     test_SecurityManager();
     test_polices();




More information about the wine-cvs mailing list