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
c305b21b
Commit
c305b21b
authored
Apr 25, 2017
by
Hans Leidekker
Committed by
Alexandre Julliard
Apr 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices/tests: Add tests.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
804e9b60
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
159 additions
and
6 deletions
+159
-6
channel.c
dlls/webservices/tests/channel.c
+159
-6
No files found.
dlls/webservices/tests/channel.c
View file @
c305b21b
...
...
@@ -77,11 +77,9 @@ static void test_WsOpenChannel(void)
hr
=
WsOpenChannel
(
channel
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
memset
(
&
addr
,
0
,
sizeof
(
addr
)
);
addr
.
url
.
length
=
sizeof
(
url
)
/
sizeof
(
url
[
0
]);
addr
.
url
.
chars
=
url
;
addr
.
headers
=
NULL
;
addr
.
extensions
=
NULL
;
addr
.
identity
=
NULL
;
hr
=
WsOpenChannel
(
NULL
,
&
addr
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
...
...
@@ -124,11 +122,9 @@ static void test_WsResetChannel(void)
hr
=
WsSetChannelProperty
(
channel
,
WS_CHANNEL_PROPERTY_RESOLVE_TIMEOUT
,
&
timeout
,
size
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
memset
(
&
addr
,
0
,
sizeof
(
addr
)
);
addr
.
url
.
length
=
sizeof
(
url
)
/
sizeof
(
url
[
0
]);
addr
.
url
.
chars
=
url
;
addr
.
headers
=
NULL
;
addr
.
extensions
=
NULL
;
addr
.
identity
=
NULL
;
hr
=
WsOpenChannel
(
channel
,
&
addr
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -162,9 +158,166 @@ static void test_WsResetChannel(void)
WsFreeChannel
(
channel
);
}
struct
listener_info
{
int
port
;
HANDLE
wait
;
};
static
DWORD
CALLBACK
listener_proc
(
void
*
arg
)
{
static
const
WCHAR
fmt
[]
=
{
's'
,
'o'
,
'a'
,
'p'
,
'.'
,
'u'
,
'd'
,
'p'
,
':'
,
'/'
,
'/'
,
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'h'
,
'o'
,
's'
,
't'
,
':'
,
'%'
,
'u'
,
0
};
struct
listener_info
*
info
=
arg
;
WS_LISTENER
*
listener
;
WS_CHANNEL
*
channel
;
WS_MESSAGE
*
msg
;
WCHAR
buf
[
64
];
WS_STRING
url
;
HRESULT
hr
;
hr
=
WsCreateListener
(
WS_CHANNEL_TYPE_DUPLEX
,
WS_UDP_CHANNEL_BINDING
,
NULL
,
0
,
NULL
,
&
listener
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
url
.
length
=
wsprintfW
(
buf
,
fmt
,
info
->
port
);
url
.
chars
=
buf
;
hr
=
WsOpenListener
(
listener
,
&
url
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsCreateChannelForListener
(
listener
,
NULL
,
0
,
&
channel
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
SetEvent
(
info
->
wait
);
hr
=
WsAcceptChannel
(
listener
,
channel
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsCreateMessageForChannel
(
channel
,
NULL
,
0
,
&
msg
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsReadMessageStart
(
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsReadMessageStart
(
channel
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsReadMessageStart
(
NULL
,
msg
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsReadMessageStart
(
channel
,
msg
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsReadMessageEnd
(
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsReadMessageEnd
(
channel
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsReadMessageEnd
(
NULL
,
msg
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsReadMessageEnd
(
channel
,
msg
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
WsFreeMessage
(
msg
);
SetEvent
(
info
->
wait
);
hr
=
WsCloseChannel
(
channel
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
WsFreeChannel
(
channel
);
hr
=
WsCloseListener
(
listener
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
WsFreeListener
(
listener
);
return
0
;
}
static
void
test_message_read_write
(
const
struct
listener_info
*
info
)
{
static
const
WCHAR
fmt
[]
=
{
's'
,
'o'
,
'a'
,
'p'
,
'.'
,
'u'
,
'd'
,
'p'
,
':'
,
'/'
,
'/'
,
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'h'
,
'o'
,
's'
,
't'
,
':'
,
'%'
,
'u'
,
0
};
WS_ENDPOINT_ADDRESS
addr
;
WCHAR
buf
[
64
];
WS_CHANNEL
*
channel
;
WS_MESSAGE
*
msg
;
HRESULT
hr
;
DWORD
err
;
hr
=
WsCreateChannel
(
WS_CHANNEL_TYPE_DUPLEX
,
WS_UDP_CHANNEL_BINDING
,
NULL
,
0
,
NULL
,
&
channel
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
memset
(
&
addr
,
0
,
sizeof
(
addr
)
);
addr
.
url
.
length
=
wsprintfW
(
buf
,
fmt
,
info
->
port
);
addr
.
url
.
chars
=
buf
;
hr
=
WsOpenChannel
(
channel
,
&
addr
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsCreateMessageForChannel
(
channel
,
NULL
,
0
,
&
msg
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsInitializeMessage
(
msg
,
WS_REQUEST_MESSAGE
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteMessageStart
(
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteMessageStart
(
channel
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteMessageStart
(
NULL
,
msg
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteMessageStart
(
channel
,
msg
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteMessageEnd
(
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteMessageEnd
(
channel
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteMessageEnd
(
NULL
,
msg
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteMessageEnd
(
channel
,
msg
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
err
=
WaitForSingleObject
(
info
->
wait
,
3000
);
ok
(
err
==
WAIT_OBJECT_0
,
"wait failed %u
\n
"
,
err
);
hr
=
WsCloseChannel
(
channel
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
WsFreeMessage
(
msg
);
WsFreeChannel
(
channel
);
}
static
HANDLE
start_listener
(
struct
listener_info
*
info
)
{
DWORD
err
;
HANDLE
thread
=
CreateThread
(
NULL
,
0
,
listener_proc
,
info
,
0
,
NULL
);
ok
(
thread
!=
NULL
,
"failed to create listener thread %u
\n
"
,
GetLastError
()
);
err
=
WaitForSingleObject
(
info
->
wait
,
3000
);
ok
(
err
==
WAIT_OBJECT_0
,
"failed to start listener %u
\n
"
,
err
);
return
thread
;
}
START_TEST
(
channel
)
{
struct
listener_info
info
;
HANDLE
thread
;
test_WsCreateChannel
();
test_WsOpenChannel
();
test_WsResetChannel
();
info
.
port
=
7533
;
info
.
wait
=
CreateEventW
(
NULL
,
0
,
0
,
NULL
);
thread
=
start_listener
(
&
info
);
test_message_read_write
(
&
info
);
WaitForSingleObject
(
thread
,
3000
);
}
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