Jacek Caban : urlmon: Register MIME filter only for bindings testing them.

Alexandre Julliard julliard at winehq.org
Wed Feb 23 13:01:52 CST 2011


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Feb 23 13:12:07 2011 +0100

urlmon: Register MIME filter only for bindings testing them.

---

 dlls/urlmon/tests/protocol.c |   41 +++++++++++++++++++++++------------------
 1 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c
index 123fc03..33afe49 100644
--- a/dlls/urlmon/tests/protocol.c
+++ b/dlls/urlmon/tests/protocol.c
@@ -2210,6 +2210,27 @@ static IClassFactory mimefilter_cf = { &MimeFilterCFVtbl };
 #define TEST_USEIURI     0x0400
 #define TEST_IMPLPROTEX  0x0800
 
+static void register_filter(BOOL do_register)
+{
+    IInternetSession *session;
+    HRESULT hres;
+
+    static const WCHAR gzipW[] = {'g','z','i','p',0};
+
+    hres = pCoInternetGetSession(0, &session, 0);
+    ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
+
+    if(do_register) {
+        hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, gzipW);
+        ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
+    }else {
+        hres = IInternetSession_UnregisterMimeFilter(session, &mimefilter_cf, gzipW);
+        ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
+    }
+
+    IInternetSession_Release(session);
+}
+
 static void init_test(int prot, DWORD flags)
 {
     tested_protocol = prot;
@@ -2239,6 +2260,8 @@ static void init_test(int prot, DWORD flags)
     test_redirect = (flags & TEST_REDIRECT) != 0;
     test_abort = (flags & TEST_ABORT) != 0;
     impl_protex = (flags & TEST_IMPLPROTEX) != 0;
+
+    register_filter(mimefilter_test);
 }
 
 static void test_priority(IInternetProtocol *protocol)
@@ -3463,22 +3486,6 @@ static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
     IInternetSession_Release(session);
 }
 
-static void register_filter(void)
-{
-    IInternetSession *session;
-    HRESULT hres;
-
-    static const WCHAR gzipW[] = {'g','z','i','p',0};
-
-    hres = pCoInternetGetSession(0, &session, 0);
-    ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
-
-    hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, gzipW);
-    ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
-
-    IInternetSession_Release(session);
-}
-
 START_TEST(protocol)
 {
     HMODULE hurlmon;
@@ -3504,8 +3511,6 @@ START_TEST(protocol)
     event_continue_done = CreateEvent(NULL, FALSE, FALSE, NULL);
     thread_id = GetCurrentThreadId();
 
-    register_filter();
-
     test_file_protocol();
     test_http_protocol();
     test_https_protocol();




More information about the wine-cvs mailing list