[PATCH 1/2] urlmon/tests: Add a test for ProtocolCF_CreateInstance not supporting aggregation.

Dmitry Timoshkov dmitry at baikal.ru
Mon May 20 01:44:04 CDT 2019


Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/urlmon/tests/url.c | 49 ++++++++++++++++++++++++++++++++++++++---
 1 file changed, 46 insertions(+), 3 deletions(-)

diff --git a/dlls/urlmon/tests/url.c b/dlls/urlmon/tests/url.c
index 1aef981b83..84dedc07f4 100644
--- a/dlls/urlmon/tests/url.c
+++ b/dlls/urlmon/tests/url.c
@@ -140,6 +140,9 @@ DEFINE_EXPECT(UnlockRequest);
 DEFINE_EXPECT(Continue);
 DEFINE_EXPECT(Abort);
 DEFINE_EXPECT(CreateInstance);
+DEFINE_EXPECT(Protocol_CreateInstance);
+DEFINE_EXPECT(Protocol_CreateInstance_aggregation);
+DEFINE_EXPECT(Protocol_CreateInstance_no_aggregation);
 DEFINE_EXPECT(Load);
 DEFINE_EXPECT(PutProperty_MIMETYPEPROP);
 DEFINE_EXPECT(PutProperty_CLASSIDPROP);
@@ -181,7 +184,7 @@ static HRESULT binding_hres;
 static HRESULT onsecurityproblem_hres;
 static HRESULT abort_hres;
 static BOOL have_IHttpNegotiate2, use_bscex, is_async_prot;
-static BOOL test_redirect, use_cache_file, callback_read, no_callback, test_abort;
+static BOOL test_redirect, use_cache_file, callback_read, no_callback, no_aggregation, test_abort;
 static WCHAR cache_file_name[MAX_PATH];
 static WCHAR http_cache_file[MAX_PATH];
 static BOOL only_check_prot_args = FALSE;
@@ -2414,8 +2417,22 @@ static HRESULT WINAPI ProtocolCF_CreateInstance(IClassFactory *iface, IUnknown *
     if(IsEqualGUID(&IID_IInternetProtocolInfo, riid))
         return E_NOINTERFACE;
 
-    ok(outer != NULL, "outer == NULL\n");
+    if (!outer)
+    {
+        CHECK_EXPECT(Protocol_CreateInstance);
+        ok(IsEqualGUID(&IID_IInternetProtocol, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
+        *ppv = &Protocol;
+        return S_OK;
+    }
+
     ok(IsEqualGUID(&IID_IUnknown, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
+    if (no_aggregation)
+    {
+        CHECK_EXPECT(Protocol_CreateInstance_no_aggregation);
+        return CLASS_E_NOAGGREGATION;
+    }
+
+    CHECK_EXPECT(Protocol_CreateInstance_aggregation);
     *ppv = &Protocol;
     return S_OK;
 }
@@ -2864,6 +2881,7 @@ static BOOL test_RegisterBindStatusCallback(void)
 #define BINDTEST_ABORT_PROGRESS     0x0800
 #define BINDTEST_ASYNC_SWITCH       0x1000
 #define BINDTEST_ALLOW_FINDINGRESOURCE  0x2000
+#define BINDTEST_NO_AGGREGATION     0x4000
 
 static void init_bind_test(int protocol, DWORD flags, DWORD t)
 {
@@ -2919,6 +2937,7 @@ static void init_bind_test(int protocol, DWORD flags, DWORD t)
     use_cache_file = (flags & BINDTEST_USE_CACHE) != 0;
     callback_read = !(flags & BINDTEST_NO_CALLBACK_READ);
     no_callback = (flags & BINDTEST_NO_CALLBACK) != 0;
+    no_aggregation = (flags & BINDTEST_NO_AGGREGATION) != 0;
     test_abort = (flags & BINDTEST_ABORT) != 0;
     abort_start = (flags & BINDTEST_ABORT_START) != 0;
     abort_progress = (flags & BINDTEST_ABORT_PROGRESS) != 0;
@@ -3013,6 +3032,13 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
         if(is_urlmon_protocol(test_protocol))
             SET_EXPECT(SetPriority);
         SET_EXPECT(Start);
+        if(no_aggregation) {
+            SET_EXPECT(Protocol_CreateInstance_no_aggregation);
+            SET_EXPECT(Protocol_CreateInstance);
+        }
+        else
+            SET_EXPECT(Protocol_CreateInstance_aggregation);
+
         if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == WINETEST_TEST
            || test_protocol == WINETEST_SYNC_TEST)
             SET_EXPECT(Terminate);
@@ -3083,8 +3109,11 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
         ok(hres == MK_S_ASYNCHRONOUS, "IMoniker_BindToStorage failed: %08x\n", hres);
     else if(no_callback) {
         if(emulate_protocol)
-            ok( WaitForSingleObject(complete_event2, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
+    todo_wine_if(no_aggregation)
+            ok( WaitForSingleObject(complete_event2, 3000) == WAIT_OBJECT_0, "wait timed out\n" );
+    todo_wine_if(no_aggregation)
         ok(hres == S_OK, "IMoniker_BindToStorage failed: %08x\n", hres);
+    todo_wine_if(no_aggregation)
         ok(unk != NULL, "unk == NULL\n");
     }else if(!(bindf & BINDF_ASYNCHRONOUS) && tymed == TYMED_FILE) {
         ok(hres == S_OK, "IMoniker_BindToStorage failed: %08x\n", hres);
@@ -3149,6 +3178,17 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
         if(is_urlmon_protocol(test_protocol))
             CLEAR_CALLED(SetPriority); /* Not called by IE11 */
         CHECK_CALLED(Start);
+        if(no_callback) {
+            if(no_aggregation) {
+                CHECK_NOT_CALLED(Protocol_CreateInstance_aggregation);
+                CHECK_CALLED(Protocol_CreateInstance_no_aggregation);
+                CHECK_CALLED(Protocol_CreateInstance);
+            } else {
+                CHECK_CALLED(Protocol_CreateInstance_aggregation);
+                CHECK_NOT_CALLED(Protocol_CreateInstance_no_aggregation);
+                CHECK_NOT_CALLED(Protocol_CreateInstance);
+            }
+        }
         if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == WINETEST_TEST
            || test_protocol == WINETEST_SYNC_TEST) {
             if(tymed == TYMED_FILE)
@@ -4081,6 +4121,9 @@ START_TEST(url)
         trace("winetest test (no callback)...\n");
         test_BindToStorage(WINETEST_TEST, BINDTEST_EMULATE|BINDTEST_NO_CALLBACK|BINDTEST_USE_CACHE, TYMED_ISTREAM);
 
+        trace("winetest test (no callback + no aggregation)...\n");
+        test_BindToStorage(WINETEST_TEST, BINDTEST_EMULATE|BINDTEST_NO_CALLBACK|BINDTEST_USE_CACHE|BINDTEST_NO_AGGREGATION, TYMED_ISTREAM);
+
         trace("emulated https test...\n");
         test_BindToStorage(HTTPS_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
 
-- 
2.20.1




More information about the wine-devel mailing list