Author: akhaldi Date: Sat Apr 26 18:06:03 2014 New Revision: 62999
URL: http://svn.reactos.org/svn/reactos?rev=62999&view=rev Log: [QMGR_WINETEST] * Sync with Wine 1.7.17. CORE-8080
Modified: trunk/rostests/winetests/qmgr/CMakeLists.txt trunk/rostests/winetests/qmgr/enum_files.c trunk/rostests/winetests/qmgr/enum_jobs.c trunk/rostests/winetests/qmgr/file.c trunk/rostests/winetests/qmgr/job.c trunk/rostests/winetests/qmgr/qmgr.c
Modified: trunk/rostests/winetests/qmgr/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/qmgr/CMakeLists.... ============================================================================== --- trunk/rostests/winetests/qmgr/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/winetests/qmgr/CMakeLists.txt [iso-8859-1] Sat Apr 26 18:06:03 2014 @@ -9,5 +9,8 @@
add_executable(qmgr_winetest ${SOURCE}) set_module_type(qmgr_winetest win32cui) -add_importlibs(qmgr_winetest ole32 shlwapi user32 msvcrt kernel32 ntdll) +add_importlibs(qmgr_winetest ole32 shlwapi user32 msvcrt kernel32) +if(MSVC) + add_importlibs(qmgr_winetest ntdll) +endif() add_cd_file(TARGET qmgr_winetest DESTINATION reactos/bin FOR all)
Modified: trunk/rostests/winetests/qmgr/enum_files.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/qmgr/enum_files.... ============================================================================== --- trunk/rostests/winetests/qmgr/enum_files.c [iso-8859-1] (original) +++ trunk/rostests/winetests/qmgr/enum_files.c [iso-8859-1] Sat Apr 26 18:06:03 2014 @@ -66,7 +66,40 @@ urlSize = MAX_PATH; UrlCreateFromPathW(remoteFile, remoteUrl, &urlSize, 0); UrlUnescapeW(remoteUrl, NULL, &urlSize, URL_UNESCAPE_INPLACE); - return IBackgroundCopyJob_AddFile(test_job, remoteUrl, localFile); + return IBackgroundCopyJob_AddFile(job, remoteUrl, localFile); +} + +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; }
/* Generic test setup */ @@ -118,11 +151,6 @@
hres = IEnumBackgroundCopyFiles_GetCount(test_enumFiles, &fileCount); ok(hres == S_OK, "GetCount failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Unable to get count from test_enumFiles.\n"); - return; - } ok(fileCount == test_fileCount, "Got incorrect count\n"); }
@@ -138,11 +166,6 @@ { hres = IEnumBackgroundCopyFiles_Next(test_enumFiles, 1, &file, NULL); ok(hres == S_OK, "Next failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Unable to get file from test_enumFiles\n"); - return; - } IBackgroundCopyFile_Release(file); }
@@ -166,11 +189,6 @@ fetched = 0; hres = IEnumBackgroundCopyFiles_Next(test_enumFiles, 1, &file, &fetched); ok(hres == S_OK, "Next failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Unable to get file from test_enumFiles\n"); - return; - } ok(fetched == 1, "Next returned the incorrect number of files: %08x\n", hres); ok(file != NULL, "Next returned NULL\n"); if (file) @@ -198,11 +216,6 @@ fetched = 0; hres = IEnumBackgroundCopyFiles_Next(test_enumFiles, test_fileCount, files, &fetched); ok(hres == S_OK, "Next failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Unable to get file from test_enumFiles\n"); - return; - } ok(fetched == test_fileCount, "Next returned the incorrect number of files: %08x\n", hres);
for (i = 0; i < test_fileCount; i++) @@ -234,11 +247,6 @@ { hres = IEnumBackgroundCopyFiles_Skip(test_enumFiles, 1); ok(hres == S_OK, "Skip failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Unable to properly Skip files\n"); - return; - } }
hres = IEnumBackgroundCopyFiles_Skip(test_enumFiles, 1); @@ -263,11 +271,6 @@ ok(hres == S_OK, "Skip failed: %08x\n", hres); hres = IEnumBackgroundCopyFiles_Reset(test_enumFiles); ok(hres == S_OK, "Reset failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Unable to Reset enumerator\n"); - return; - } hres = IEnumBackgroundCopyFiles_Skip(test_enumFiles, test_fileCount); ok(hres == S_OK, "Reset failed: %08x\n", hres); } @@ -288,14 +291,23 @@ 0 }; const test_t *test; + int i;
CoInitialize(NULL); - for (test = tests; *test; ++test) + + if (FAILED(test_create_manager())) + { + CoUninitialize(); + win_skip("Failed to create Manager instance, skipping tests\n"); + return; + } + + for (test = tests, i = 0; *test; ++test, ++i) { /* Keep state separate between tests. */ if (!setup()) { - skip("Unable to setup test\n"); + ok(0, "tests:%d: Unable to setup test\n", i); break; } (*test)();
Modified: trunk/rostests/winetests/qmgr/enum_jobs.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/qmgr/enum_jobs.c... ============================================================================== --- trunk/rostests/winetests/qmgr/enum_jobs.c [iso-8859-1] (original) +++ trunk/rostests/winetests/qmgr/enum_jobs.c [iso-8859-1] Sat Apr 26 18:06:03 2014 @@ -118,19 +118,9 @@
hres = IEnumBackgroundCopyJobs_GetCount(test_enumJobsA, &jobCountA); ok(hres == S_OK, "GetCount failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Couldn't get job count\n"); - return; - }
hres = IEnumBackgroundCopyJobs_GetCount(test_enumJobsB, &jobCountB); ok(hres == S_OK, "GetCount failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Couldn't get job count\n"); - return; - }
ok(jobCountB == jobCountA + 1, "Got incorrect count\n"); } @@ -147,11 +137,6 @@ { hres = IEnumBackgroundCopyJobs_Next(test_enumJobsB, 1, &job, NULL); ok(hres == S_OK, "Next failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Unable to get job from Next\n"); - return; - } IBackgroundCopyJob_Release(job); }
@@ -174,11 +159,6 @@ fetched = 0; hres = IEnumBackgroundCopyJobs_Next(test_enumJobsB, 1, &job, &fetched); ok(hres == S_OK, "Next failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Unable to get job from Next\n"); - return; - } ok(fetched == 1, "Next returned the incorrect number of jobs: %08x\n", hres); IBackgroundCopyJob_Release(job); } @@ -199,24 +179,12 @@ ULONG i;
jobs = HeapAlloc(GetProcessHeap(), 0, test_jobCountB * sizeof *jobs); - if (!jobs) - { - skip("Couldn't allocate memory\n"); - return; - } - for (i = 0; i < test_jobCountB; i++) jobs[i] = NULL;
fetched = 0; hres = IEnumBackgroundCopyJobs_Next(test_enumJobsB, test_jobCountB, jobs, &fetched); ok(hres == S_OK, "Next failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Unable to get file from test_enumJobs\n"); - HeapFree(GetProcessHeap(), 0, jobs); - return; - } ok(fetched == test_jobCountB, "Next returned the incorrect number of jobs: %08x\n", hres);
for (i = 0; i < test_jobCountB; i++) @@ -250,11 +218,6 @@ { hres = IEnumBackgroundCopyJobs_Skip(test_enumJobsB, 1); ok(hres == S_OK, "Skip failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Unable to properly Skip jobs\n"); - return; - } }
hres = IEnumBackgroundCopyJobs_Skip(test_enumJobsB, 1); @@ -277,19 +240,9 @@
hres = IEnumBackgroundCopyJobs_Skip(test_enumJobsB, test_jobCountB); ok(hres == S_OK, "Skip failed: %08x\n", hres); - if (hres != S_OK) - { - skip("Skip failed\n"); - return; - }
hres = IEnumBackgroundCopyJobs_Reset(test_enumJobsB); ok(hres == S_OK, "Reset failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Unable to Reset enumerator\n"); - return; - }
hres = IEnumBackgroundCopyJobs_Skip(test_enumJobsB, test_jobCountB); ok(hres == S_OK, "Reset failed: %08x\n", hres); @@ -311,15 +264,16 @@ 0 }; const test_t *test; + int i;
CoInitialize(NULL); - for (test = tests; *test; ++test) + for (test = tests, i = 0; *test; ++test, ++i) { /* Keep state separate between tests */ if (!setup()) { teardown(); - skip("Unable to setup test\n"); + ok(0, "tests:%d: Unable to setup test\n", i); break; } (*test)();
Modified: trunk/rostests/winetests/qmgr/file.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/qmgr/file.c?rev=... ============================================================================== --- trunk/rostests/winetests/qmgr/file.c [iso-8859-1] (original) +++ trunk/rostests/winetests/qmgr/file.c [iso-8859-1] Sat Apr 26 18:06:03 2014 @@ -65,7 +65,41 @@ urlSize = MAX_PATH; UrlCreateFromPathW(test_remoteUrl, test_remoteUrl, &urlSize, 0); UrlUnescapeW(test_remoteUrl, NULL, &urlSize, URL_UNESCAPE_INPLACE); - return IBackgroundCopyJob_AddFile(test_job, test_remoteUrl, test_localFile); + + return IBackgroundCopyJob_AddFile(job, test_remoteUrl, test_localFile); +} + +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_localName, test_remoteName); + if (hres != S_OK) + win_skip("AddFile() with file:// protocol failed. Tests will be skipped.\n"); + IBackgroundCopyJob_Release(job); + } + IBackgroundCopyManager_Release(manager); + } + + return hres; }
/* Generic test setup */ @@ -129,11 +163,6 @@
hres = IBackgroundCopyFile_GetRemoteName(test_file, &name); ok(hres == S_OK, "GetRemoteName failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Unable to get remote name of test_file.\n"); - return; - } ok(lstrcmpW(name, test_remoteUrl) == 0, "Got incorrect remote name\n"); CoTaskMemFree(name); } @@ -146,11 +175,6 @@
hres = IBackgroundCopyFile_GetLocalName(test_file, &name); ok(hres == S_OK, "GetLocalName failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Unable to get local name of test_file.\n"); - return; - } ok(lstrcmpW(name, test_localFile) == 0, "Got incorrect local name\n"); CoTaskMemFree(name); } @@ -163,11 +187,6 @@
hres = IBackgroundCopyFile_GetProgress(test_file, &progress); ok(hres == S_OK, "GetProgress failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Unable to get progress of test_file.\n"); - return; - } ok(progress.BytesTotal == BG_SIZE_UNKNOWN, "Got incorrect total size: %x%08x\n", (DWORD)(progress.BytesTotal >> 32), (DWORD)progress.BytesTotal); ok(progress.BytesTransferred == 0, "Got incorrect number of transferred bytes: %x%08x\n", @@ -186,14 +205,23 @@ 0 }; const test_t *test; + int i;
CoInitialize(NULL); - for (test = tests; *test; ++test) + + if (FAILED(test_create_manager())) + { + CoUninitialize(); + win_skip("Failed to create Manager instance, skipping tests\n"); + return; + } + + for (test = tests, i = 0; *test; ++test, ++i) { /* Keep state separate between tests. */ if (!setup()) { - skip("Unable to setup test\n"); + ok(0, "tests:%d: Unable to setup test\n", i); break; } (*test)();
Modified: trunk/rostests/winetests/qmgr/job.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/qmgr/job.c?rev=6... ============================================================================== --- trunk/rostests/winetests/qmgr/job.c [iso-8859-1] (original) +++ trunk/rostests/winetests/qmgr/job.c [iso-8859-1] Sat Apr 26 18:06:03 2014 @@ -42,7 +42,27 @@ static GUID test_jobId; static BG_JOB_TYPE test_type;
-static VOID init_paths(void) +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) + IBackgroundCopyManager_Release(manager); + + return hres; +} + +static void init_paths(void) { WCHAR tmpDir[MAX_PATH]; WCHAR prefix[] = {'q', 'm', 'g', 'r', 0}; @@ -141,11 +161,6 @@
hres = IBackgroundCopyJob_GetId(test_job, &tmpId); ok(hres == S_OK, "GetId failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Unable to get ID of test_job.\n"); - return; - } ok(memcmp(&tmpId, &test_jobId, sizeof tmpId) == 0, "Got incorrect GUID\n"); }
@@ -157,11 +172,6 @@
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"); - return; - } ok(type == test_type, "Got incorrect type\n"); }
@@ -173,11 +183,6 @@
hres = IBackgroundCopyJob_GetDisplayName(test_job, &displayName); ok(hres == S_OK, "GetName failed: %08x\n", hres); - if(hres != S_OK) - { - skip("Unable to get display name of test_job.\n"); - return; - } ok(lstrcmpW(displayName, test_displayName) == 0, "Got incorrect type\n"); CoTaskMemFree(displayName); } @@ -190,11 +195,6 @@ hres = IBackgroundCopyJob_AddFile(test_job, test_remotePathA, test_localPathA); ok(hres == S_OK, "First call to AddFile failed: 0x%08x\n", hres); - if (hres != S_OK) - { - skip("Unable to add first file to job\n"); - return; - }
hres = IBackgroundCopyJob_AddFile(test_job, test_remotePathB, test_localPathB); @@ -223,19 +223,10 @@
hres = IBackgroundCopyJob_AddFile(test_job, test_remotePathA, test_localPathA); - if (hres != S_OK) - { - skip("Unable to add file to job\n"); - return; - } + ok(hres == S_OK, "got 0x%08x\n", hres);
hres = IBackgroundCopyJob_EnumFiles(test_job, &enumFiles); ok(hres == S_OK, "EnumFiles failed: 0x%08x\n", hres); - if(hres != S_OK) - { - skip("Unable to create file enumerator.\n"); - return; - }
res = IEnumBackgroundCopyFiles_Release(enumFiles); ok(res == 0, "Bad ref count on release: %u\n", res); @@ -249,12 +240,6 @@
hres = IBackgroundCopyJob_GetProgress(test_job, &progress); ok(hres == S_OK, "GetProgress failed: 0x%08x\n", hres); - if (hres != S_OK) - { - skip("Unable to get job progress\n"); - teardown(); - return; - }
ok(progress.BytesTotal == 0, "Incorrect BytesTotal: %x%08x\n", (DWORD)(progress.BytesTotal >> 32), (DWORD)progress.BytesTotal); @@ -273,11 +258,6 @@ 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); }
@@ -289,19 +269,10 @@
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(hres == S_OK, "got 0x%08x\n", hres); ok(state == BG_JOB_STATE_SUSPENDED, "Incorrect job state: %d\n", state); }
@@ -359,19 +330,11 @@
hres = IBackgroundCopyJob_AddFile(test_job, test_remotePathA, test_localPathA); - if (hres != S_OK) - { - skip("Unable to add file to job\n"); - return; - } + ok(hres == S_OK, "got 0x%08x\n", hres);
hres = IBackgroundCopyJob_AddFile(test_job, test_remotePathB, test_localPathB); - if (hres != S_OK) - { - skip("Unable to add file to job\n"); - return; - } + ok(hres == S_OK, "got 0x%08x\n", hres);
hres = IBackgroundCopyJob_Resume(test_job); ok(hres == S_OK, "IBackgroundCopyJob_Resume\n"); @@ -437,22 +400,10 @@ lstrcatW(urlB, test_remotePathB);
hres = IBackgroundCopyJob_AddFile(test_job, urlA, test_localPathA); - if (hres != S_OK) - { - skip("Unable to add file to job\n"); - HeapFree(GetProcessHeap(), 0, urlA); - HeapFree(GetProcessHeap(), 0, urlB); - return; - } + ok(hres == S_OK, "got 0x%08x\n", hres);
hres = IBackgroundCopyJob_AddFile(test_job, urlB, test_localPathB); - if (hres != S_OK) - { - skip("Unable to add file to job\n"); - HeapFree(GetProcessHeap(), 0, urlA); - HeapFree(GetProcessHeap(), 0, urlB); - return; - } + ok(hres == S_OK, "got 0x%08x\n", hres);
hres = IBackgroundCopyJob_Resume(test_job); ok(hres == S_OK, "IBackgroundCopyJob_Resume\n"); @@ -488,6 +439,29 @@ HeapFree(GetProcessHeap(), 0, urlB); }
+static void test_NotifyFlags(void) +{ + ULONG flags; + HRESULT hr; + + /* check default flags */ + flags = 0; + hr = IBackgroundCopyJob_GetNotifyFlags(test_job, &flags); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(flags == (BG_NOTIFY_JOB_ERROR | BG_NOTIFY_JOB_TRANSFERRED), "flags 0x%08x\n", flags); +} + +static void test_NotifyInterface(void) +{ + HRESULT hr; + IUnknown *unk; + + unk = (IUnknown*)0xdeadbeef; + hr = IBackgroundCopyJob_GetNotifyInterface(test_job, &unk); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(unk == NULL, "got %p\n", unk); +} + typedef void (*test_t)(void);
START_TEST(job) @@ -499,6 +473,8 @@ test_GetProgress_preTransfer, test_GetState, test_ResumeEmpty, + test_NotifyFlags, + test_NotifyInterface, 0 }; static const test_t tests_bits20[] = { @@ -510,17 +486,25 @@ 0 }; const test_t *test; + int i;
init_paths();
CoInitialize(NULL);
- for (test = tests; *test; ++test) + if (FAILED(test_create_manager())) + { + CoUninitialize(); + win_skip("Failed to create Manager instance, skipping tests\n"); + return; + } + + for (test = tests, i = 0; *test; ++test, ++i) { /* Keep state separate between tests. */ if (!setup()) { - skip("Unable to setup test\n"); + ok(0, "tests:%d: Unable to setup test\n", i); break; } (*test)(); @@ -529,12 +513,12 @@
if (check_bits20()) { - for (test = tests_bits20; *test; ++test) + for (test = tests_bits20, i = 0; *test; ++test, ++i) { /* Keep state separate between tests. */ if (!setup()) { - skip("Unable to setup test\n"); + ok(0, "tests_bits20:%d: Unable to setup test\n", i); break; } (*test)();
Modified: trunk/rostests/winetests/qmgr/qmgr.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/qmgr/qmgr.c?rev=... ============================================================================== --- trunk/rostests/winetests/qmgr/qmgr.c [iso-8859-1] (original) +++ trunk/rostests/winetests/qmgr/qmgr.c [iso-8859-1] Sat Apr 26 18:06:03 2014 @@ -35,31 +35,24 @@
static WCHAR progname[MAX_PATH];
-static void -test_CreateInstance(void) -{ - HRESULT hres; - ULONG res; +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)) { - skip("Needed Service is disabled\n"); - return; - } - ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres); - if(hres != S_OK) { - skip("Unable to create bits instance.\n"); - return; - } - - /* Releasing bits manager */ - res = IBackgroundCopyManager_Release(manager); - ok(res == 0, "Bad ref count on release: %u\n", res); - + if(hres == HRESULT_FROM_WIN32(ERROR_SERVICE_DISABLED)) { + win_skip("Needed Service is disabled\n"); + return hres; + } + + if (hres == S_OK) + IBackgroundCopyManager_Release(manager); + + return hres; }
static void test_CreateJob(void) @@ -76,25 +69,16 @@ 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; - } + ok(hres == S_OK, "got 0x%08x\n", hres);
/* Create bits job */ hres = IBackgroundCopyManager_CreateJob(manager, copyNameW, BG_JOB_TYPE_DOWNLOAD, &tmpId, &job); ok(hres == S_OK, "CreateJob failed: %08x\n", hres); - if(hres != S_OK) - skip("Unable to create bits job.\n"); - else - { - res = IBackgroundCopyJob_Release(job); - ok(res == 0, "Bad ref count on release: %u\n", res); - } - + + res = IBackgroundCopyJob_Release(job); + ok(res == 0, "Bad ref count on release: %u\n", res); IBackgroundCopyManager_Release(manager); }
@@ -108,36 +92,21 @@ 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; - } + ok(hres == S_OK, "got 0x%08x\n", hres); + 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; - } + ok(hres == S_OK, "got 0x%08x\n", hres);
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); - } + IEnumBackgroundCopyJobs_Release(enumJobs);
/* Tear down */ IBackgroundCopyJob_Release(job); @@ -171,11 +140,7 @@ 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; - } + ok(hres == S_OK, "got 0x%08x\n", hres);
MultiByteToWideChar(CP_ACP, 0, secretA, -1, secretW, MAX_PATH); hres = IBackgroundCopyManager_CreateJob(manager, secretW, @@ -195,11 +160,7 @@ 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; - } + ok(hres == S_OK, "got 0x%08x\n", hres);
wsprintfW(secretName, format, GetTickCount()); run_child(secretName); @@ -226,8 +187,8 @@ CoTaskMemFree(name); IBackgroundCopyJob_Release(job); } - hres = IEnumBackgroundCopyJobs_Release(enumJobs); - ok(hres == S_OK, "Release failed: %08x\n", hres); + + IEnumBackgroundCopyJobs_Release(enumJobs); ok(found, "Adding a job in another process failed\n"); }
@@ -241,11 +202,18 @@ MultiByteToWideChar(CP_ACP, 0, argv[0], -1, progname, MAX_PATH);
CoInitialize(NULL); + + if (FAILED(test_create_manager())) + { + win_skip("Failed to create Manager instance, skipping tests\n"); + CoUninitialize(); + return; + } + if (argc == 3) do_child(argv[2]); else { - test_CreateInstance(); test_CreateJob(); test_EnumJobs(); test_globalness();