Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
188de034
Commit
188de034
authored
May 13, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
May 13, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Better closing async handles in tests.
parent
3ab29712
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
45 deletions
+20
-45
http.c
dlls/wininet/tests/http.c
+20
-45
No files found.
dlls/wininet/tests/http.c
View file @
188de034
...
@@ -178,6 +178,8 @@ static BOOL proxy_active(void)
...
@@ -178,6 +178,8 @@ static BOOL proxy_active(void)
return
proxy_enable
!=
0
;
return
proxy_enable
!=
0
;
}
}
static
int
close_handle_cnt
;
static
VOID
WINAPI
callback
(
static
VOID
WINAPI
callback
(
HINTERNET
hInternet
,
HINTERNET
hInternet
,
DWORD_PTR
dwContext
,
DWORD_PTR
dwContext
,
...
@@ -276,6 +278,8 @@ static VOID WINAPI callback(
...
@@ -276,6 +278,8 @@ static VOID WINAPI callback(
trace
(
"%04x:Callback %p 0x%lx INTERNET_STATUS_HANDLE_CLOSING %p %d
\n
"
,
trace
(
"%04x:Callback %p 0x%lx INTERNET_STATUS_HANDLE_CLOSING %p %d
\n
"
,
GetCurrentThreadId
(),
hInternet
,
dwContext
,
GetCurrentThreadId
(),
hInternet
,
dwContext
,
*
(
HINTERNET
*
)
lpvStatusInformation
,
dwStatusInformationLength
);
*
(
HINTERNET
*
)
lpvStatusInformation
,
dwStatusInformationLength
);
if
(
!--
close_handle_cnt
)
SetEvent
(
hCompleteEvent
);
break
;
break
;
case
INTERNET_STATUS_REQUEST_COMPLETE
:
case
INTERNET_STATUS_REQUEST_COMPLETE
:
{
{
...
@@ -309,6 +313,20 @@ static VOID WINAPI callback(
...
@@ -309,6 +313,20 @@ static VOID WINAPI callback(
}
}
}
}
static
void
close_async_handle
(
HINTERNET
handle
,
HANDLE
complete_event
,
int
handle_cnt
)
{
BOOL
res
;
close_handle_cnt
=
handle_cnt
;
SET_EXPECT2
(
INTERNET_STATUS_HANDLE_CLOSING
,
handle_cnt
);
res
=
InternetCloseHandle
(
handle
);
ok
(
res
,
"InternetCloseHandle failed: %u
\n
"
,
GetLastError
());
WaitForSingleObject
(
hCompleteEvent
,
INFINITE
);
CHECK_NOTIFIED2
(
INTERNET_STATUS_HANDLE_CLOSING
,
handle_cnt
);
SET_EXPECT2
(
INTERNET_STATUS_HANDLE_CLOSING
,
handle_cnt
);
}
static
void
InternetReadFile_test
(
int
flags
,
const
test_data_t
*
test
)
static
void
InternetReadFile_test
(
int
flags
,
const
test_data_t
*
test
)
{
{
char
*
post_data
=
NULL
;
char
*
post_data
=
NULL
;
...
@@ -567,32 +585,7 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
...
@@ -567,32 +585,7 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
}
}
abort:
abort:
trace
(
"aborting
\n
"
);
trace
(
"aborting
\n
"
);
SET_EXPECT2
(
INTERNET_STATUS_HANDLE_CLOSING
,
(
hor
!=
0x0
)
+
(
hic
!=
0x0
));
close_async_handle
(
hi
,
hCompleteEvent
,
2
);
if
(
hor
!=
0x0
)
{
SetLastError
(
0xdeadbeef
);
trace
(
"closing
\n
"
);
res
=
InternetCloseHandle
(
hor
);
ok
(
res
,
"InternetCloseHandle of handle opened by HttpOpenRequestA failed
\n
"
);
SetLastError
(
0xdeadbeef
);
res
=
InternetCloseHandle
(
hor
);
ok
(
!
res
,
"Double close of handle opened by HttpOpenRequestA succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"Double close of handle should have set ERROR_INVALID_HANDLE instead of %u
\n
"
,
GetLastError
());
}
/* We intentionally do not close the handle opened by InternetConnectA as this
* tickles bug #9479: native closes child internet handles when the parent handles
* are closed. This is verified below by checking that the number of
* INTERNET_STATUS_HANDLE_CLOSING notifications matches the number expected. */
if
(
hi
!=
0x0
)
{
SET_WINE_ALLOW
(
INTERNET_STATUS_HANDLE_CLOSING
);
trace
(
"closing 2
\n
"
);
res
=
InternetCloseHandle
(
hi
);
ok
(
res
,
"InternetCloseHandle of handle opened by InternetOpenA failed
\n
"
);
if
(
flags
&
INTERNET_FLAG_ASYNC
)
Sleep
(
100
);
}
CHECK_NOTIFIED2
(
INTERNET_STATUS_HANDLE_CLOSING
,
(
hor
!=
0x0
)
+
(
hic
!=
0x0
));
CloseHandle
(
hCompleteEvent
);
CloseHandle
(
hCompleteEvent
);
first_connection_to_test_url
=
FALSE
;
first_connection_to_test_url
=
FALSE
;
}
}
...
@@ -930,25 +923,7 @@ static void InternetReadFileExA_test(int flags)
...
@@ -930,25 +923,7 @@ static void InternetReadFileExA_test(int flags)
trace
(
"Finished. Read %d bytes
\n
"
,
length
);
trace
(
"Finished. Read %d bytes
\n
"
,
length
);
abort:
abort:
SET_EXPECT2
(
INTERNET_STATUS_HANDLE_CLOSING
,
(
hor
!=
0x0
)
+
(
hic
!=
0x0
));
close_async_handle
(
hi
,
hCompleteEvent
,
2
);
if
(
hor
)
{
rc
=
InternetCloseHandle
(
hor
);
ok
((
rc
!=
0
),
"InternetCloseHandle of handle opened by HttpOpenRequestA failed
\n
"
);
rc
=
InternetCloseHandle
(
hor
);
ok
((
rc
==
0
),
"Double close of handle opened by HttpOpenRequestA succeeded
\n
"
);
}
if
(
hic
)
{
rc
=
InternetCloseHandle
(
hic
);
ok
((
rc
!=
0
),
"InternetCloseHandle of handle opened by InternetConnectA failed
\n
"
);
}
if
(
hi
)
{
SET_WINE_ALLOW
(
INTERNET_STATUS_HANDLE_CLOSING
);
rc
=
InternetCloseHandle
(
hi
);
ok
((
rc
!=
0
),
"InternetCloseHandle of handle opened by InternetOpenA failed
\n
"
);
if
(
flags
&
INTERNET_FLAG_ASYNC
)
Sleep
(
100
);
CHECK_NOTIFIED2
(
INTERNET_STATUS_HANDLE_CLOSING
,
(
hor
!=
0x0
)
+
(
hic
!=
0x0
));
}
CloseHandle
(
hCompleteEvent
);
CloseHandle
(
hCompleteEvent
);
first_connection_to_test_url
=
FALSE
;
first_connection_to_test_url
=
FALSE
;
}
}
...
...
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