Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
0c8dc009
Commit
0c8dc009
authored
Nov 08, 2012
by
Detlef Riekenberg
Committed by
Alexandre Julliard
Nov 08, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mstask/tests: Add tests for SetTargetComputer.
parent
5bff2fb6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
1 deletion
+72
-1
Makefile.in
dlls/mstask/tests/Makefile.in
+1
-1
task_scheduler.c
dlls/mstask/tests/task_scheduler.c
+71
-0
No files found.
dlls/mstask/tests/Makefile.in
View file @
0c8dc009
TESTDLL
=
mstask.dll
IMPORTS
=
ole32
IMPORTS
=
ole32
user32
C_SRCS
=
\
task.c
\
...
...
dlls/mstask/tests/task_scheduler.c
View file @
0c8dc009
...
...
@@ -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
;
...
...
@@ -134,11 +136,80 @@ static void test_GetTargetComputer(void)
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
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment