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
1458856c
Commit
1458856c
authored
Oct 04, 2013
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 04, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Added InternetLockRequestFile tests.
parent
47f490e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
1 deletion
+77
-1
http.c
dlls/wininet/tests/http.c
+77
-1
No files found.
dlls/wininet/tests/http.c
View file @
1458856c
...
...
@@ -1403,9 +1403,12 @@ static void test_http_cache(void)
ok
(
file_size
==
106
,
"file size = %u
\n
"
,
file_size
);
CloseHandle
(
file
);
ret
=
DeleteFileA
(
file_name
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_SHARING_VIOLATION
,
"Deleting file returned %x(%u)
\n
"
,
ret
,
GetLastError
());
ok
(
InternetCloseHandle
(
request
),
"Close request handle failed
\n
"
);
file
=
CreateFile
(
file_name
,
GENERIC_READ
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
file
=
CreateFile
(
file_name
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"Could not create file: %u
\n
"
,
GetLastError
());
CloseHandle
(
file
);
...
...
@@ -1458,6 +1461,78 @@ static void test_http_cache(void)
test_cache_read
();
}
static
void
InternetLockRequestFile_test
(
void
)
{
HINTERNET
session
,
connect
,
request
;
char
file_name
[
MAX_PATH
];
HANDLE
lock
,
lock2
;
DWORD
size
;
BOOL
ret
;
static
const
char
*
types
[]
=
{
"*"
,
""
,
NULL
};
session
=
InternetOpenA
(
"Wine Regression Test"
,
INTERNET_OPEN_TYPE_PRECONFIG
,
NULL
,
NULL
,
0
);
ok
(
session
!=
NULL
,
"Unable to open Internet session
\n
"
);
connect
=
InternetConnectA
(
session
,
"test.winehq.org"
,
INTERNET_DEFAULT_HTTP_PORT
,
NULL
,
NULL
,
INTERNET_SERVICE_HTTP
,
0
,
0
);
ok
(
connect
!=
NULL
,
"Unable to connect to http://test.winehq.org with error %d
\n
"
,
GetLastError
());
request
=
HttpOpenRequestA
(
connect
,
NULL
,
"/tests/hello.html"
,
NULL
,
NULL
,
types
,
INTERNET_FLAG_NEED_FILE
|
INTERNET_FLAG_RELOAD
,
0
);
if
(
!
request
&&
GetLastError
()
==
ERROR_INTERNET_NAME_NOT_RESOLVED
)
{
skip
(
"Network unreachable, skipping test
\n
"
);
ok
(
InternetCloseHandle
(
connect
),
"Close connect handle failed
\n
"
);
ok
(
InternetCloseHandle
(
session
),
"Close session handle failed
\n
"
);
return
;
}
ok
(
request
!=
NULL
,
"Failed to open request handle err %u
\n
"
,
GetLastError
());
size
=
sizeof
(
file_name
);
ret
=
InternetQueryOptionA
(
request
,
INTERNET_OPTION_DATAFILE_NAME
,
file_name
,
&
size
);
ok
(
!
ret
,
"InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INTERNET_ITEM_NOT_FOUND
,
"GetLastError()=%u
\n
"
,
GetLastError
());
ok
(
!
size
,
"size = %d
\n
"
,
size
);
lock
=
NULL
;
ret
=
InternetLockRequestFile
(
request
,
&
lock
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"InternetLockRequestFile returned: %x(%u)
\n
"
,
ret
,
GetLastError
());
ret
=
HttpSendRequest
(
request
,
NULL
,
0
,
NULL
,
0
);
ok
(
ret
,
"HttpSendRequest failed: %u
\n
"
,
GetLastError
());
size
=
sizeof
(
file_name
);
ret
=
InternetQueryOptionA
(
request
,
INTERNET_OPTION_DATAFILE_NAME
,
file_name
,
&
size
);
ok
(
ret
,
"InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) failed: %u
\n
"
,
GetLastError
());
ret
=
InternetLockRequestFile
(
request
,
&
lock
);
ok
(
ret
,
"InternetLockRequestFile returned: %x(%u)
\n
"
,
ret
,
GetLastError
());
ok
(
lock
!=
NULL
,
"lock == NULL
\n
"
);
ret
=
InternetLockRequestFile
(
request
,
&
lock2
);
ok
(
ret
,
"InternetLockRequestFile returned: %x(%u)
\n
"
,
ret
,
GetLastError
());
ok
(
lock
==
lock2
,
"lock != lock2
\n
"
);
ret
=
InternetUnlockRequestFile
(
lock2
);
ok
(
ret
,
"InternetUnlockRequestFile failed: %u
\n
"
,
GetLastError
());
ret
=
DeleteFileA
(
file_name
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_SHARING_VIOLATION
,
"Deleting file returned %x(%u)
\n
"
,
ret
,
GetLastError
());
ok
(
InternetCloseHandle
(
request
),
"Close request handle failed
\n
"
);
ret
=
DeleteFileA
(
file_name
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_SHARING_VIOLATION
,
"Deleting file returned %x(%u)
\n
"
,
ret
,
GetLastError
());
ret
=
InternetUnlockRequestFile
(
lock
);
ok
(
ret
,
"InternetUnlockRequestFile failed: %u
\n
"
,
GetLastError
());
ret
=
DeleteFileA
(
file_name
);
ok
(
ret
,
"Deleting file returned %x(%u)
\n
"
,
ret
,
GetLastError
());
}
static
void
HttpHeaders_test
(
void
)
{
HINTERNET
hSession
;
...
...
@@ -5133,6 +5208,7 @@ START_TEST(http)
test_async_HttpSendRequestEx
(
&
notification_data
[
3
]);
InternetOpenRequest_test
();
test_http_cache
();
InternetLockRequestFile_test
();
InternetOpenUrlA_test
();
HttpHeaders_test
();
test_http_connection
();
...
...
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