/* Generic test setup */ static BOOL setup(void) { HRESULT hres; GUID test_jobId; hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL, CLSCTX_LOCAL_SERVER, &IID_IBackgroundCopyManager, (void **) &test_manager); if(hres != S_OK) return FALSE; hres = IBackgroundCopyManager_CreateJob(test_manager, test_displayName, BG_JOB_TYPE_DOWNLOAD, &test_jobId, &test_job); if(hres != S_OK) { IBackgroundCopyManager_Release(test_manager); return FALSE; } if (addFileHelper(test_job, test_localNameA, test_remoteNameA) != S_OK || addFileHelper(test_job, test_localNameB, test_remoteNameB) != S_OK || IBackgroundCopyJob_EnumFiles(test_job, &test_enumFiles) != S_OK) { IBackgroundCopyJob_Release(test_job); IBackgroundCopyManager_Release(test_manager); return FALSE; } return TRUE; }
static HRESULT test_create_manager(void) { HRESULT hres; IBackgroundCopyManager *manager = NULL; /* Creating BITS instance */ hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL, CLSCTX_LOCAL_SERVER, &IID_IBackgroundCopyManager, (void **) &manager); if(hres == HRESULT_FROM_WIN32(ERROR_SERVICE_DISABLED)) { win_skip("Needed Service is disabled\n"); return hres; } if (hres == S_OK) { IBackgroundCopyJob *job; GUID jobId; hres = IBackgroundCopyManager_CreateJob(manager, test_displayName, BG_JOB_TYPE_DOWNLOAD, &jobId, &job); if (hres == S_OK) { hres = addFileHelper(job, test_localNameA, test_remoteNameA); if (hres != S_OK) win_skip("AddFile() with file:// protocol failed. Tests will be skipped.\n"); IBackgroundCopyJob_Release(job); } IBackgroundCopyManager_Release(manager); } return hres; }