mstask/tests: Basic conformance test for (Set|Get)AccountInformation.

This commit is contained in:
Roy Shea 2008-08-20 17:46:43 -07:00 committed by Alexandre Julliard
parent 714c6d3a66
commit e8d22f02df
1 changed files with 72 additions and 0 deletions

View File

@ -427,6 +427,77 @@ static void test_SetMaxRunTime_GetMaxRunTime(void)
return;
}
static void test_SetAccountInformation_GetAccountInformation(void)
{
BOOL setup;
HRESULT hres;
LPWSTR account_name;
const WCHAR dummy_account_name[] = {'N', 'o', 'S', 'u', 'c', 'h',
'A', 'c', 'c', 'o', 'u', 'n', 't', 0};
setup = setup_task();
ok(setup, "Failed to setup test_task\n");
if (!setup)
{
skip("Failed to create task. Skipping tests.\n");
return;
}
/* Get account information before it is set */
hres = ITask_GetAccountInformation(test_task, &account_name);
/* WinXP returns HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND): 0x80070002 but
* Win2K returns SCHED_E_CANNOT_OPEN_TASK: 0x8004130d */
todo_wine ok(hres == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
hres == SCHED_E_CANNOT_OPEN_TASK,
"Unset account name generated: 0x%08x\n", hres);
/* Attempt to set to a dummy account without a password */
/* This test passes on WinXP but fails on Win2K */
hres = ITask_SetAccountInformation(test_task, dummy_account_name, NULL);
todo_wine ok(hres == S_OK,
"Failed setting dummy account with no password: %08x\n", hres);
hres = ITask_GetAccountInformation(test_task, &account_name);
todo_wine ok(hres == S_OK, "GetAccountInformation failed: %08x\n", hres);
if (hres == S_OK)
{
todo_wine ok(!lstrcmpW(account_name, dummy_account_name),
"Got %s, expected %s\n", dbgstr_w(account_name),
dbgstr_w(dummy_account_name));
CoTaskMemFree(account_name);
}
/* Attempt to set to a dummy account with a (invalid) password */
/* This test passes on WinXP but fails on Win2K */
hres = ITask_SetAccountInformation(test_task, dummy_account_name,
dummy_account_name);
todo_wine ok(hres == S_OK,
"Failed setting dummy account with password: %08x\n", hres);
hres = ITask_GetAccountInformation(test_task, &account_name);
todo_wine ok(hres == S_OK, "GetAccountInformation failed: %08x\n", hres);
if (hres == S_OK)
{
todo_wine ok(!lstrcmpW(account_name, dummy_account_name),
"Got %s, expected %s\n", dbgstr_w(account_name),
dbgstr_w(dummy_account_name));
CoTaskMemFree(account_name);
}
/* Attempt to set to the local system account */
hres = ITask_SetAccountInformation(test_task, empty, NULL);
todo_wine ok(hres == S_OK, "Failed setting system account: %08x\n", hres);
hres = ITask_GetAccountInformation(test_task, &account_name);
todo_wine ok(hres == S_OK, "GetAccountInformation failed: %08x\n", hres);
if (hres == S_OK)
{
todo_wine ok(!lstrcmpW(account_name, empty),
"Got %s, expected empty string\n", dbgstr_w(account_name));
CoTaskMemFree(account_name);
}
cleanup_task();
return;
}
START_TEST(task)
{
CoInitialize(NULL);
@ -435,5 +506,6 @@ START_TEST(task)
test_SetParameters_GetParameters();
test_SetComment_GetComment();
test_SetMaxRunTime_GetMaxRunTime();
test_SetAccountInformation_GetAccountInformation();
CoUninitialize();
}