mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
[MSTASK_WINETEST]
* Sync with Wine 1.7.1. CORE-7469 svn path=/trunk/; revision=60335
This commit is contained in:
parent
ee3382a831
commit
ffa1fa76dc
3 changed files with 107 additions and 5 deletions
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
add_definitions(-D__ROS_LONG64__)
|
|
||||||
|
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
task.c
|
task.c
|
||||||
task_scheduler.c
|
task_scheduler.c
|
||||||
|
@ -8,7 +6,6 @@ list(APPEND SOURCE
|
||||||
testlist.c)
|
testlist.c)
|
||||||
|
|
||||||
add_executable(mstask_winetest ${SOURCE})
|
add_executable(mstask_winetest ${SOURCE})
|
||||||
target_link_libraries(mstask_winetest wine)
|
|
||||||
set_module_type(mstask_winetest win32cui)
|
set_module_type(mstask_winetest win32cui)
|
||||||
add_importlibs(mstask_winetest ole32 msvcrt kernel32 ntdll)
|
add_importlibs(mstask_winetest ole32 user32 msvcrt kernel32)
|
||||||
add_cd_file(TARGET mstask_winetest DESTINATION reactos/bin FOR all)
|
add_cd_file(TARGET mstask_winetest DESTINATION reactos/bin FOR all)
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
static ITaskScheduler *test_task_scheduler;
|
static ITaskScheduler *test_task_scheduler;
|
||||||
|
|
||||||
|
static const WCHAR does_not_existW[] = {'\\','\\','d','o','e','s','_','n','o','t','_','e','x','i','s','t',0};
|
||||||
|
|
||||||
static void test_NewWorkItem(void)
|
static void test_NewWorkItem(void)
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
@ -102,10 +104,112 @@ static void test_Activate(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_GetTargetComputer(void)
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
WCHAR *oldname;
|
||||||
|
|
||||||
|
/* Create TaskScheduler */
|
||||||
|
hres = CoCreateInstance(&CLSID_CTaskScheduler, NULL, CLSCTX_INPROC_SERVER,
|
||||||
|
&IID_ITaskScheduler, (void **) &test_task_scheduler);
|
||||||
|
ok(hres == S_OK, "CTaskScheduler CoCreateInstance failed: %08x\n", hres);
|
||||||
|
if (hres != S_OK)
|
||||||
|
{
|
||||||
|
skip("Failed to create task scheduler.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0)
|
||||||
|
{
|
||||||
|
/* This crashes on w2k */
|
||||||
|
hres = ITaskScheduler_GetTargetComputer(test_task_scheduler, NULL);
|
||||||
|
ok(hres == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hres);
|
||||||
|
}
|
||||||
|
|
||||||
|
hres = ITaskScheduler_GetTargetComputer(test_task_scheduler, &oldname);
|
||||||
|
ok((hres == S_OK) && oldname && oldname[0] == '\\' && oldname[1] == '\\' && oldname[2],
|
||||||
|
"got 0x%x and %s (expected S_OK and an unc name)\n", hres, wine_dbgstr_w(oldname));
|
||||||
|
|
||||||
|
CoTaskMemFree(oldname);
|
||||||
|
|
||||||
|
ITaskScheduler_Release(test_task_scheduler);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_SetTargetComputer(void)
|
||||||
|
{
|
||||||
|
WCHAR buffer[MAX_COMPUTERNAME_LENGTH + 3]; /* extra space for two '\' and a zero */
|
||||||
|
DWORD len = MAX_COMPUTERNAME_LENGTH + 1; /* extra space for a zero */
|
||||||
|
WCHAR *oldname = NULL;
|
||||||
|
WCHAR *name = NULL;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
|
||||||
|
buffer[0] = '\\';
|
||||||
|
buffer[1] = '\\';
|
||||||
|
if (!GetComputerNameW(buffer + 2, &len))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Create TaskScheduler */
|
||||||
|
hres = CoCreateInstance(&CLSID_CTaskScheduler, NULL, CLSCTX_INPROC_SERVER,
|
||||||
|
&IID_ITaskScheduler, (void **) &test_task_scheduler);
|
||||||
|
ok(hres == S_OK, "CTaskScheduler CoCreateInstance failed: %08x\n", hres);
|
||||||
|
if (hres != S_OK)
|
||||||
|
{
|
||||||
|
skip("Failed to create task scheduler. Skipping tests.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hres = ITaskScheduler_GetTargetComputer(test_task_scheduler, &oldname);
|
||||||
|
ok(hres == S_OK, "got 0x%x and %s (expected S_OK)\n", hres, wine_dbgstr_w(oldname));
|
||||||
|
|
||||||
|
/* NULL is an alias for the local computer */
|
||||||
|
hres = ITaskScheduler_SetTargetComputer(test_task_scheduler, NULL);
|
||||||
|
ok(hres == S_OK, "got 0x%x (expected S_OK)\n", hres);
|
||||||
|
hres = ITaskScheduler_GetTargetComputer(test_task_scheduler, &name);
|
||||||
|
ok((hres == S_OK && !lstrcmpiW(name, buffer)),
|
||||||
|
"got 0x%x with %s (expected S_OK and %s)\n",
|
||||||
|
hres, wine_dbgstr_w(name), wine_dbgstr_w(buffer));
|
||||||
|
CoTaskMemFree(name);
|
||||||
|
|
||||||
|
/* The name must be valid */
|
||||||
|
hres = ITaskScheduler_SetTargetComputer(test_task_scheduler, does_not_existW);
|
||||||
|
ok(hres == HRESULT_FROM_WIN32(ERROR_BAD_NETPATH), "got 0x%x (expected 0x80070035)\n", hres);
|
||||||
|
/* the name of the target computer is unchanged */
|
||||||
|
hres = ITaskScheduler_GetTargetComputer(test_task_scheduler, &name);
|
||||||
|
ok((hres == S_OK && !lstrcmpiW(name, buffer)),
|
||||||
|
"got 0x%x with %s (expected S_OK and %s)\n",
|
||||||
|
hres, wine_dbgstr_w(name), wine_dbgstr_w(buffer));
|
||||||
|
CoTaskMemFree(name);
|
||||||
|
|
||||||
|
/* the two backslash are optional */
|
||||||
|
hres = ITaskScheduler_SetTargetComputer(test_task_scheduler, oldname + 2);
|
||||||
|
ok(hres == S_OK, "got 0x%x (expected S_OK)\n", hres);
|
||||||
|
|
||||||
|
/* the case is ignored */
|
||||||
|
CharUpperW(buffer);
|
||||||
|
hres = ITaskScheduler_SetTargetComputer(test_task_scheduler, buffer);
|
||||||
|
ok(hres == S_OK, "got 0x%x (expected S_OK)\n", hres);
|
||||||
|
CharLowerW(buffer);
|
||||||
|
hres = ITaskScheduler_SetTargetComputer(test_task_scheduler, buffer);
|
||||||
|
ok(hres == S_OK, "got 0x%x (expected S_OK)\n", hres);
|
||||||
|
|
||||||
|
/* cleanup */
|
||||||
|
hres = ITaskScheduler_SetTargetComputer(test_task_scheduler, oldname);
|
||||||
|
ok(hres == S_OK, "got 0x%x (expected S_OK)\n", hres);
|
||||||
|
|
||||||
|
CoTaskMemFree(oldname);
|
||||||
|
ITaskScheduler_Release(test_task_scheduler);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
START_TEST(task_scheduler)
|
START_TEST(task_scheduler)
|
||||||
{
|
{
|
||||||
CoInitialize(NULL);
|
CoInitialize(NULL);
|
||||||
test_NewWorkItem();
|
test_NewWorkItem();
|
||||||
test_Activate();
|
test_Activate();
|
||||||
|
test_GetTargetComputer();
|
||||||
|
test_SetTargetComputer();
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,7 +303,8 @@ static void test_SetTrigger_GetTrigger(void)
|
||||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
|
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
|
||||||
normal_trigger_state.MinutesDuration = 5;
|
normal_trigger_state.MinutesDuration = 5;
|
||||||
normal_trigger_state.MinutesInterval = 0;
|
normal_trigger_state.MinutesInterval = 0;
|
||||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
|
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||||
|
ok(hres == S_OK, "Failed to set trigger: 0x%08x\n", hres);
|
||||||
normal_trigger_state.MinutesDuration = 0;
|
normal_trigger_state.MinutesDuration = 0;
|
||||||
normal_trigger_state.MinutesInterval = 0;
|
normal_trigger_state.MinutesInterval = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue