Commit b2be840e authored by Zac Brown's avatar Zac Brown Committed by Alexandre Julliard

winhttp/tests: Add test for opening request.

parent 67201a14
......@@ -333,6 +333,7 @@ programs/winetest/usp10_test.exe
programs/winetest/uxtheme_test.exe
programs/winetest/version_test.exe
programs/winetest/winetest
programs/winetest/winhttp_test.exe
programs/winetest/wininet_test.exe
programs/winetest/winmm_test.exe
programs/winetest/winspool.drv_test.exe
......
......@@ -496,6 +496,7 @@ ALL_MAKEFILES = \
dlls/winex11.drv/Makefile \
dlls/wing32/Makefile \
dlls/winhttp/Makefile \
dlls/winhttp/tests/Makefile \
dlls/wininet/Makefile \
dlls/wininet/tests/Makefile \
dlls/winmm/Makefile \
......@@ -926,6 +927,7 @@ dlls/winequartz.drv/Makefile: dlls/winequartz.drv/Makefile.in dlls/Makedll.rules
dlls/winex11.drv/Makefile: dlls/winex11.drv/Makefile.in dlls/Makedll.rules
dlls/wing32/Makefile: dlls/wing32/Makefile.in dlls/Makedll.rules
dlls/winhttp/Makefile: dlls/winhttp/Makefile.in dlls/Makedll.rules
dlls/winhttp/tests/Makefile: dlls/winhttp/tests/Makefile.in dlls/Maketest.rules
dlls/wininet/Makefile: dlls/wininet/Makefile.in dlls/Makedll.rules
dlls/wininet/tests/Makefile: dlls/wininet/tests/Makefile.in dlls/Maketest.rules
dlls/winmm/Makefile: dlls/winmm/Makefile.in dlls/Makedll.rules
......
......@@ -22418,6 +22418,8 @@ ac_config_files="$ac_config_files dlls/wing32/Makefile"
ac_config_files="$ac_config_files dlls/winhttp/Makefile"
ac_config_files="$ac_config_files dlls/winhttp/tests/Makefile"
ac_config_files="$ac_config_files dlls/wininet/Makefile"
ac_config_files="$ac_config_files dlls/wininet/tests/Makefile"
......@@ -23484,6 +23486,7 @@ do
"dlls/winex11.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winex11.drv/Makefile" ;;
"dlls/wing32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wing32/Makefile" ;;
"dlls/winhttp/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winhttp/Makefile" ;;
"dlls/winhttp/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winhttp/tests/Makefile" ;;
"dlls/wininet/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wininet/Makefile" ;;
"dlls/wininet/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wininet/tests/Makefile" ;;
"dlls/winmm/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winmm/Makefile" ;;
......
......@@ -2038,6 +2038,7 @@ AC_CONFIG_FILES([dlls/winequartz.drv/Makefile])
AC_CONFIG_FILES([dlls/winex11.drv/Makefile])
AC_CONFIG_FILES([dlls/wing32/Makefile])
AC_CONFIG_FILES([dlls/winhttp/Makefile])
AC_CONFIG_FILES([dlls/winhttp/tests/Makefile])
AC_CONFIG_FILES([dlls/wininet/Makefile])
AC_CONFIG_FILES([dlls/wininet/tests/Makefile])
AC_CONFIG_FILES([dlls/winmm/Makefile])
......
......@@ -363,6 +363,7 @@ TESTSUBDIRS = \
usp10/tests \
uxtheme/tests \
version/tests \
winhttp/tests \
wininet/tests \
winmm/tests \
winspool.drv/tests \
......
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = winhttp.dll
IMPORTS = winhttp kernel32
CTESTS = \
winhttp.c
@MAKE_TEST_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend
/*
* WinHTTP - tests
*
* Copyright 2008 Google (Zac Brown)
*
* 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 <winhttp.h>
#include "wine/test.h"
static const WCHAR test_useragent[] =
{'W','i','n','e',' ','R','e','g','r','e','s','s','i','o','n',' ','T','e','s','t',0};
static const WCHAR test_server[] = {'w','i','n','e','h','q','.','o','r','g',0};
static void test_OpenRequest (void)
{
BOOL ret;
HINTERNET session, request, connection;
session = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
todo_wine ok(session != NULL, "WinHttpOpen failed to open session.\n");
/* Test with a bad server name */
SetLastError(0xdeadbeef);
connection = WinHttpConnect(session, NULL, INTERNET_DEFAULT_HTTP_PORT, 0);
ok (connection == NULL, "WinHttpConnect succeeded in opening connection to NULL server argument.\n");
todo_wine ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %u.\n", GetLastError());
/* Test with a valid server name */
connection = WinHttpConnect (session, test_server, INTERNET_DEFAULT_HTTP_PORT, 0);
todo_wine ok(connection != NULL,
"WinHttpConnect failed to open a connection, error: %u.\n", GetLastError());
request = WinHttpOpenRequest(connection, NULL, NULL, NULL, WINHTTP_NO_REFERER,
WINHTTP_DEFAULT_ACCEPT_TYPES, 0);
if (request == NULL && GetLastError() == ERROR_WINHTTP_NAME_NOT_RESOLVED)
{
skip("Network unreachable, skipping.\n");
goto done;
}
todo_wine ok(request != NULL,
"WinHttpOpenrequest failed to open a request, error: %u.\n", GetLastError());
ret = WinHttpSendRequest(request, WINHTTP_NO_ADDITIONAL_HEADERS, 0, NULL, 0, 0, 0);
todo_wine ok(ret == TRUE, "WinHttpSendRequest failed: %u\n", GetLastError());
ret = WinHttpCloseHandle(request);
todo_wine ok(ret == TRUE, "WinHttpCloseHandle failed on closing request, got %d.\n", ret);
done:
ret = WinHttpCloseHandle(connection);
todo_wine ok(ret == TRUE, "WinHttpCloseHandle failed on closing connection, got %d.\n", ret);
ret = WinHttpCloseHandle(session);
todo_wine ok(ret == TRUE, "WinHttpCloseHandle failed on closing session, got %d.\n", ret);
}
START_TEST (winhttp)
{
test_OpenRequest();
}
......@@ -101,6 +101,7 @@ TESTBINS = \
usp10_test.exe \
uxtheme_test.exe \
version_test.exe \
winhttp_test.exe \
wininet_test.exe \
winmm_test.exe \
winspool.drv_test.exe \
......@@ -261,6 +262,8 @@ uxtheme_test.exe: $(DLLDIR)/uxtheme/tests/uxtheme_test.exe$(DLLEXT)
cp $(DLLDIR)/uxtheme/tests/uxtheme_test.exe$(DLLEXT) $@ && $(STRIP) $@
version_test.exe: $(DLLDIR)/version/tests/version_test.exe$(DLLEXT)
cp $(DLLDIR)/version/tests/version_test.exe$(DLLEXT) $@ && $(STRIP) $@
winhttp_test.exe: $(DLLDIR)/winhttp/tests/winhttp_test.exe$(DLLEXT)
cp $(DLLDIR)/winhttp/tests/winhttp_test.exe$(DLLEXT) $@ && $(STRIP) $@
wininet_test.exe: $(DLLDIR)/wininet/tests/wininet_test.exe$(DLLEXT)
cp $(DLLDIR)/wininet/tests/wininet_test.exe$(DLLEXT) $@ && $(STRIP) $@
winmm_test.exe: $(DLLDIR)/winmm/tests/winmm_test.exe$(DLLEXT)
......
......@@ -162,6 +162,7 @@ userenv_test.exe TESTRES "userenv_test.exe"
usp10_test.exe TESTRES "usp10_test.exe"
uxtheme_test.exe TESTRES "uxtheme_test.exe"
version_test.exe TESTRES "version_test.exe"
winhttp_test.exe TESTRES "winhttp_test.exe"
wininet_test.exe TESTRES "wininet_test.exe"
winmm_test.exe TESTRES "winmm_test.exe"
winspool.drv_test.exe TESTRES "winspool.drv_test.exe"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment