qmgr: Implement IBackgroundCopyJob_Resume.
This commit is contained in:
parent
5637c779d2
commit
eb70436993
|
@ -119,8 +119,25 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_Suspend(
|
|||
static HRESULT WINAPI BITS_IBackgroundCopyJob_Resume(
|
||||
IBackgroundCopyJob* iface)
|
||||
{
|
||||
FIXME("Not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
|
||||
|
||||
if (This->state == BG_JOB_STATE_CANCELLED
|
||||
|| This->state == BG_JOB_STATE_ACKNOWLEDGED)
|
||||
{
|
||||
return BG_E_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (This->jobProgress.FilesTransferred == This->jobProgress.FilesTotal)
|
||||
return BG_E_EMPTY;
|
||||
|
||||
if (This->state == BG_JOB_STATE_CONNECTING
|
||||
|| This->state == BG_JOB_STATE_TRANSFERRING)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
This->state = BG_JOB_STATE_QUEUED;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyJob_Cancel(
|
||||
|
@ -188,8 +205,13 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetState(
|
|||
IBackgroundCopyJob* iface,
|
||||
BG_JOB_STATE *pVal)
|
||||
{
|
||||
FIXME("Not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
|
||||
|
||||
if (!pVal)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*pVal = This->state;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetError(
|
||||
|
@ -446,6 +468,8 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
|
|||
This->jobProgress.FilesTotal = 0;
|
||||
This->jobProgress.FilesTransferred = 0;
|
||||
|
||||
This->state = BG_JOB_STATE_SUSPENDED;
|
||||
|
||||
*ppObj = &This->lpVtbl;
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ typedef struct
|
|||
GUID jobId;
|
||||
struct list files;
|
||||
BG_JOB_PROGRESS jobProgress;
|
||||
BG_JOB_STATE state;
|
||||
struct list entryFromQmgr;
|
||||
} BackgroundCopyJobImpl;
|
||||
|
||||
|
|
|
@ -239,6 +239,47 @@ static void test_GetProgress_preTransfer(void)
|
|||
ok(progress.FilesTransferred == 0, "Incorrect FilesTransferred %u\n", progress.FilesTransferred);
|
||||
}
|
||||
|
||||
/* Test getting job state */
|
||||
static void test_GetState(void)
|
||||
{
|
||||
HRESULT hres;
|
||||
BG_JOB_STATE state;
|
||||
|
||||
state = BG_JOB_STATE_ERROR;
|
||||
hres = IBackgroundCopyJob_GetState(test_job, &state);
|
||||
ok(hres == S_OK, "GetState failed: 0x%08x\n", hres);
|
||||
if (hres != S_OK)
|
||||
{
|
||||
skip("Unable to get job state\n");
|
||||
return;
|
||||
}
|
||||
ok(state == BG_JOB_STATE_SUSPENDED, "Incorrect job state: %d\n", state);
|
||||
}
|
||||
|
||||
/* Test resuming a job */
|
||||
static void test_ResumeEmpty(void)
|
||||
{
|
||||
HRESULT hres;
|
||||
BG_JOB_STATE state;
|
||||
|
||||
hres = IBackgroundCopyJob_Resume(test_job);
|
||||
ok(hres == BG_E_EMPTY, "Resume failed to return BG_E_EMPTY error: 0x%08x\n", hres);
|
||||
if (hres != BG_E_EMPTY)
|
||||
{
|
||||
skip("Failed calling resume job\n");
|
||||
return;
|
||||
}
|
||||
|
||||
state = BG_JOB_STATE_ERROR;
|
||||
hres = IBackgroundCopyJob_GetState(test_job, &state);
|
||||
if (hres != S_OK)
|
||||
{
|
||||
skip("Unable to get job state\n");
|
||||
return;
|
||||
}
|
||||
ok(state == BG_JOB_STATE_SUSPENDED, "Incorrect job state: %d\n", state);
|
||||
}
|
||||
|
||||
typedef void (*test_t)(void);
|
||||
|
||||
START_TEST(job)
|
||||
|
@ -250,6 +291,8 @@ START_TEST(job)
|
|||
test_AddFile,
|
||||
test_EnumFiles,
|
||||
test_GetProgress_preTransfer,
|
||||
test_GetState,
|
||||
test_ResumeEmpty,
|
||||
0
|
||||
};
|
||||
const test_t *test;
|
||||
|
|
Loading…
Reference in New Issue