qmgr: Implement IBackgroundCopyManager_EnumJobs with test.

This commit is contained in:
Roy Shea 2008-02-25 17:44:03 -08:00 committed by Alexandre Julliard
parent 00a3dceb75
commit 9f63253d00
3 changed files with 66 additions and 2 deletions

View file

@ -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;
}

View file

@ -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(

View file

@ -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();
}