taskschd/tests: Add more various tests.
This commit is contained in:
parent
ce1175149b
commit
1c778d91bd
|
@ -2173,6 +2173,8 @@ static HRESULT WINAPI TaskDefinition_put_XmlText(ITaskDefinition *iface, BSTR xm
|
|||
|
||||
TRACE("%p,%s\n", iface, debugstr_w(xml));
|
||||
|
||||
if (!xml) return E_INVALIDARG;
|
||||
|
||||
hmem = GlobalAlloc(0, lstrlenW(xml) * sizeof(WCHAR));
|
||||
if (!hmem) return E_OUTOFMEMORY;
|
||||
|
||||
|
|
|
@ -81,8 +81,8 @@ static void test_Connect(void)
|
|||
|
||||
V_BSTR(&v_comp) = SysAllocString(deadbeefW);
|
||||
hr = ITaskService_Connect(service, v_comp, v_null, v_null, v_null);
|
||||
todo_wine
|
||||
ok(hr == HRESULT_FROM_WIN32(RPC_S_INVALID_NET_ADDR), "expected RPC_S_INVALID_NET_ADDR, got %#x\n", hr);
|
||||
ok(hr == HRESULT_FROM_WIN32(RPC_S_INVALID_NET_ADDR) || hr == HRESULT_FROM_WIN32(ERROR_BAD_NETPATH) /* VM */,
|
||||
"expected RPC_S_INVALID_NET_ADDR, got %#x\n", hr);
|
||||
SysFreeString(V_BSTR(&v_comp));
|
||||
|
||||
vbool = 0xdead;
|
||||
|
@ -340,6 +340,10 @@ todo_wine
|
|||
|
||||
ITaskFolder_Release(subfolder);
|
||||
|
||||
hr = ITaskFolder_DeleteFolder(folder, Wine, 0);
|
||||
todo_wine
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_DIR_NOT_EMPTY), "expected ERROR_DIR_NOT_EMPTY, got %#x\n", hr);
|
||||
|
||||
hr = ITaskFolder_DeleteFolder(folder, Wine_Folder1_Folder2, 0);
|
||||
ok(hr == S_OK, "DeleteFolder error %#x\n", hr);
|
||||
ITaskFolder_DeleteFolder(folder, Wine_Folder1+1, 0);
|
||||
|
@ -816,6 +820,15 @@ todo_wine
|
|||
ok(hr == S_OK, "get_Enabled error %#x\n", hr);
|
||||
ok(vbool == VARIANT_FALSE, "expected VARIANT_FALSE, got %d\n", vbool);
|
||||
|
||||
hr = IRegisteredTask_put_Enabled(task1, VARIANT_TRUE);
|
||||
ok(hr == S_OK, "put_Enabled error %#x\n", hr);
|
||||
hr = IRegisteredTask_get_State(task1, &state);
|
||||
ok(hr == S_OK, "get_State error %#x\n", hr);
|
||||
ok(state == TASK_STATE_READY, "expected TASK_STATE_READY, got %d\n", state);
|
||||
hr = IRegisteredTask_get_Enabled(task1, &vbool);
|
||||
ok(hr == S_OK, "get_Enabled error %#x\n", hr);
|
||||
ok(vbool == VARIANT_TRUE, "expected VARIANT_TRUE, got %d\n", vbool);
|
||||
|
||||
IRegisteredTask_Release(task1);
|
||||
|
||||
hr = ITaskFolder_GetTask(folder, Task2, &task2);
|
||||
|
@ -1076,6 +1089,85 @@ todo_wine
|
|||
|
||||
static void test_TaskDefinition(void)
|
||||
{
|
||||
static const char xml1[] =
|
||||
"<Task xmlns=\"http://schemas.microsoft.com/windows/2004/02/mit/task\">\n"
|
||||
" <RegistrationInfo>\n"
|
||||
" <Description>\"Task1\"</Description>\n"
|
||||
" </RegistrationInfo>\n"
|
||||
" <Settings>\n"
|
||||
" <Enabled>false</Enabled>\n"
|
||||
" <Hidden>false</Hidden>\n"
|
||||
" </Settings>\n"
|
||||
" <Actions>\n"
|
||||
" <Exec>\n"
|
||||
" <Command>\"task1.exe\"</Command>\n"
|
||||
" </Exec>\n"
|
||||
" </Actions>\n"
|
||||
"</Task>\n";
|
||||
static const char xml2[] =
|
||||
"<Task>\n"
|
||||
" <RegistrationInfo>\n"
|
||||
" <Description>\"Task1\"</Description>\n"
|
||||
" </RegistrationInfo>\n"
|
||||
" <Settings>\n"
|
||||
" <Enabled>false</Enabled>\n"
|
||||
" <Hidden>false</Hidden>\n"
|
||||
" </Settings>\n"
|
||||
" <Actions>\n"
|
||||
" <Exec>\n"
|
||||
" <Command>\"task1.exe\"</Command>\n"
|
||||
" </Exec>\n"
|
||||
" </Actions>\n"
|
||||
"</Task>\n";
|
||||
static const char xml3[] =
|
||||
"<TASK>\n"
|
||||
" <RegistrationInfo>\n"
|
||||
" <Description>\"Task1\"</Description>\n"
|
||||
" </RegistrationInfo>\n"
|
||||
" <Settings>\n"
|
||||
" <Enabled>false</Enabled>\n"
|
||||
" <Hidden>false</Hidden>\n"
|
||||
" </Settings>\n"
|
||||
" <Actions>\n"
|
||||
" <Exec>\n"
|
||||
" <Command>\"task1.exe\"</Command>\n"
|
||||
" </Exec>\n"
|
||||
" </Actions>\n"
|
||||
"</TASK>\n";
|
||||
static const char xml4[] =
|
||||
"<Task xmlns=\"http://schemas.microsoft.com/windows/2004/02/mit/task\">\n"
|
||||
" <RegistrationInfo/>\n"
|
||||
" <Settings/>\n"
|
||||
" <Actions>\n"
|
||||
" <Exec>\n"
|
||||
" <Command>\"task1.exe\"</Command>\n"
|
||||
" </Exec>\n"
|
||||
" </Actions>\n"
|
||||
"</Task>\n";
|
||||
static const char xml5[] =
|
||||
"<Task xmlns=\"http://schemas.microsoft.com/windows/2004/02/mit/task\">\n"
|
||||
" <RegistrationInfo/>\n"
|
||||
" <Settings/>\n"
|
||||
" <Actions/>\n"
|
||||
"</Task>\n";
|
||||
static const char xml6[] =
|
||||
"<Task xmlns=\"http://schemas.microsoft.com/windows/2004/02/mit/task\">\n"
|
||||
" <RegistrationInfo/>\n"
|
||||
" <Settings/>\n"
|
||||
" <Actions>\n"
|
||||
"</Task>\n";
|
||||
static const char xml7[] =
|
||||
"<Task xmlns=\"http://schemas.microsoft.com/windows/2004/02/mit/task\">\n"
|
||||
" <RegistrationInfo/>\n"
|
||||
" <Settings>\n"
|
||||
" <Enabled>FALSE</Enabled>\n"
|
||||
" </Settings>\n"
|
||||
" <Actions>\n"
|
||||
" <Exec>\n"
|
||||
" <Command>\"task1.exe\"</Command>\n"
|
||||
" </Exec>\n"
|
||||
" </Actions>\n"
|
||||
"</Task>\n";
|
||||
static struct settings def_settings = { { 0 }, { 'P','T','7','2','H',0 }, { 0 },
|
||||
0, 7, TASK_INSTANCES_IGNORE_NEW, TASK_COMPATIBILITY_V2, VARIANT_TRUE, VARIANT_TRUE,
|
||||
VARIANT_TRUE, VARIANT_TRUE, VARIANT_FALSE, VARIANT_FALSE, VARIANT_TRUE, VARIANT_FALSE,
|
||||
|
@ -1085,10 +1177,10 @@ static void test_TaskDefinition(void)
|
|||
VARIANT_FALSE, VARIANT_FALSE, VARIANT_TRUE, VARIANT_TRUE, VARIANT_FALSE, VARIANT_TRUE,
|
||||
VARIANT_TRUE, VARIANT_TRUE };
|
||||
HRESULT hr;
|
||||
VARIANT v_null;
|
||||
ITaskService *service;
|
||||
ITaskDefinition *taskdef;
|
||||
BSTR xml;
|
||||
WCHAR xmlW[sizeof(xml1)];
|
||||
|
||||
hr = CoCreateInstance(&CLSID_TaskScheduler, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskService, (void **)&service);
|
||||
if (hr != S_OK)
|
||||
|
@ -1097,8 +1189,6 @@ static void test_TaskDefinition(void)
|
|||
return;
|
||||
}
|
||||
|
||||
V_VT(&v_null) = VT_NULL;
|
||||
|
||||
hr = ITaskService_NewTask(service, 0, &taskdef);
|
||||
ok(hr == S_OK, "NewTask error %#x\n", hr);
|
||||
|
||||
|
@ -1124,6 +1214,42 @@ static void test_TaskDefinition(void)
|
|||
test_settings_v1(taskdef, &new_settings, &def_settings);
|
||||
*/
|
||||
|
||||
hr = ITaskDefinition_put_XmlText(taskdef, NULL);
|
||||
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, xml1, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0]));
|
||||
hr = ITaskDefinition_put_XmlText(taskdef, xmlW);
|
||||
ok(hr == S_OK, "put_XmlText error %#x\n", hr);
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, xml2, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0]));
|
||||
hr = ITaskDefinition_put_XmlText(taskdef, xmlW);
|
||||
todo_wine
|
||||
ok(hr == SCHED_E_NAMESPACE, "expected SCHED_E_NAMESPACE, got %#x\n", hr);
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, xml3, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0]));
|
||||
hr = ITaskDefinition_put_XmlText(taskdef, xmlW);
|
||||
todo_wine
|
||||
ok(hr == SCHED_E_UNEXPECTEDNODE, "expected SCHED_E_UNEXPECTEDNODE, got %#x\n", hr);
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, xml4, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0]));
|
||||
hr = ITaskDefinition_put_XmlText(taskdef, xmlW);
|
||||
ok(hr == S_OK, "put_XmlText error %#x\n", hr);
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, xml5, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0]));
|
||||
hr = ITaskDefinition_put_XmlText(taskdef, xmlW);
|
||||
todo_wine
|
||||
ok(hr == SCHED_E_MISSINGNODE, "expected SCHED_E_MISSINGNODE, got %#x\n", hr);
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, xml6, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0]));
|
||||
hr = ITaskDefinition_put_XmlText(taskdef, xmlW);
|
||||
todo_wine
|
||||
ok(hr == SCHED_E_MALFORMEDXML, "expected SCHED_E_MALFORMEDXML, got %#x\n", hr);
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, xml7, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0]));
|
||||
hr = ITaskDefinition_put_XmlText(taskdef, xmlW);
|
||||
todo_wine
|
||||
ok(hr == SCHED_E_INVALIDVALUE, "expected SCHED_E_INVALIDVALUE, got %#x\n", hr);
|
||||
|
||||
ITaskDefinition_Release(taskdef);
|
||||
ITaskService_Release(service);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue