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
70768564
Commit
70768564
authored
Feb 15, 2024
by
Piotr Caban
Committed by
Alexandre Julliard
Feb 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet/tests: Cleanup INTERNET_OPTION_PER_CONNECTION_OPTION tests.
parent
9ea0a107
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
124 deletions
+66
-124
internet.c
dlls/wininet/tests/internet.c
+66
-124
No files found.
dlls/wininet/tests/internet.c
View file @
70768564
...
...
@@ -1265,8 +1265,8 @@ static void test_Option_PerConnectionOption(void)
BOOL
ret
;
DWORD
size
=
sizeof
(
INTERNET_PER_CONN_OPTION_LISTW
);
INTERNET_PER_CONN_OPTION_LISTW
list
=
{
size
};
INTERNET_PER_CONN_OPTIONW
*
orig_settings
;
static
WCHAR
proxy_srvW
[]
=
{
'p'
,
'r'
,
'o'
,
'x'
,
'y'
,
'.'
,
'e'
,
'x'
,
'a'
,
'm'
,
'p'
,
'l'
,
'e'
,
0
}
;
INTERNET_PER_CONN_OPTIONW
orig_settings
[
2
],
options
[
2
]
;
static
WCHAR
proxy_srvW
[]
=
L"proxy.example"
;
HINTERNET
ses
;
ses
=
InternetOpenA
(
NULL
,
INTERNET_OPEN_TYPE_DIRECT
,
NULL
,
NULL
,
0
);
...
...
@@ -1274,116 +1274,81 @@ static void test_Option_PerConnectionOption(void)
/* get the process IE proxy server info, to restore later */
list
.
dwOptionCount
=
2
;
list
.
pOptions
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
sizeof
(
INTERNET_PER_CONN_OPTIONW
));
list
.
pOptions
[
0
].
dwOption
=
INTERNET_PER_CONN_PROXY_SERVER
;
list
.
pOptions
[
1
].
dwOption
=
INTERNET_PER_CONN_FLAGS
;
list
.
pOptions
=
orig_settings
;
orig_settings
[
0
].
dwOption
=
INTERNET_PER_CONN_PROXY_SERVER
;
orig_settings
[
1
].
dwOption
=
INTERNET_PER_CONN_FLAGS
;
ret
=
InternetQueryOptionW
(
ses
,
INTERNET_OPTION_PER_CONNECTION_OPTION
,
&
list
,
&
size
);
ok
(
ret
==
TRUE
,
"InternetQueryOption should've succeeded
\n
"
);
orig_settings
=
list
.
pOptions
;
ok
(
ret
,
"InternetQueryOption should've succeeded
\n
"
);
/* set the process IE proxy server */
list
.
dwOptionCount
=
2
;
list
.
pOptions
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
sizeof
(
INTERNET_PER_CONN_OPTIONW
));
list
.
pOptions
[
0
].
dwOption
=
INTERNET_PER_CONN_PROXY_SERVER
;
list
.
pOptions
[
0
].
Value
.
pszValue
=
proxy_srvW
;
list
.
pOptions
[
1
].
dwOption
=
INTERNET_PER_CONN_FLAGS
;
list
.
pOptions
[
1
].
Value
.
dwValue
=
PROXY_TYPE_PROXY
;
list
.
pOptions
=
options
;
options
[
0
].
dwOption
=
INTERNET_PER_CONN_PROXY_SERVER
;
options
[
0
].
Value
.
pszValue
=
proxy_srvW
;
options
[
1
].
dwOption
=
INTERNET_PER_CONN_FLAGS
;
options
[
1
].
Value
.
dwValue
=
PROXY_TYPE_PROXY
;
ret
=
InternetSetOptionW
(
ses
,
INTERNET_OPTION_PER_CONNECTION_OPTION
,
&
list
,
size
);
ok
(
ret
==
TRUE
,
"InternetSetOption should've succeeded
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
list
.
pOptions
);
ok
(
ret
,
"InternetSetOption should've succeeded
\n
"
);
/* get & verify the process IE proxy server */
list
.
dwOptionCount
=
2
;
list
.
dwOptionError
=
0
;
list
.
pOptions
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
sizeof
(
INTERNET_PER_CONN_OPTIONW
));
list
.
pOptions
[
0
].
dwOption
=
INTERNET_PER_CONN_PROXY_SERVER
;
list
.
pOptions
[
1
].
dwOption
=
INTERNET_PER_CONN_FLAGS
;
options
[
0
].
Value
.
pszValue
=
NULL
;
options
[
1
].
Value
.
dwValue
=
0
;
ret
=
InternetQueryOptionW
(
ses
,
INTERNET_OPTION_PER_CONNECTION_OPTION
,
&
list
,
&
size
);
ok
(
ret
==
TRUE
,
"InternetQueryOption should've succeeded
\n
"
);
ok
(
!
lstrcmpW
(
list
.
pO
ptions
[
0
].
Value
.
pszValue
,
proxy_srvW
),
ok
(
ret
,
"InternetQueryOption should've succeeded
\n
"
);
ok
(
!
lstrcmpW
(
o
ptions
[
0
].
Value
.
pszValue
,
proxy_srvW
),
"Retrieved proxy server should've been %s, was: %s
\n
"
,
wine_dbgstr_w
(
proxy_srvW
),
wine_dbgstr_w
(
list
.
pO
ptions
[
0
].
Value
.
pszValue
));
ok
(
list
.
pO
ptions
[
1
].
Value
.
dwValue
==
PROXY_TYPE_PROXY
,
wine_dbgstr_w
(
proxy_srvW
),
wine_dbgstr_w
(
o
ptions
[
0
].
Value
.
pszValue
));
ok
(
o
ptions
[
1
].
Value
.
dwValue
==
PROXY_TYPE_PROXY
,
"Retrieved flags should've been PROXY_TYPE_PROXY, was: %ld
\n
"
,
list
.
pO
ptions
[
1
].
Value
.
dwValue
);
o
ptions
[
1
].
Value
.
dwValue
);
ret
=
HeapValidate
(
GetProcessHeap
(),
0
,
list
.
pO
ptions
[
0
].
Value
.
pszValue
);
ret
=
HeapValidate
(
GetProcessHeap
(),
0
,
o
ptions
[
0
].
Value
.
pszValue
);
ok
(
ret
,
"HeapValidate failed, last error %lu
\n
"
,
GetLastError
());
GlobalFree
(
list
.
pOptions
[
0
].
Value
.
pszValue
);
HeapFree
(
GetProcessHeap
(),
0
,
list
.
pOptions
);
GlobalFree
(
options
[
0
].
Value
.
pszValue
);
/* disable the proxy server */
list
.
dwOptionCount
=
1
;
list
.
pOptions
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
INTERNET_PER_CONN_OPTIONW
));
list
.
pOptions
[
0
].
dwOption
=
INTERNET_PER_CONN_FLAGS
;
list
.
pOptions
[
0
].
Value
.
dwValue
=
PROXY_TYPE_DIRECT
;
options
[
0
].
dwOption
=
INTERNET_PER_CONN_FLAGS
;
options
[
0
].
Value
.
dwValue
=
PROXY_TYPE_DIRECT
;
ret
=
InternetSetOptionW
(
ses
,
INTERNET_OPTION_PER_CONNECTION_OPTION
,
&
list
,
size
);
ok
(
ret
==
TRUE
,
"InternetSetOption should've succeeded
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
list
.
pOptions
);
ok
(
ret
,
"InternetSetOption should've succeeded
\n
"
);
/* verify that the proxy is disabled */
list
.
dwOptionCount
=
1
;
list
.
dwOptionError
=
0
;
list
.
pOptions
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
INTERNET_PER_CONN_OPTIONW
));
list
.
pOptions
[
0
].
dwOption
=
INTERNET_PER_CONN_FLAGS
;
options
[
0
].
Value
.
dwValue
=
0
;
ret
=
InternetQueryOptionW
(
ses
,
INTERNET_OPTION_PER_CONNECTION_OPTION
,
&
list
,
&
size
);
ok
(
ret
==
TRUE
,
"InternetQueryOption should've succeeded
\n
"
);
ok
(
list
.
pO
ptions
[
0
].
Value
.
dwValue
==
PROXY_TYPE_DIRECT
,
ok
(
ret
,
"InternetQueryOption should've succeeded
\n
"
);
ok
(
o
ptions
[
0
].
Value
.
dwValue
==
PROXY_TYPE_DIRECT
,
"Retrieved flags should've been PROXY_TYPE_DIRECT, was: %ld
\n
"
,
list
.
pOptions
[
0
].
Value
.
dwValue
);
HeapFree
(
GetProcessHeap
(),
0
,
list
.
pOptions
);
options
[
0
].
Value
.
dwValue
);
/* set the proxy flags to 'invalid' value */
list
.
dwOptionCount
=
1
;
list
.
pOptions
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
INTERNET_PER_CONN_OPTIONW
));
list
.
pOptions
[
0
].
dwOption
=
INTERNET_PER_CONN_FLAGS
;
list
.
pOptions
[
0
].
Value
.
dwValue
=
PROXY_TYPE_PROXY
|
PROXY_TYPE_DIRECT
;
options
[
0
].
dwOption
=
INTERNET_PER_CONN_FLAGS
;
options
[
0
].
Value
.
dwValue
=
PROXY_TYPE_PROXY
|
PROXY_TYPE_DIRECT
;
ret
=
InternetSetOptionW
(
ses
,
INTERNET_OPTION_PER_CONNECTION_OPTION
,
&
list
,
size
);
ok
(
ret
==
TRUE
,
"InternetSetOption should've succeeded
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
list
.
pOptions
);
ok
(
ret
,
"InternetSetOption should've succeeded
\n
"
);
/* verify that the proxy is enabled */
list
.
dwOptionCount
=
1
;
list
.
dwOptionError
=
0
;
list
.
pOptions
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
INTERNET_PER_CONN_OPTIONW
));
list
.
pOptions
[
0
].
dwOption
=
INTERNET_PER_CONN_FLAGS
;
options
[
0
].
Value
.
dwValue
=
0
;
ret
=
InternetQueryOptionW
(
ses
,
INTERNET_OPTION_PER_CONNECTION_OPTION
,
&
list
,
&
size
);
ok
(
ret
==
TRUE
,
"InternetQueryOption should've succeeded
\n
"
);
todo_wine
ok
(
list
.
pO
ptions
[
0
].
Value
.
dwValue
==
PROXY_TYPE_DIRECT
,
ok
(
ret
,
"InternetQueryOption should've succeeded
\n
"
);
todo_wine
ok
(
o
ptions
[
0
].
Value
.
dwValue
==
PROXY_TYPE_DIRECT
,
"Retrieved flags should've been PROXY_TYPE_DIRECT, was: %ld
\n
"
,
list
.
pOptions
[
0
].
Value
.
dwValue
);
HeapFree
(
GetProcessHeap
(),
0
,
list
.
pOptions
);
options
[
0
].
Value
.
dwValue
);
/* restore original settings */
list
.
dwOptionCount
=
2
;
list
.
pOptions
=
orig_settings
;
ret
=
InternetSetOptionW
(
ses
,
INTERNET_OPTION_PER_CONNECTION_OPTION
,
&
list
,
size
);
ok
(
ret
==
TRUE
,
"InternetSetOption should've succeeded
\n
"
);
GlobalFree
(
list
.
pOptions
[
0
].
Value
.
pszValue
);
HeapFree
(
GetProcessHeap
(),
0
,
list
.
pOptions
);
ok
(
ret
,
"InternetSetOption should've succeeded
\n
"
);
GlobalFree
(
orig_settings
[
0
].
Value
.
pszValue
);
InternetCloseHandle
(
ses
);
}
...
...
@@ -1392,7 +1357,7 @@ static void test_Option_PerConnectionOptionA(void)
BOOL
ret
;
DWORD
size
=
sizeof
(
INTERNET_PER_CONN_OPTION_LISTA
);
INTERNET_PER_CONN_OPTION_LISTA
list
=
{
size
};
INTERNET_PER_CONN_OPTIONA
*
orig_settings
;
INTERNET_PER_CONN_OPTIONA
orig_settings
[
2
],
options
[
2
]
;
char
proxy_srv
[]
=
"proxy.example"
;
HINTERNET
ses
;
...
...
@@ -1401,89 +1366,66 @@ static void test_Option_PerConnectionOptionA(void)
/* get the process IE proxy server info, to restore later */
list
.
dwOptionCount
=
2
;
list
.
pOptions
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
sizeof
(
INTERNET_PER_CONN_OPTIONA
));
list
.
pOptions
[
0
].
dwOption
=
INTERNET_PER_CONN_PROXY_SERVER
;
list
.
pOptions
[
1
].
dwOption
=
INTERNET_PER_CONN_FLAGS
;
list
.
pOptions
=
orig_settings
;
orig_settings
[
0
].
dwOption
=
INTERNET_PER_CONN_PROXY_SERVER
;
orig_settings
[
1
].
dwOption
=
INTERNET_PER_CONN_FLAGS
;
ret
=
InternetQueryOptionA
(
ses
,
INTERNET_OPTION_PER_CONNECTION_OPTION
,
&
list
,
&
size
);
ok
(
ret
==
TRUE
,
"InternetQueryOption should've succeeded
\n
"
);
orig_settings
=
list
.
pOptions
;
ok
(
ret
,
"InternetQueryOption should've succeeded
\n
"
);
/* set the process IE proxy server */
list
.
dwOptionCount
=
2
;
list
.
pOptions
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
sizeof
(
INTERNET_PER_CONN_OPTIONA
));
list
.
pOptions
[
0
].
dwOption
=
INTERNET_PER_CONN_PROXY_SERVER
;
list
.
pOptions
[
0
].
Value
.
pszValue
=
proxy_srv
;
list
.
pOptions
[
1
].
dwOption
=
INTERNET_PER_CONN_FLAGS
;
list
.
pOptions
[
1
].
Value
.
dwValue
=
PROXY_TYPE_PROXY
;
list
.
pOptions
=
options
;
options
[
0
].
dwOption
=
INTERNET_PER_CONN_PROXY_SERVER
;
options
[
0
].
Value
.
pszValue
=
proxy_srv
;
options
[
1
].
dwOption
=
INTERNET_PER_CONN_FLAGS
;
options
[
1
].
Value
.
dwValue
=
PROXY_TYPE_PROXY
;
ret
=
InternetSetOptionA
(
ses
,
INTERNET_OPTION_PER_CONNECTION_OPTION
,
&
list
,
size
);
ok
(
ret
==
TRUE
,
"InternetSetOption should've succeeded
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
list
.
pOptions
);
ok
(
ret
,
"InternetSetOption should've succeeded
\n
"
);
/* get & verify the process IE proxy server */
list
.
dwOptionCount
=
2
;
list
.
dwOptionError
=
0
;
list
.
pOptions
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
sizeof
(
INTERNET_PER_CONN_OPTIONA
));
list
.
pOptions
[
0
].
dwOption
=
INTERNET_PER_CONN_PROXY_SERVER
;
list
.
pOptions
[
1
].
dwOption
=
INTERNET_PER_CONN_FLAGS
;
options
[
0
].
Value
.
pszValue
=
NULL
;
options
[
1
].
Value
.
dwValue
=
0
;
ret
=
InternetQueryOptionA
(
ses
,
INTERNET_OPTION_PER_CONNECTION_OPTION
,
&
list
,
&
size
);
ok
(
ret
==
TRUE
,
"InternetQueryOption should've succeeded
\n
"
);
ok
(
!
lstrcmpA
(
list
.
pO
ptions
[
0
].
Value
.
pszValue
,
"proxy.example"
),
ok
(
ret
,
"InternetQueryOption should've succeeded
\n
"
);
ok
(
!
lstrcmpA
(
o
ptions
[
0
].
Value
.
pszValue
,
"proxy.example"
),
"Retrieved proxy server should've been
\"
%s
\"
, was:
\"
%s
\"\n
"
,
proxy_srv
,
list
.
pO
ptions
[
0
].
Value
.
pszValue
);
ok
(
list
.
pO
ptions
[
1
].
Value
.
dwValue
==
PROXY_TYPE_PROXY
,
proxy_srv
,
o
ptions
[
0
].
Value
.
pszValue
);
ok
(
o
ptions
[
1
].
Value
.
dwValue
==
PROXY_TYPE_PROXY
,
"Retrieved flags should've been PROXY_TYPE_PROXY, was: %ld
\n
"
,
list
.
pO
ptions
[
1
].
Value
.
dwValue
);
o
ptions
[
1
].
Value
.
dwValue
);
GlobalFree
(
list
.
pOptions
[
0
].
Value
.
pszValue
);
HeapFree
(
GetProcessHeap
(),
0
,
list
.
pOptions
);
GlobalFree
(
options
[
0
].
Value
.
pszValue
);
/* test with NULL as proxy server */
list
.
dwOptionCount
=
1
;
list
.
pOptions
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
INTERNET_PER_CONN_OPTIONA
));
list
.
pOptions
[
0
].
dwOption
=
INTERNET_PER_CONN_PROXY_SERVER
;
list
.
pOptions
[
0
].
Value
.
pszValue
=
NULL
;
options
[
0
].
dwOption
=
INTERNET_PER_CONN_PROXY_SERVER
;
options
[
0
].
Value
.
pszValue
=
NULL
;
ret
=
InternetSetOptionA
(
ses
,
INTERNET_OPTION_PER_CONNECTION_OPTION
,
&
list
,
size
);
ok
(
ret
==
TRUE
,
"InternetSetOption should've succeeded
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
list
.
pOptions
);
ok
(
ret
,
"InternetSetOption should've succeeded
\n
"
);
/* get & verify the proxy server */
list
.
dwOptionCount
=
1
;
list
.
dwOptionError
=
0
;
list
.
pOptions
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
INTERNET_PER_CONN_OPTIONA
));
list
.
pOptions
[
0
].
dwOption
=
INTERNET_PER_CONN_PROXY_SERVER
;
options
[
0
].
Value
.
dwValue
=
0xdeadbeef
;
ret
=
InternetQueryOptionA
(
ses
,
INTERNET_OPTION_PER_CONNECTION_OPTION
,
&
list
,
&
size
);
ok
(
ret
==
TRUE
,
"InternetQueryOption should've succeeded
\n
"
);
ok
(
!
list
.
pO
ptions
[
0
].
Value
.
pszValue
,
ok
(
ret
,
"InternetQueryOption should've succeeded
\n
"
);
ok
(
!
o
ptions
[
0
].
Value
.
pszValue
,
"Retrieved proxy server should've been NULL, was:
\"
%s
\"\n
"
,
list
.
pOptions
[
0
].
Value
.
pszValue
);
GlobalFree
(
list
.
pOptions
[
0
].
Value
.
pszValue
);
HeapFree
(
GetProcessHeap
(),
0
,
list
.
pOptions
);
options
[
0
].
Value
.
pszValue
);
/* restore original settings */
list
.
dwOptionCount
=
2
;
list
.
pOptions
=
orig_settings
;
ret
=
InternetSetOptionA
(
ses
,
INTERNET_OPTION_PER_CONNECTION_OPTION
,
&
list
,
size
);
ok
(
ret
==
TRUE
,
"InternetSetOption should've succeeded
\n
"
);
GlobalFree
(
list
.
pOptions
[
0
].
Value
.
pszValue
);
HeapFree
(
GetProcessHeap
(),
0
,
list
.
pOptions
);
ret
=
InternetSetOptionA
(
ses
,
INTERNET_OPTION_PER_CONNECTION_OPTION
,
&
list
,
size
);
ok
(
ret
,
"InternetSetOption should've succeeded
\n
"
);
GlobalFree
(
orig_settings
[
0
].
Value
.
pszValue
);
InternetCloseHandle
(
ses
);
}
...
...
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