[PATCH 2/5] gameux/tests: Run the game explorer tests in a multithreaded apartment as well.

Henri Verbeet hverbeet at codeweavers.com
Tue Oct 11 10:24:52 CDT 2011


---
 dlls/gameux/tests/gameexplorer.c |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/dlls/gameux/tests/gameexplorer.c b/dlls/gameux/tests/gameexplorer.c
index 7be9c69..462fb8f 100644
--- a/dlls/gameux/tests/gameexplorer.c
+++ b/dlls/gameux/tests/gameexplorer.c
@@ -656,30 +656,42 @@ static void test_install_uninstall_game(void)
     }
 }
 
-START_TEST(gameexplorer)
+static void run_tests(void)
 {
-    HRESULT r;
     BOOL gameExplorerAvailable = FALSE;
     BOOL gameExplorer2Available = FALSE;
 
+    test_create(&gameExplorerAvailable, &gameExplorer2Available);
+
+    if(gameExplorerAvailable)
+        test_add_remove_game();
+
+    if(gameExplorer2Available)
+        test_install_uninstall_game();
+}
+
+START_TEST(gameexplorer)
+{
     if(_loadDynamicRoutines())
     {
-        r = CoInitialize( NULL );
-        ok( r == S_OK, "failed to init COM\n");
-
-        test_create(&gameExplorerAvailable, &gameExplorer2Available);
+        HRESULT hr;
 
-        if(gameExplorerAvailable)
-            test_add_remove_game();
+        hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+        ok(hr == S_OK, "Failed to initialize COM, hr %#x.\n", hr);
+        trace("Running apartment threaded tests.\n");
+        run_tests();
+        if(SUCCEEDED(hr))
+            CoUninitialize();
 
-        if(gameExplorer2Available)
-            test_install_uninstall_game();
+        hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+        ok(hr == S_OK, "Failed to initialize COM, hr %#x.\n", hr);
+        trace("Running multithreaded tests.\n");
+        run_tests();
+        if(SUCCEEDED(hr))
+            CoUninitialize();
     }
     else
         /* this is not a failure, because both procedures loaded by address
          * are always available on systems which has gameux.dll */
         win_skip("too old system, cannot load required dynamic procedures\n");
-
-
-    CoUninitialize();
 }
-- 
1.7.3.4




More information about the wine-patches mailing list