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
1f144fae
Commit
1f144fae
authored
Apr 20, 2016
by
Hans Leidekker
Committed by
Alexandre Julliard
Apr 20, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jsproxy/tests: Add tests.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ea8b261a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
162 additions
and
0 deletions
+162
-0
configure
configure
+1
-0
configure.ac
configure.ac
+1
-0
Makefile.in
dlls/jsproxy/tests/Makefile.in
+5
-0
jsproxy.c
dlls/jsproxy/tests/jsproxy.c
+155
-0
No files found.
configure
View file @
1f144fae
...
...
@@ -17749,6 +17749,7 @@ wine_fn_config_dll joy.cpl enable_joy_cpl clean
wine_fn_config_dll jscript enable_jscript clean
wine_fn_config_test dlls/jscript/tests jscript_test
wine_fn_config_dll jsproxy enable_jsproxy implib
wine_fn_config_test dlls/jsproxy/tests jsproxy_test
wine_fn_config_dll kernel32 enable_kernel32 clean,implib
wine_fn_config_test dlls/kernel32/tests kernel32_test
wine_fn_config_dll kernelbase enable_kernelbase
...
...
configure.ac
View file @
1f144fae
...
...
@@ -2997,6 +2997,7 @@ WINE_CONFIG_DLL(joy.cpl,,[clean])
WINE_CONFIG_DLL(jscript,,[clean])
WINE_CONFIG_TEST(dlls/jscript/tests)
WINE_CONFIG_DLL(jsproxy,,[implib])
WINE_CONFIG_TEST(dlls/jsproxy/tests)
WINE_CONFIG_DLL(kernel32,,[clean,implib])
WINE_CONFIG_TEST(dlls/kernel32/tests)
WINE_CONFIG_DLL(kernelbase)
...
...
dlls/jsproxy/tests/Makefile.in
0 → 100644
View file @
1f144fae
TESTDLL
=
jsproxy.dll
IMPORTS
=
jsproxy
C_SRCS
=
\
jsproxy.c
dlls/jsproxy/tests/jsproxy.c
0 → 100644
View file @
1f144fae
/*
* Copyright 2016 Hans Leidekker for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <stdlib.h>
#include <windef.h>
#include <winbase.h>
#include <wininet.h>
#include "wine/test.h"
static
BOOL
(
WINAPI
*
pInternetInitializeAutoProxyDll
)
(
DWORD
,
LPSTR
,
LPSTR
,
AutoProxyHelperFunctions
*
,
AUTO_PROXY_SCRIPT_BUFFER
*
);
static
BOOL
(
WINAPI
*
pInternetDeInitializeAutoProxyDll
)(
LPSTR
,
DWORD
);
static
BOOL
(
WINAPI
*
pInternetGetProxyInfo
)(
LPCSTR
,
DWORD
,
LPSTR
,
DWORD
,
LPSTR
*
,
LPDWORD
);
static
void
test_InternetInitializeAutoProxyDll
(
void
)
{
const
char
url
[]
=
"http://localhost"
;
char
script
[]
=
"function FindProxyForURL(url, host) {return
\"
DIRECT
\"
;}
\0
test"
;
char
script2
[]
=
"function FindProxyForURL(url, host) {return
\"
PROXY 10.0.0.1:8080
\"
;}
\0
test"
;
char
*
proxy
,
host
[]
=
"localhost"
;
AUTO_PROXY_SCRIPT_BUFFER
buf
;
DWORD
err
,
len
;
BOOL
ret
;
buf
.
dwStructSize
=
sizeof
(
buf
);
buf
.
lpszScriptBuffer
=
script
;
buf
.
dwScriptBufferSize
=
0
;
SetLastError
(
0xdeadbeef
);
ret
=
pInternetInitializeAutoProxyDll
(
0
,
NULL
,
NULL
,
NULL
,
&
buf
);
err
=
GetLastError
();
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
err
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
err
);
buf
.
dwScriptBufferSize
=
strlen
(
script
)
+
1
;
ret
=
pInternetInitializeAutoProxyDll
(
0
,
NULL
,
NULL
,
NULL
,
&
buf
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
ret
=
pInternetGetProxyInfo
(
url
,
strlen
(
url
),
host
,
strlen
(
host
),
&
proxy
,
&
len
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
ok
(
!
strcmp
(
proxy
,
"DIRECT"
),
"got
\"
%s
\"\n
"
,
proxy
);
GlobalFree
(
proxy
);
buf
.
dwScriptBufferSize
=
strlen
(
script2
)
+
1
;
buf
.
lpszScriptBuffer
=
script2
;
ret
=
pInternetInitializeAutoProxyDll
(
0
,
NULL
,
NULL
,
NULL
,
&
buf
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
ret
=
pInternetGetProxyInfo
(
url
,
strlen
(
url
),
host
,
strlen
(
host
),
&
proxy
,
&
len
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
ok
(
!
strcmp
(
proxy
,
"PROXY 10.0.0.1:8080"
),
"got
\"
%s
\"\n
"
,
proxy
);
GlobalFree
(
proxy
);
buf
.
dwScriptBufferSize
=
strlen
(
script2
)
+
2
;
ret
=
pInternetInitializeAutoProxyDll
(
0
,
NULL
,
NULL
,
NULL
,
&
buf
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
ret
=
pInternetGetProxyInfo
(
url
,
strlen
(
url
),
host
,
strlen
(
host
),
&
proxy
,
&
len
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
ok
(
!
strcmp
(
proxy
,
"PROXY 10.0.0.1:8080"
),
"got
\"
%s
\"\n
"
,
proxy
);
GlobalFree
(
proxy
);
ret
=
pInternetDeInitializeAutoProxyDll
(
NULL
,
0
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
}
static
void
test_InternetGetProxyInfo
(
void
)
{
const
char
url
[]
=
"http://localhost"
;
char
script
[]
=
"function FindProxyForURL(url, host) { return
\"
DIRECT
\"
; }"
;
char
*
proxy
,
host
[]
=
"localhost"
;
AUTO_PROXY_SCRIPT_BUFFER
buf
;
DWORD
len
,
err
;
BOOL
ret
;
SetLastError
(
0xdeadbeef
);
ret
=
pInternetGetProxyInfo
(
url
,
strlen
(
url
),
host
,
strlen
(
host
),
&
proxy
,
&
len
);
err
=
GetLastError
();
ok
(
!
ret
,
"unexpected succes
\n
"
);
ok
(
err
==
ERROR_CAN_NOT_COMPLETE
,
"got %u
\n
"
,
err
);
buf
.
dwStructSize
=
sizeof
(
buf
);
buf
.
lpszScriptBuffer
=
script
;
buf
.
dwScriptBufferSize
=
strlen
(
script
)
+
1
;
ret
=
pInternetInitializeAutoProxyDll
(
0
,
NULL
,
NULL
,
NULL
,
&
buf
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
len
=
0
;
proxy
=
NULL
;
ret
=
pInternetGetProxyInfo
(
url
,
strlen
(
url
),
host
,
strlen
(
host
),
&
proxy
,
&
len
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
ok
(
!
strcmp
(
proxy
,
"DIRECT"
),
"got
\"
%s
\"\n
"
,
proxy
);
ok
(
len
==
strlen
(
"DIRECT"
)
+
1
,
"got %u
\n
"
,
len
);
GlobalFree
(
proxy
);
len
=
0
;
proxy
=
NULL
;
ret
=
pInternetGetProxyInfo
(
url
,
strlen
(
url
)
+
1
,
host
,
strlen
(
host
),
&
proxy
,
&
len
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
ok
(
!
strcmp
(
proxy
,
"DIRECT"
),
"got
\"
%s
\"\n
"
,
proxy
);
ok
(
len
==
strlen
(
"DIRECT"
)
+
1
,
"got %u
\n
"
,
len
);
GlobalFree
(
proxy
);
len
=
0
;
proxy
=
NULL
;
ret
=
pInternetGetProxyInfo
(
url
,
strlen
(
url
)
-
1
,
host
,
strlen
(
host
),
&
proxy
,
&
len
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
ok
(
!
strcmp
(
proxy
,
"DIRECT"
),
"got
\"
%s
\"\n
"
,
proxy
);
ok
(
len
==
strlen
(
"DIRECT"
)
+
1
,
"got %u
\n
"
,
len
);
GlobalFree
(
proxy
);
len
=
0
;
proxy
=
NULL
;
ret
=
pInternetGetProxyInfo
(
url
,
strlen
(
url
),
host
,
strlen
(
host
)
+
1
,
&
proxy
,
&
len
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
ok
(
!
strcmp
(
proxy
,
"DIRECT"
),
"got
\"
%s
\"\n
"
,
proxy
);
ok
(
len
==
strlen
(
"DIRECT"
)
+
1
,
"got %u
\n
"
,
len
);
GlobalFree
(
proxy
);
ret
=
pInternetDeInitializeAutoProxyDll
(
NULL
,
0
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
}
START_TEST
(
jsproxy
)
{
HMODULE
module
=
LoadLibraryA
(
"jsproxy.dll"
);
pInternetInitializeAutoProxyDll
=
(
void
*
)
GetProcAddress
(
module
,
"InternetInitializeAutoProxyDll"
);
pInternetDeInitializeAutoProxyDll
=
(
void
*
)
GetProcAddress
(
module
,
"InternetDeInitializeAutoProxyDll"
);
pInternetGetProxyInfo
=
(
void
*
)
GetProcAddress
(
module
,
"InternetGetProxyInfo"
);
if
(
!
pInternetInitializeAutoProxyDll
)
{
win_skip
(
"InternetInitializeAutoProxyDll not available
\n
"
);
return
;
}
test_InternetInitializeAutoProxyDll
();
test_InternetGetProxyInfo
();
}
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