Author: akhaldi
Date: Mon Sep 23 11:34:12 2013
New Revision: 60335
URL:
http://svn.reactos.org/svn/reactos?rev=60335&view=rev
Log:
[MSTASK_WINETEST]
* Sync with Wine 1.7.1.
CORE-7469
Modified:
trunk/rostests/winetests/mstask/CMakeLists.txt
trunk/rostests/winetests/mstask/task_scheduler.c
trunk/rostests/winetests/mstask/task_trigger.c
Modified: trunk/rostests/winetests/mstask/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/mstask/CMakeLis…
==============================================================================
--- trunk/rostests/winetests/mstask/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/winetests/mstask/CMakeLists.txt [iso-8859-1] Mon Sep 23 11:34:12 2013
@@ -1,5 +1,3 @@
-
-add_definitions(-D__ROS_LONG64__)
list(APPEND SOURCE
task.c
@@ -8,7 +6,6 @@
testlist.c)
add_executable(mstask_winetest ${SOURCE})
-target_link_libraries(mstask_winetest wine)
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)
Modified: trunk/rostests/winetests/mstask/task_scheduler.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/mstask/task_sch…
==============================================================================
--- trunk/rostests/winetests/mstask/task_scheduler.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/mstask/task_scheduler.c [iso-8859-1] Mon Sep 23 11:34:12
2013
@@ -28,6 +28,8 @@
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)
{
HRESULT hres;
@@ -102,10 +104,112 @@
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)
{
CoInitialize(NULL);
test_NewWorkItem();
test_Activate();
+ test_GetTargetComputer();
+ test_SetTargetComputer();
CoUninitialize();
}
Modified: trunk/rostests/winetests/mstask/task_trigger.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/mstask/task_tri…
==============================================================================
--- trunk/rostests/winetests/mstask/task_trigger.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/mstask/task_trigger.c [iso-8859-1] Mon Sep 23 11:34:12 2013
@@ -303,7 +303,8 @@
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
normal_trigger_state.MinutesDuration = 5;
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.MinutesInterval = 0;