bits: Implemented BITS_IBackgroundCopyJob_GetType (27/27)

Roy Shea roy at cs.hmc.edu
Fri Nov 16 18:21:38 CST 2007


---
 dlls/qmgr/job.c       |   11 +++++++++--
 dlls/qmgr/tests/job.c |   29 ++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/dlls/qmgr/job.c b/dlls/qmgr/job.c
index 8a1765f..1e21144 100644
--- a/dlls/qmgr/job.c
+++ b/dlls/qmgr/job.c
@@ -170,8 +170,15 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetType(
         IBackgroundCopyJob* iface,
         BG_JOB_TYPE *pVal)
 {
-    FIXME("Not implemented\n");
-    return E_NOTIMPL;
+    ICOM_THIS_MULTI(BackgroundCopyJobImpl, lpVtbl, iface);
+
+    if (!pVal)
+    {
+        return E_INVALIDARG;
+    }
+
+    *pVal = This->type;
+    return S_OK;
 }
 
 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetProgress(
diff --git a/dlls/qmgr/tests/job.c b/dlls/qmgr/tests/job.c
index efbb9f6..0544a04 100644
--- a/dlls/qmgr/tests/job.c
+++ b/dlls/qmgr/tests/job.c
@@ -30,6 +30,7 @@ static const WCHAR test_displayName[] = {'T', 'e', 's', 't', 0};
 static IBackgroundCopyManager* test_manager;
 static IBackgroundCopyJob* test_job;
 static GUID test_jobId;
+static BG_JOB_TYPE test_type;
 
 /* Generic test setup */
 static BOOL setup(void)
@@ -39,6 +40,7 @@ static BOOL setup(void)
     test_manager = NULL;
     test_job = NULL;
     memset(&test_jobId, 0, sizeof(GUID));
+    test_type = BG_JOB_TYPE_DOWNLOAD;
 
     hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL,
             CLSCTX_LOCAL_SERVER, &IID_IBackgroundCopyManager,
@@ -48,7 +50,7 @@ static BOOL setup(void)
         return FALSE;
     }
     hres = IBackgroundCopyManager_CreateJob(test_manager, test_displayName,
-            BG_JOB_TYPE_DOWNLOAD, &test_jobId, &test_job);
+            test_type, &test_jobId, &test_job);
     if(hres != S_OK)
     {
         IBackgroundCopyManager_Release(test_job);
@@ -88,10 +90,35 @@ static void test_GetId(void)
     teardown();
 }
 
+/* Test that the type is properly set */
+static void test_GetType(void)
+{
+    HRESULT hres;
+    BG_JOB_TYPE type;
+
+    if (!setup())
+    {
+        skip("Unable to setup test\n");
+        return;
+    }
+
+    hres = IBackgroundCopyJob_GetType(test_job, &type);
+    ok(hres == S_OK, "GetType failed: %08x\n", hres);
+    if(hres != S_OK)
+    {
+        skip("Unable to get type of test_job.\n");
+        teardown();
+        return;
+    }
+    ok(type == test_type, "Got incorrect type\n");
+    teardown();
+}
+
 START_TEST(job)
 {
     CoInitialize(NULL);
     test_GetId();
+    test_GetType();
     CoUninitialize();
 }
 
-- 
1.5.3.1




More information about the wine-patches mailing list