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
7611d107
Commit
7611d107
authored
Apr 02, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 04, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Added more tests.
parent
ccd11eb7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
11 deletions
+31
-11
http.c
dlls/wininet/tests/http.c
+31
-11
No files found.
dlls/wininet/tests/http.c
View file @
7611d107
...
...
@@ -107,6 +107,7 @@ static HANDLE hCompleteEvent;
#define TESTF_REDIRECT 0x01
#define TESTF_COMPRESSED 0x02
#define TESTF_ALLOW_COOKIE 0x04
#define TESTF_CHUNKED 0x08
typedef
struct
{
const
char
*
url
;
...
...
@@ -121,6 +122,14 @@ typedef struct {
static
const
test_data_t
test_data
[]
=
{
{
"http://test.winehq.org/tests/data.php"
,
"http://test.winehq.org/tests/data.php"
,
"test.winehq.org"
,
"/tests/data.php"
,
""
,
TESTF_CHUNKED
},
{
"http://test.winehq.org/tests/redirect"
,
"http://test.winehq.org/tests/hello.html"
,
"test.winehq.org"
,
...
...
@@ -303,7 +312,7 @@ static VOID WINAPI callback(
static
void
InternetReadFile_test
(
int
flags
,
const
test_data_t
*
test
)
{
char
*
post_data
=
NULL
;
BOOL
res
;
BOOL
res
,
on_async
=
TRUE
;
CHAR
buffer
[
4000
];
DWORD
length
,
post_len
=
0
;
DWORD
out
;
...
...
@@ -521,9 +530,6 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
if
(
flags
&
INTERNET_FLAG_ASYNC
)
SET_EXPECT
(
INTERNET_STATUS_REQUEST_COMPLETE
);
res
=
InternetQueryDataAvailable
(
hor
,
&
length
,
0x0
,
0x0
);
ok
(
!
(
!
res
&&
length
!=
0
),
"InternetQueryDataAvailable failed with non-zero length
\n
"
);
ok
(
res
||
((
flags
&
INTERNET_FLAG_ASYNC
)
&&
GetLastError
()
==
ERROR_IO_PENDING
),
"InternetQueryDataAvailable failed, error %d
\n
"
,
GetLastError
());
if
(
flags
&
INTERNET_FLAG_ASYNC
)
{
if
(
res
)
...
...
@@ -532,11 +538,22 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
}
else
if
(
GetLastError
()
==
ERROR_IO_PENDING
)
{
trace
(
"PENDING
\n
"
);
/* on some tests, InternetQueryDataAvailable returns non-zero length and ERROR_IO_PENDING */
if
(
!
(
test
->
flags
&
TESTF_CHUNKED
))
ok
(
!
length
,
"InternetQueryDataAvailable returned ERROR_IO_PENDING and %u length
\n
"
,
length
);
WaitForSingleObject
(
hCompleteEvent
,
INFINITE
);
CHECK_NOTIFIED
(
INTERNET_STATUS_REQUEST_COMPLETE
);
continue
;
}
else
{
ok
(
0
,
"InternetQueryDataAvailable failed: %u
\n
"
,
GetLastError
());
}
}
else
{
ok
(
res
,
"InternetQueryDataAvailable failed: %u
\n
"
,
GetLastError
());
}
trace
(
"LENGTH %d
\n
"
,
length
);
if
(
test
->
flags
&
TESTF_CHUNKED
)
ok
(
length
<=
8192
,
"length = %d, expected <= 8192
\n
"
,
length
);
if
(
length
)
{
char
*
buffer
;
...
...
@@ -551,9 +568,11 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
if
(
test
->
content
)
ok
(
!
strcmp
(
buffer
,
test
->
content
),
"buffer = '%s', expected '%s'
\n
"
,
buffer
,
test
->
content
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
}
if
(
length
==
0
)
}
else
{
ok
(
!
on_async
,
"Returned zero size in response to request complete
\n
"
);
break
;
}
on_async
=
FALSE
;
}
if
(
test
->
flags
&
TESTF_REDIRECT
)
{
CHECK_NOTIFIED2
(
INTERNET_STATUS_CLOSING_CONNECTION
,
2
);
...
...
@@ -1851,7 +1870,7 @@ static void test_basic_request(int port, const char *verb, const char *url)
r
=
InternetReadFile
(
hr
,
buffer
,
sizeof
buffer
,
&
count
);
ok
(
r
,
"InternetReadFile failed %u
\n
"
,
GetLastError
());
ok
(
count
==
sizeof
page1
-
1
,
"count was wrong
\n
"
);
ok
(
!
memcmp
(
buffer
,
page1
,
sizeof
page1
),
"http data wrong
\n
"
);
ok
(
!
memcmp
(
buffer
,
page1
,
sizeof
page1
),
"http data wrong
, got: %s
\n
"
,
buffer
);
InternetCloseHandle
(
hr
);
InternetCloseHandle
(
hc
);
...
...
@@ -3387,12 +3406,13 @@ START_TEST(http)
pInternetSetStatusCallbackA
=
(
void
*
)
GetProcAddress
(
hdll
,
"InternetSetStatusCallbackA"
);
init_status_tests
();
test_InternetCloseHandle
();
if
(
0
)
test_InternetCloseHandle
();
InternetReadFile_test
(
INTERNET_FLAG_ASYNC
,
&
test_data
[
0
]);
InternetReadFile_test
(
0
,
&
test_data
[
0
]);
first_connection_to_test_url
=
TRUE
;
InternetReadFile_test
(
INTERNET_FLAG_ASYNC
,
&
test_data
[
1
]);
InternetReadFile_test
(
0
,
&
test_data
[
1
]);
first_connection_to_test_url
=
TRUE
;
InternetReadFile_test
(
INTERNET_FLAG_ASYNC
,
&
test_data
[
2
]);
InternetReadFile_test
(
0
,
&
test_data
[
2
]);
InternetReadFileExA_test
(
INTERNET_FLAG_ASYNC
);
test_open_url_async
();
test_async_HttpSendRequestEx
();
...
...
@@ -3406,5 +3426,5 @@ START_TEST(http)
test_bogus_accept_types_array
();
InternetReadFile_chunked_test
();
HttpSendRequestEx_test
();
InternetReadFile_test
(
INTERNET_FLAG_ASYNC
,
&
test_data
[
2
]);
InternetReadFile_test
(
INTERNET_FLAG_ASYNC
,
&
test_data
[
3
]);
}
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