Commit 9f63253d authored by Roy Shea's avatar Roy Shea Committed by Alexandre Julliard

qmgr: Implement IBackgroundCopyManager_EnumJobs with test.

parent 00a3dceb
......@@ -120,3 +120,20 @@ static const IEnumBackgroundCopyJobsVtbl BITS_IEnumBackgroundCopyJobs_Vtbl =
BITS_IEnumBackgroundCopyJobs_Clone,
BITS_IEnumBackgroundCopyJobs_GetCount
};
HRESULT EnumBackgroundCopyJobsConstructor(LPVOID *ppObj,
IBackgroundCopyManager* copyManager)
{
EnumBackgroundCopyJobsImpl *This;
TRACE("%p, %p)\n", ppObj, copyManager);
This = HeapAlloc(GetProcessHeap(), 0, sizeof *This);
if (!This)
return E_OUTOFMEMORY;
This->lpVtbl = &BITS_IEnumBackgroundCopyJobs_Vtbl;
This->ref = 1;
*ppObj = &This->lpVtbl;
return S_OK;
}
......@@ -110,8 +110,8 @@ static HRESULT WINAPI BITS_IBackgroundCopyManager_EnumJobs(
DWORD dwFlags,
IEnumBackgroundCopyJobs **ppEnum)
{
FIXME("Not implemented\n");
return E_NOTIMPL;
TRACE("\n");
return EnumBackgroundCopyJobsConstructor((LPVOID *) ppEnum, iface);
}
static HRESULT WINAPI BITS_IBackgroundCopyManager_GetErrorDescription(
......
......@@ -84,10 +84,57 @@ static void test_CreateJob(void)
IBackgroundCopyManager_Release(manager);
}
static void test_EnumJobs(void)
{
/* Job Enumerator */
IEnumBackgroundCopyJobs* enumJobs;
static const WCHAR copyNameW[] = {'T', 'e', 's', 't', 0};
IBackgroundCopyManager *manager = NULL;
IBackgroundCopyJob *job = NULL;
HRESULT hres;
GUID tmpId;
ULONG res;
/* Setup */
hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL,
CLSCTX_LOCAL_SERVER, &IID_IBackgroundCopyManager,
(void **) &manager);
if(hres != S_OK)
{
skip("Unable to create bits instance required for test.\n");
return;
}
hres = IBackgroundCopyManager_CreateJob(manager, copyNameW,
BG_JOB_TYPE_DOWNLOAD, &tmpId,
&job);
if(hres != S_OK)
{
skip("Unable to create bits job.\n");
IBackgroundCopyManager_Release(manager);
return;
}
hres = IBackgroundCopyManager_EnumJobs(manager, 0, &enumJobs);
ok(hres == S_OK, "EnumJobs failed: %08x\n", hres);
if(hres != S_OK)
skip("Unable to create job enumerator.\n");
else
{
res = IEnumBackgroundCopyJobs_Release(enumJobs);
ok(res == 0, "Bad ref count on release: %u\n", res);
}
/* Tear down */
IBackgroundCopyJob_Release(job);
IBackgroundCopyManager_Release(manager);
}
START_TEST(qmgr)
{
CoInitialize(NULL);
test_CreateInstance();
test_CreateJob();
test_EnumJobs();
CoUninitialize();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment