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
02abc3b2
Commit
02abc3b2
authored
May 25, 2010
by
Hans Leidekker
Committed by
Alexandre Julliard
May 25, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Add tests for setting and retrieving the context value.
parent
67b1eeca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
108 additions
and
0 deletions
+108
-0
http.c
dlls/wininet/tests/http.c
+108
-0
No files found.
dlls/wininet/tests/http.c
View file @
02abc3b2
...
...
@@ -2416,6 +2416,113 @@ static void test_HttpQueryInfo(int port)
InternetCloseHandle
(
hi
);
}
static
void
test_options
(
int
port
)
{
HINTERNET
ses
,
con
,
req
;
DWORD
size
,
error
;
DWORD_PTR
ctx
;
BOOL
ret
;
ses
=
InternetOpen
(
"winetest"
,
INTERNET_OPEN_TYPE_DIRECT
,
NULL
,
NULL
,
0
);
ok
(
ses
!=
NULL
,
"InternetOpen failed
\n
"
);
SetLastError
(
0xdeadbeef
);
ret
=
InternetSetOption
(
ses
,
INTERNET_OPTION_CONTEXT_VALUE
,
NULL
,
0
);
error
=
GetLastError
();
ok
(
!
ret
,
"InternetSetOption succeeded
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
InternetSetOption
(
ses
,
INTERNET_OPTION_CONTEXT_VALUE
,
NULL
,
sizeof
(
ctx
));
ok
(
!
ret
,
"InternetSetOption succeeded
\n
"
);
error
=
GetLastError
();
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
InternetSetOption
(
ses
,
INTERNET_OPTION_CONTEXT_VALUE
,
&
ctx
,
0
);
ok
(
!
ret
,
"InternetSetOption succeeded
\n
"
);
error
=
GetLastError
();
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
ctx
=
1
;
ret
=
InternetSetOption
(
ses
,
INTERNET_OPTION_CONTEXT_VALUE
,
&
ctx
,
sizeof
(
ctx
));
ok
(
ret
,
"InternetSetOption failed %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
InternetQueryOption
(
ses
,
INTERNET_OPTION_CONTEXT_VALUE
,
NULL
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"InternetQueryOption succeeded
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
InternetQueryOption
(
ses
,
INTERNET_OPTION_CONTEXT_VALUE
,
&
ctx
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"InternetQueryOption succeeded
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
size
=
0
;
SetLastError
(
0xdeadbeef
);
ret
=
InternetQueryOption
(
ses
,
INTERNET_OPTION_CONTEXT_VALUE
,
NULL
,
&
size
);
error
=
GetLastError
();
ok
(
!
ret
,
"InternetQueryOption succeeded
\n
"
);
ok
(
error
==
ERROR_INSUFFICIENT_BUFFER
,
"expected ERROR_INSUFFICIENT_BUFFER, got %u
\n
"
,
error
);
size
=
sizeof
(
ctx
);
SetLastError
(
0xdeadbeef
);
ret
=
InternetQueryOption
(
NULL
,
INTERNET_OPTION_CONTEXT_VALUE
,
&
ctx
,
&
size
);
error
=
GetLastError
();
ok
(
!
ret
,
"InternetQueryOption succeeded
\n
"
);
ok
(
error
==
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
,
"expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %u
\n
"
,
error
);
ctx
=
0xdeadbeef
;
size
=
sizeof
(
ctx
);
ret
=
InternetQueryOption
(
ses
,
INTERNET_OPTION_CONTEXT_VALUE
,
&
ctx
,
&
size
);
ok
(
ret
,
"InternetQueryOption failed %u
\n
"
,
GetLastError
());
ok
(
ctx
==
1
,
"expected 1 got %lu
\n
"
,
ctx
);
con
=
InternetConnect
(
ses
,
"localhost"
,
port
,
NULL
,
NULL
,
INTERNET_SERVICE_HTTP
,
0
,
0
);
ok
(
con
!=
NULL
,
"InternetConnect failed
\n
"
);
ctx
=
0xdeadbeef
;
size
=
sizeof
(
ctx
);
ret
=
InternetQueryOption
(
con
,
INTERNET_OPTION_CONTEXT_VALUE
,
&
ctx
,
&
size
);
ok
(
ret
,
"InternetQueryOption failed %u
\n
"
,
GetLastError
());
ok
(
ctx
==
0
,
"expected 0 got %lu
\n
"
,
ctx
);
ctx
=
2
;
ret
=
InternetSetOption
(
con
,
INTERNET_OPTION_CONTEXT_VALUE
,
&
ctx
,
sizeof
(
ctx
));
ok
(
ret
,
"InternetSetOption failed %u
\n
"
,
GetLastError
());
ctx
=
0xdeadbeef
;
size
=
sizeof
(
ctx
);
ret
=
InternetQueryOption
(
con
,
INTERNET_OPTION_CONTEXT_VALUE
,
&
ctx
,
&
size
);
ok
(
ret
,
"InternetQueryOption failed %u
\n
"
,
GetLastError
());
ok
(
ctx
==
2
,
"expected 2 got %lu
\n
"
,
ctx
);
req
=
HttpOpenRequest
(
con
,
NULL
,
"/test1"
,
NULL
,
NULL
,
NULL
,
0
,
0
);
ok
(
req
!=
NULL
,
"HttpOpenRequest failed
\n
"
);
ctx
=
0xdeadbeef
;
size
=
sizeof
(
ctx
);
ret
=
InternetQueryOption
(
req
,
INTERNET_OPTION_CONTEXT_VALUE
,
&
ctx
,
&
size
);
ok
(
ret
,
"InternetQueryOption failed %u
\n
"
,
GetLastError
());
ok
(
ctx
==
0
,
"expected 0 got %lu
\n
"
,
ctx
);
ctx
=
3
;
ret
=
InternetSetOption
(
req
,
INTERNET_OPTION_CONTEXT_VALUE
,
&
ctx
,
sizeof
(
ctx
));
ok
(
ret
,
"InternetSetOption failed %u
\n
"
,
GetLastError
());
ctx
=
0xdeadbeef
;
size
=
sizeof
(
ctx
);
ret
=
InternetQueryOption
(
req
,
INTERNET_OPTION_CONTEXT_VALUE
,
&
ctx
,
&
size
);
ok
(
ret
,
"InternetQueryOption failed %u
\n
"
,
GetLastError
());
ok
(
ctx
==
3
,
"expected 3 got %lu
\n
"
,
ctx
);
InternetCloseHandle
(
req
);
InternetCloseHandle
(
con
);
InternetCloseHandle
(
ses
);
}
static
void
test_http_connection
(
void
)
{
struct
server_info
si
;
...
...
@@ -2451,6 +2558,7 @@ static void test_http_connection(void)
test_HttpQueryInfo
(
si
.
port
);
test_HttpSendRequestW
(
si
.
port
);
test_last_error
(
si
.
port
);
test_options
(
si
.
port
);
/* send the basic request again to shutdown the server thread */
test_basic_request
(
si
.
port
,
"GET"
,
"/quit"
);
...
...
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