https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7f95c141535acb78c7062a...
commit 7f95c141535acb78c7062a91349aa4a57ce37edc Author: Amine Khaldi amine.khaldi@reactos.org AuthorDate: Fri Mar 23 12:35:59 2018 +0100 Commit: Amine Khaldi amine.khaldi@reactos.org CommitDate: Fri Mar 23 12:35:59 2018 +0100
[URLMON_WINETEST] Sync with Wine Staging 3.3. CORE-14434 --- modules/rostests/winetests/urlmon/generated.c | 13 +- modules/rostests/winetests/urlmon/misc.c | 30 +-- modules/rostests/winetests/urlmon/protocol.c | 68 +++--- modules/rostests/winetests/urlmon/sec_mgr.c | 29 +-- modules/rostests/winetests/urlmon/stream.c | 21 +- modules/rostests/winetests/urlmon/uri.c | 315 +++++++++++++++++++++++--- modules/rostests/winetests/urlmon/url.c | 35 +-- 7 files changed, 376 insertions(+), 135 deletions(-)
diff --git a/modules/rostests/winetests/urlmon/generated.c b/modules/rostests/winetests/urlmon/generated.c index 20594d91f1..75358140a1 100644 --- a/modules/rostests/winetests/urlmon/generated.c +++ b/modules/rostests/winetests/urlmon/generated.c @@ -5,10 +5,6 @@ * Unit tests for data structure packing */
-#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #ifndef __REACTOS__ #define WINVER 0x0501 #define _WIN32_IE 0x0501 @@ -18,12 +14,11 @@ #define WINE_NOWINSOCK
#include <stdarg.h> -#include <windef.h> -#include <winbase.h> -#include <objbase.h> -#include <urlmon.h> +#include "windef.h" +#include "winbase.h" +#include "urlmon.h"
-#include <wine/test.h> +#include "wine/test.h"
/*********************************************************************** * Compatibility macros diff --git a/modules/rostests/winetests/urlmon/misc.c b/modules/rostests/winetests/urlmon/misc.c index 875334d68f..e88c960497 100644 --- a/modules/rostests/winetests/urlmon/misc.c +++ b/modules/rostests/winetests/urlmon/misc.c @@ -16,27 +16,22 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #define COBJMACROS #define CONST_VTABLE #define NONAMELESSUNION
#include <wine/test.h> -//#include <stdarg.h> -//#include <stddef.h> +#include <stdarg.h> +#include <stddef.h> #include <stdio.h>
-//#include "windef.h" -//#include "winbase.h" -#include <winreg.h> -#include <winnls.h> -#include <ole2.h> -//#include "urlmon.h" +#include "windef.h" +#include "winbase.h" +#include "ole2.h" +#include "urlmon.h"
-#include <initguid.h> +#include "initguid.h" +#include "wine/heap.h"
DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
@@ -94,11 +89,6 @@ static int strcmp_wa(const WCHAR *strw, const char *stra) return lstrcmpW(strw, buf); }
-static void heap_free(void *mem) -{ - HeapFree(GetProcessHeap(), 0, mem); -} - static WCHAR *a2w(const char *str) { WCHAR *ret; @@ -2342,7 +2332,7 @@ static void test_bsc_marshaling(void)
rem_bindinfo.stgmedData.tymed = TYMED_HGLOBAL;
- buf = GlobalAlloc(0, sizeof(5)); + buf = GlobalAlloc(0, 5); strcpy(buf, "test"); rem_bindinfo.stgmedData.u.hGlobal = buf; rem_bindinfo.cbstgmedData = 5; @@ -2559,7 +2549,7 @@ static void test_bsc_marshaling(void)
rem_bindinfo.stgmedData.tymed = TYMED_HGLOBAL;
- buf = GlobalAlloc(0, sizeof(5)); + buf = GlobalAlloc(0, 5); strcpy(buf, "test"); rem_bindinfo.stgmedData.u.hGlobal = buf; rem_bindinfo.cbstgmedData = 5; diff --git a/modules/rostests/winetests/urlmon/protocol.c b/modules/rostests/winetests/urlmon/protocol.c index 4012cf1d19..50fe999dfe 100644 --- a/modules/rostests/winetests/urlmon/protocol.c +++ b/modules/rostests/winetests/urlmon/protocol.c @@ -16,23 +16,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #define COBJMACROS #define CONST_VTABLE
#include <wine/test.h> -//#include <stdarg.h> +#include <stdarg.h> #include <stdio.h>
-//#include "windef.h" -//#include "winbase.h" -#include <winnls.h> -#include <ole2.h> -#include <urlmon.h> -#include <wininet.h> +#include "windef.h" +#include "winbase.h" +#include "ole2.h" +#include "urlmon.h" +#include "wininet.h"
static HRESULT (WINAPI *pCoInternetGetSession)(DWORD, IInternetSession **, DWORD); static HRESULT (WINAPI *pReleaseBindInfo)(BINDINFO*); @@ -945,6 +940,39 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, return S_OK; }
+static void test_http_info(IInternetProtocol *protocol) +{ + IWinInetHttpInfo *info; + char buf[1024]; + DWORD size, len; + HRESULT hres; + + static const WCHAR connectionW[] = {'c','o','n','n','e','c','t','i','o','n',0}; + + hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&info); + ok(hres == S_OK, "Could not get IWinInterHttpInfo iface: %08x\n", hres); + + size = sizeof(buf); + strcpy(buf, "connection"); + hres = IWinInetHttpInfo_QueryInfo(info, HTTP_QUERY_CUSTOM, buf, &size, NULL, NULL); + if(tested_protocol != FTP_TEST) { + ok(hres == S_OK, "QueryInfo failed: %08x\n", hres); + + ok(!strcmp(buf, "Keep-Alive"), "buf = %s\n", buf); + len = strlen(buf); + ok(size == len, "size = %u, expected %u\n", size, len); + + size = sizeof(buf); + memcpy(buf, connectionW, sizeof(connectionW)); + hres = IWinInetHttpInfo_QueryInfo(info, HTTP_QUERY_CUSTOM, buf, &size, NULL, NULL); + ok(hres == S_FALSE, "QueryInfo returned %08x\n", hres); + }else { + ok(hres == S_FALSE, "QueryInfo failed: %08x\n", hres); + } + + IWinInetHttpInfo_Release(info); +} + static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax) { @@ -1076,6 +1104,9 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR "grcfBSCF = %08x\n", grfBSCF); }
+ if((grfBSCF & BSCF_FIRSTDATANOTIFICATION) && !binding_test) + test_http_info(async_protocol); + if(!(bindf & BINDF_FROMURLMON) && !(grfBSCF & BSCF_LASTDATANOTIFICATION)) { if(state == STATE_CONNECTING) { @@ -3140,19 +3171,6 @@ static void test_protocol_terminate(IInternetProtocol *protocol) ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres); }
-static void test_http_info(IInternetProtocol *protocol) -{ - IWinInetHttpInfo *info; - HRESULT hres; - - hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&info); - ok(hres == S_OK, "Could not get IWinInterHttpInfo iface: %08x\n", hres); - - /* TODO */ - - IWinInetHttpInfo_Release(info); -} - /* is_first refers to whether this is the first call to this function * _for this url_ */ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tymed) @@ -3194,7 +3212,6 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym ULONG ref;
test_priority(async_protocol); - test_http_info(async_protocol);
SET_EXPECT(ReportProgress_COOKIE_SENT); if(http_is_first) { @@ -3463,7 +3480,6 @@ static void test_ftp_protocol(void) ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
test_priority(async_protocol); - test_http_info(async_protocol);
SET_EXPECT(GetBindInfo); SET_EXPECT(ReportProgress_FINDINGRESOURCE); diff --git a/modules/rostests/winetests/urlmon/sec_mgr.c b/modules/rostests/winetests/urlmon/sec_mgr.c index 3bb4a3e89e..7c57d9e375 100644 --- a/modules/rostests/winetests/urlmon/sec_mgr.c +++ b/modules/rostests/winetests/urlmon/sec_mgr.c @@ -18,31 +18,27 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #define COBJMACROS #define CONST_VTABLE -#define NONAMELESSUNION
/* needed for IInternetZoneManagerEx2 */ +#ifdef __REACTOS__ #undef _WIN32_IE +#endif #define _WIN32_IE 0x0700
#include <wine/test.h> -//#include <stdarg.h> -//#include <stddef.h> +#include <stdarg.h> +#include <stddef.h> #include <stdio.h>
-//#include "windef.h" -//#include "winbase.h" -#include <winreg.h> -#include <winnls.h> -#include <ole2.h> -//#include "urlmon.h" +#include "windef.h" +#include "winbase.h" +#include "ole2.h" +#include "urlmon.h"
-//#include "initguid.h" +#include "initguid.h" +#include <wine/heap.h>
#define URLZONE_CUSTOM URLZONE_USER_MIN+1 #define URLZONE_CUSTOM2 URLZONE_CUSTOM+1 @@ -184,11 +180,6 @@ static int strcmp_w(const WCHAR *str1, const WCHAR *str2) return memcmp(str1, str2, len1*sizeof(WCHAR)); }
-static inline void heap_free(void *mem) -{ - HeapFree(GetProcessHeap(), 0, mem); -} - static inline LPWSTR a2w(LPCSTR str) { LPWSTR ret = NULL; diff --git a/modules/rostests/winetests/urlmon/stream.c b/modules/rostests/winetests/urlmon/stream.c index afa91cc02b..6717198b31 100644 --- a/modules/rostests/winetests/urlmon/stream.c +++ b/modules/rostests/winetests/urlmon/stream.c @@ -16,23 +16,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #define COBJMACROS #define CONST_VTABLE
#include <wine/test.h> -//#include <stdarg.h> -//#include <stddef.h> - -//#include "windef.h" -//#include "winbase.h" -#include <winnls.h> -#include <ole2.h> -//#include "urlmon.h" -#include <wininet.h> +#include <stdarg.h> +#include <stddef.h> + +#include "windef.h" +#include "winbase.h" +#include "ole2.h" +#include "urlmon.h" +#include "wininet.h"
#define DEFINE_EXPECT(func) \ static BOOL expect_ ## func = FALSE, called_ ## func = FALSE diff --git a/modules/rostests/winetests/urlmon/uri.c b/modules/rostests/winetests/urlmon/uri.c index fb9a7d08f6..90f51bf5dd 100644 --- a/modules/rostests/winetests/urlmon/uri.c +++ b/modules/rostests/winetests/urlmon/uri.c @@ -18,28 +18,22 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #include <wine/test.h> -//#include <stdarg.h> -//#include <stddef.h> +#include <stdarg.h> +#include <stddef.h>
#define COBJMACROS #define CONST_VTABLE #define WIN32_LEAN_AND_MEAN
-//#include "windef.h" -//#include "winbase.h" -#include <winreg.h> -#include <winnls.h> -#include <ole2.h> -//#include "urlmon.h" -#include <shlwapi.h> -#include <wininet.h> -#include <strsafe.h> -#include <initguid.h> +#include "windef.h" +#include "winbase.h" +#include "urlmon.h" +#include "shlwapi.h" +#include "wininet.h" +#include "strsafe.h" +#include "initguid.h" +#include <wine/heap.h>
DEFINE_GUID(CLSID_CUri, 0xDF2FCE13, 0x25EC, 0x45BB, 0x9D,0x4C, 0xCE,0xCD,0x47,0xC2,0x43,0x0C);
@@ -4805,6 +4799,266 @@ static const uri_properties uri_tests[] = { {URL_SCHEME_FILE,S_OK,FALSE}, {URLZONE_INVALID,E_NOTIMPL,FALSE} } + }, + /* Path with Unicode characters. Unicode characters should not be encoded */ + {/* "http://127.0.0.1/%E6%B5%8B%E8%AF%95/test.txt" with Chinese in UTF-8 encoding */ + "http://127.0.0.1/%5CxE6%5CxB5%5Cx8B%5CxE8%5CxAF%5Cx95/test.txt", 0, S_OK, FALSE, + { + {"http://127.0.0.1/%5CxE6%5CxB5%5Cx8B%5CxE8%5CxAF%5Cx95/test.txt%22,S_OK,FALSE..., + {"127.0.0.1",S_OK,FALSE}, + {"http://127.0.0.1/%5CxE6%5CxB5%5Cx8B%5CxE8%5CxAF%5Cx95/test.txt%22,S_OK,FALSE..., + {"",S_FALSE,FALSE}, + {".txt",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"127.0.0.1",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK,FALSE}, + {"/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"http://127.0.0.1/%5CxE6%5CxB5%5Cx8B%5CxE8%5CxAF%5Cx95/test.txt%22,S_OK,FALSE..., + {"http",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_IPV4,S_OK,FALSE}, + {80,S_OK,FALSE}, + {URL_SCHEME_HTTP,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, + { "file:\xE6\xB5\x8B\xE8\xAF\x95.html", 0, S_OK, FALSE, + { + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"file:\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {".html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK,FALSE}, + {"\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"file:\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK,FALSE}, + {"file",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_UNKNOWN,S_OK,FALSE}, + {0,S_FALSE,FALSE}, + {URL_SCHEME_FILE,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, + /* Username with Unicode characters. Unicode characters should not be encoded */ + { "ftp://\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999/dir/foobar.txt", 0, S_OK, FALSE, + { + {"ftp://\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE}, + {"\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999",S_OK,FALSE}, + {"ftp://ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE}, + {"winehq.org",S_OK,FALSE}, + {".txt",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"ftp.winehq.org",S_OK,FALSE}, + {"wine",S_OK,FALSE}, + {"/dir/foobar.txt",S_OK,FALSE}, + {"/dir/foobar.txt",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"ftp://\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE}, + {"ftp",S_OK,FALSE}, + {"\xE6\xB5\x8B\xE8\xAF\x95:wine",S_OK,FALSE}, + {"\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE} + }, + { + {Uri_HOST_DNS,S_OK,FALSE}, + {9999,S_OK,FALSE}, + {URL_SCHEME_FTP,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, + /* Password with Unicode characters. Unicode characters should not be encoded */ + { "ftp://winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999/dir/foobar.txt", 0, S_OK, FALSE, + { + {"ftp://winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE}, + {"winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999",S_OK,FALSE}, + {"ftp://ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE}, + {"winehq.org",S_OK,FALSE}, + {".txt",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"ftp.winehq.org",S_OK,FALSE}, + {"\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE}, + {"/dir/foobar.txt",S_OK,FALSE}, + {"/dir/foobar.txt",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"ftp://winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE}, + {"ftp",S_OK,FALSE}, + {"winepass:\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE}, + {"winepass",S_OK,FALSE} + }, + { + {Uri_HOST_DNS,S_OK,FALSE}, + {9999,S_OK,FALSE}, + {URL_SCHEME_FTP,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, + /* Query with Unicode characters. Unicode characters should not be encoded */ + { "http://www.winehq.org/tests/..?query=%5CxE6%5CxB5%5Cx8B%5CxE8%5CxAF%5Cx95&am...", 0, S_OK, FALSE, + { + {"http://www.winehq.org/?query=%5CxE6%5CxB5%5Cx8B%5CxE8%5CxAF%5Cx95&return..., + {"www.winehq.org",S_OK,FALSE}, + {"http://www.winehq.org/?query=%5CxE6%5CxB5%5Cx8B%5CxE8%5CxAF%5Cx95&return..., + {"winehq.org",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"www.winehq.org",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"/",S_OK,FALSE}, + {"/?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK,FALSE}, + {"?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK,FALSE}, + {"http://www.winehq.org/tests/..?query=%5CxE6%5CxB5%5Cx8B%5CxE8%5CxAF%5Cx95&am..., + {"http",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_DNS,S_OK,FALSE}, + {80,S_OK,FALSE}, + {URL_SCHEME_HTTP,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE}, + } + }, + /* Fragment with Unicode characters. Unicode characters should not be encoded */ + { "http://www.winehq.org/tests/#%5CxE6%5CxB5%5Cx8B%5CxE8%5CxAF%5Cx95", 0, S_OK, FALSE, + { + {"http://www.winehq.org/tests/#%5CxE6%5CxB5%5Cx8B%5CxE8%5CxAF%5Cx95%22,S_OK,FA..., + {"www.winehq.org",S_OK,FALSE}, + {"http://www.winehq.org/tests/#%5CxE6%5CxB5%5Cx8B%5CxE8%5CxAF%5Cx95%22,S_OK,FA..., + {"winehq.org",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"#\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE}, + {"www.winehq.org",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"/tests/",S_OK,FALSE}, + {"/tests/",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"http://www.winehq.org/tests/#%5CxE6%5CxB5%5Cx8B%5CxE8%5CxAF%5Cx95%22,S_OK,FA..., + {"http",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_DNS,S_OK,FALSE}, + {80,S_OK,FALSE}, + {URL_SCHEME_HTTP,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE}, + } + }, + /* ZERO WIDTH JOINER as non-printing Unicode characters should not be encoded if not preprocessed. */ + { "file:a\xE2\x80\x8D.html", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE, + { + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"file:a\xE2\x80\x8D.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {".html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"a\xE2\x80\x8D.html",S_OK,FALSE}, + {"a\xE2\x80\x8D.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"file:a\xE2\x80\x8D.html",S_OK,FALSE}, + {"file",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_UNKNOWN,S_OK,FALSE}, + {0,S_FALSE,FALSE}, + {URL_SCHEME_FILE,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, + /* LEFT-TO-RIGHT MARK as non-printing Unicode characters should not be encoded if not preprocessed. */ + { "file:ab\xE2\x80\x8E.html", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE, + { + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"file:ab\xE2\x80\x8D.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {".html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"ab\xE2\x80\x8D.html",S_OK,FALSE}, + {"ab\xE2\x80\x8D.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"file:ab\xE2\x80\x8D.html",S_OK,FALSE}, + {"file",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_UNKNOWN,S_OK,FALSE}, + {0,S_FALSE,FALSE}, + {URL_SCHEME_FILE,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, + /* Invalid Unicode characters should not be filtered */ + { "file:ab\xc3\x28.html", 0, S_OK, FALSE, + { + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"file:ab\xc3\x28.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {".html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"ab\xc3\x28.html",S_OK,FALSE}, + {"ab\xc3\x28.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"file:ab\xc3\x28.html",S_OK,FALSE}, + {"file",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_UNKNOWN,S_OK,FALSE}, + {0,S_FALSE,FALSE}, + {URL_SCHEME_FILE,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, + /* Make sure % encoded unicode characters are not decoded. */ + { "ftp://%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com/", 0, S_OK, FALSE, + { + {"ftp://%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com/",S_OK,FALSE}, + {"%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com",S_OK,FALSE}, + {"ftp://ftp.google.com/",S_OK,FALSE}, + {"google.com",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"ftp.google.com",S_OK,FALSE}, + {"%E6%B5%8B%E8%AF%95",S_OK,FALSE}, + {"/",S_OK,FALSE}, + {"/",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"ftp://%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com/",S_OK,FALSE}, + {"ftp",S_OK,FALSE}, + {"%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95",S_OK,FALSE}, + {"%E6%B5%8B%E8%AF%95",S_OK,FALSE} + }, + { + {Uri_HOST_DNS,S_OK,FALSE}, + {21,S_OK,FALSE}, + {URL_SCHEME_FTP,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } } };
@@ -7396,6 +7650,9 @@ static const uri_parse_test uri_parse_tests[] = { {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\te%XX t\",S_OK,FALSE}, {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\server\test",S_OK,FALSE}, {"http://google.com/%22,0,PARSE_PATH_FROM_URL,0,%22%22,E_INVALIDARG,FALSE%7D, + {"file:/c:/dir/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\dir\test.mp3",S_OK}, + {"file:/c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\test.mp3",S_OK}, + {"file://c:\test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\test.mp3",S_OK},
/* PARSE_URL_FROM_PATH tests. */ /* This function almost seems to useless (just returns the absolute uri). */ @@ -7432,24 +7689,14 @@ static inline LPWSTR a2w(LPCSTR str) { LPWSTR ret = NULL;
if(str) { - DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); + DWORD len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0); ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); + MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len); }
return ret; }
-static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size) -{ - return HeapAlloc(GetProcessHeap(), 0, size); -} - -static inline BOOL heap_free(void *mem) -{ - return HeapFree(GetProcessHeap(), 0, mem); -} - static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) { LPWSTR strAW = a2w(strA); DWORD ret = lstrcmpW(strAW, strB); @@ -8113,8 +8360,12 @@ static void test_IUri_GetPropertyLength(void) { for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) { DWORD expectedLen, receivedLen; uri_str_property prop = test.str_props[j]; + LPWSTR expectedValueW;
expectedLen = lstrlenA(prop.value); + /* Value may be unicode encoded */ + expectedValueW = a2w(prop.value); + expectedLen = lstrlenW(expectedValueW);
/* This won't be necessary once GetPropertyLength is implemented. */ receivedLen = -1; @@ -10573,11 +10824,11 @@ static void test_CoInternetParseIUri(void) { if(SUCCEEDED(hr)) { DWORD len = lstrlenA(test.property); ok(!strcmp_aw(test.property, result) || (test.property2 && !strcmp_aw(test.property2, result)), - "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n", - test.property, wine_dbgstr_w(result), i); + "Error: Expected %s but got %s instead on uri_parse_tests[%d] - %s.\n", + test.property, wine_dbgstr_w(result), i, wine_dbgstr_w(uriW)); ok(len == result_len || (test.property2 && lstrlenA(test.property2) == result_len), - "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n", - len, result_len, i); + "Error: Expected %d, but got %d instead on uri_parse_tests[%d] - %s.\n", + len, result_len, i, wine_dbgstr_w(uriW)); } else { ok(!result_len, "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n", diff --git a/modules/rostests/winetests/urlmon/url.c b/modules/rostests/winetests/urlmon/url.c index 1cc886379e..70234ff3fd 100644 --- a/modules/rostests/winetests/urlmon/url.c +++ b/modules/rostests/winetests/urlmon/url.c @@ -19,29 +19,21 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - -//#include <stdarg.h> +#include <stdarg.h> #include <stdio.h>
#define COBJMACROS #define NONAMELESSUNION #define CONST_VTABLE
-#include <windef.h> -#include <winbase.h> -#include <winnls.h> -#include <winreg.h> -#include <wingdi.h> -#include <objbase.h> -//#include "initguid.h" -//#include "urlmon.h" -#include <wininet.h> -#include <mshtml.h> +#include "windef.h" +#include "winbase.h" +#include "initguid.h" +#include "urlmon.h" +#include "wininet.h" +#include "mshtml.h"
-#include <wine/test.h> +#include "wine/test.h"
static HRESULT (WINAPI *pCreateAsyncBindCtxEx)(IBindCtx *, DWORD, IBindStatusCallback *, IEnumFORMATETC *, IBindCtx **, DWORD); @@ -190,6 +182,7 @@ static HRESULT abort_hres; static BOOL have_IHttpNegotiate2, use_bscex, is_async_prot; static BOOL test_redirect, use_cache_file, callback_read, no_callback, test_abort; static WCHAR cache_file_name[MAX_PATH]; +static WCHAR http_cache_file[MAX_PATH]; static BOOL only_check_prot_args = FALSE; static BOOL invalid_cn_accepted = FALSE; static BOOL abort_start = FALSE; @@ -1935,6 +1928,14 @@ static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallbackEx *iface, HRES ok( WaitForSingleObject(complete_event2, 90000) == WAIT_OBJECT_0, "wait timed out\n" ); }
+ if(test_protocol == HTTP_TEST && !emulate_protocol && http_cache_file[0]) { + HANDLE file = CreateFileW(http_cache_file, DELETE, FILE_SHARE_DELETE, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + ok(file == INVALID_HANDLE_VALUE, "expected INVALID_HANDLE_VALUE, got %p\n", file); + ok(GetLastError() == ERROR_SHARING_VIOLATION, "expected ERROR_SHARING_VIOLATION, got %u\n", GetLastError()); + http_cache_file[0] = 0; + } + return S_OK; }
@@ -2091,6 +2092,8 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallbackEx *iface, DW else if(emulate_protocol) ok(!lstrcmpW(pstgmed->u.lpszFileName, cache_fileW), "unexpected file name %s\n", wine_dbgstr_w(pstgmed->u.lpszFileName)); + else if(test_protocol == HTTP_TEST) + lstrcpyW(http_cache_file, pstgmed->u.lpszFileName); else ok(pstgmed->u.lpszFileName != NULL, "lpszFileName == NULL\n"); }