mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-30 04:13:33 +00:00
[WININET_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866
svn path=/trunk/; revision=72357
This commit is contained in:
@@ -116,6 +116,7 @@ static const char *status_string[MAX_INTERNET_STATUS];
|
||||
|
||||
static HANDLE hCompleteEvent, conn_close_event, conn_wait_event, server_req_rec_event;
|
||||
static DWORD req_error;
|
||||
static BOOL is_ie7plus = TRUE;
|
||||
|
||||
#define TESTF_REDIRECT 0x01
|
||||
#define TESTF_COMPRESSED 0x02
|
||||
@@ -1084,10 +1085,12 @@ static void InternetReadFileExA_test(int flags)
|
||||
CLEAR_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER);
|
||||
CLEAR_NOTIFIED(INTERNET_STATUS_CONNECTED_TO_SERVER);
|
||||
|
||||
rc = InternetReadFileExW(hor, NULL, 0, 0xdeadcafe);
|
||||
ok(!rc && (GetLastError() == ERROR_INVALID_PARAMETER),
|
||||
"InternetReadFileEx should have failed with ERROR_INVALID_PARAMETER instead of %s, %u\n",
|
||||
rc ? "TRUE" : "FALSE", GetLastError());
|
||||
if(is_ie7plus) {
|
||||
rc = InternetReadFileExW(hor, NULL, 0, 0xdeadcafe);
|
||||
ok(!rc && (GetLastError() == ERROR_INVALID_PARAMETER),
|
||||
"InternetReadFileEx should have failed with ERROR_INVALID_PARAMETER instead of %s, %u\n",
|
||||
rc ? "TRUE" : "FALSE", GetLastError());
|
||||
}
|
||||
|
||||
/* tests invalid dwStructSize */
|
||||
inetbuffers.dwStructSize = sizeof(inetbuffers)+1;
|
||||
@@ -4963,6 +4966,9 @@ static void test_http_read(int port)
|
||||
test_request_t req;
|
||||
char buf[4096];
|
||||
|
||||
if(!is_ie7plus)
|
||||
return;
|
||||
|
||||
hCompleteEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
conn_wait_event = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
server_req_rec_event = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
@@ -4994,6 +5000,47 @@ static void test_http_read(int port)
|
||||
|
||||
close_async_handle(req.session, hCompleteEvent, 2);
|
||||
|
||||
open_read_test_request(port, &req,
|
||||
"HTTP/1.1 200 OK\r\n"
|
||||
"Server: winetest\r\n"
|
||||
"Transfer-Encoding: chunked\r\n"
|
||||
"\r\n"
|
||||
"9\r\n123456789");
|
||||
readex_expect_sync_data(req.request, IRF_NO_WAIT, &ib, sizeof(buf), "123456789");
|
||||
readex_expect_async(req.request, IRF_NO_WAIT, &ib, sizeof(buf));
|
||||
|
||||
send_response_and_wait("\r\n1\r\na\r\n1\r\nb\r", FALSE, &ib);
|
||||
readex_expect_sync_data(req.request, IRF_NO_WAIT, &ib, sizeof(buf), "ab");
|
||||
readex_expect_async(req.request, IRF_NO_WAIT, &ib, sizeof(buf));
|
||||
|
||||
send_response_and_wait("\n3\r\nab", FALSE, &ib);
|
||||
readex_expect_sync_data(req.request, IRF_NO_WAIT, &ib, sizeof(buf), "ab");
|
||||
readex_expect_async(req.request, IRF_NO_WAIT, &ib, sizeof(buf));
|
||||
|
||||
send_response_and_wait("c", FALSE, &ib);
|
||||
readex_expect_sync_data(req.request, IRF_NO_WAIT, &ib, sizeof(buf), "c");
|
||||
readex_expect_async(req.request, IRF_NO_WAIT, &ib, sizeof(buf));
|
||||
|
||||
send_response_and_wait("\r\n1\r\nx\r\n0\r\n\r\n", TRUE, &ib);
|
||||
readex_expect_sync_data(req.request, IRF_NO_WAIT, &ib, sizeof(buf), "x");
|
||||
readex_expect_sync_data(req.request, IRF_NO_WAIT, &ib, sizeof(buf), "");
|
||||
|
||||
close_async_handle(req.session, hCompleteEvent, 2);
|
||||
|
||||
open_read_test_request(port, &req,
|
||||
"HTTP/1.1 200 OK\r\n"
|
||||
"Server: winetest\r\n"
|
||||
"Transfer-Encoding: chunked\r\n"
|
||||
"\r\n"
|
||||
"3\r\n123\r\n");
|
||||
readex_expect_sync_data(req.request, IRF_NO_WAIT, &ib, sizeof(buf), "123");
|
||||
readex_expect_async(req.request, IRF_NO_WAIT, &ib, sizeof(buf));
|
||||
|
||||
send_response_and_wait("0\r\n\r\n", TRUE, &ib);
|
||||
readex_expect_sync_data(req.request, IRF_NO_WAIT, &ib, sizeof(buf), "");
|
||||
|
||||
close_async_handle(req.session, hCompleteEvent, 2);
|
||||
|
||||
CloseHandle(hCompleteEvent);
|
||||
CloseHandle(conn_wait_event);
|
||||
CloseHandle(server_req_rec_event);
|
||||
@@ -5007,6 +5054,9 @@ static void test_long_url(int port)
|
||||
DWORD size, len;
|
||||
BOOL ret;
|
||||
|
||||
if(!is_ie7plus)
|
||||
return;
|
||||
|
||||
memset(long_path+strlen(long_path), 'x', sizeof(long_path)-strlen(long_path));
|
||||
long_path[sizeof(long_path)-1] = 0;
|
||||
open_simple_request(&req, "localhost", port, NULL, long_path);
|
||||
@@ -5849,10 +5899,8 @@ static void test_open_url_async(void)
|
||||
* other versions never do. They also hang of following tests. We disable it for everything older
|
||||
* than IE7.
|
||||
*/
|
||||
if(!pInternetGetSecurityInfoByURLA) {
|
||||
win_skip("Skipping async open on too old wininet version.\n");
|
||||
if(!is_ie7plus)
|
||||
return;
|
||||
}
|
||||
|
||||
ctx.req = NULL;
|
||||
ctx.event = CreateEventA(NULL, TRUE, FALSE, "Z:_home_hans_jaman-installer.exe_ev1");
|
||||
@@ -6337,6 +6385,9 @@ static void test_default_service_port(void)
|
||||
char buffer[128];
|
||||
BOOL ret;
|
||||
|
||||
if(!is_ie7plus)
|
||||
return;
|
||||
|
||||
session = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
|
||||
ok(session != NULL, "InternetOpen failed\n");
|
||||
|
||||
@@ -6513,6 +6564,11 @@ START_TEST(http)
|
||||
pInternetSetStatusCallbackW = (void*)GetProcAddress(hdll, "InternetSetStatusCallbackW");
|
||||
pInternetGetSecurityInfoByURLA = (void*)GetProcAddress(hdll, "InternetGetSecurityInfoByURLA");
|
||||
|
||||
if(!pInternetGetSecurityInfoByURLA) {
|
||||
is_ie7plus = FALSE;
|
||||
win_skip("IE6 found. It's too old for some tests.\n");
|
||||
}
|
||||
|
||||
init_status_tests();
|
||||
test_InternetCloseHandle();
|
||||
InternetReadFile_test(INTERNET_FLAG_ASYNC, &test_data[0]);
|
||||
|
||||
@@ -361,11 +361,13 @@ static void test_get_cookie(void)
|
||||
DWORD len;
|
||||
BOOL ret;
|
||||
|
||||
len = 1024;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = InternetGetCookieA("http://www.example.com", NULL, NULL, &len);
|
||||
ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS,
|
||||
"InternetGetCookie should have failed with %s and error %d\n",
|
||||
ret ? "TRUE" : "FALSE", GetLastError());
|
||||
ok(!len, "len = %u\n", len);
|
||||
}
|
||||
|
||||
|
||||
@@ -389,7 +391,7 @@ static void test_complicated_cookie(void)
|
||||
/* Technically illegal! domain should require 2 dots, but native wininet accepts it */
|
||||
ret = InternetSetCookieA("http://www.example.com",NULL,"E=F; domain=example.com");
|
||||
ok(ret == TRUE,"InternetSetCookie failed\n");
|
||||
ret = InternetSetCookieA("http://www.example.com",NULL,"G=H; domain=.example.com; path=/foo");
|
||||
ret = InternetSetCookieA("http://www.example.com",NULL,"G=H; domain=.example.com; invalid=attr; path=/foo");
|
||||
ok(ret == TRUE,"InternetSetCookie failed\n");
|
||||
ret = InternetSetCookieA("http://www.example.com/bar.html",NULL,"I=J; domain=.example.com");
|
||||
ok(ret == TRUE,"InternetSetCookie failed\n");
|
||||
@@ -1068,7 +1070,8 @@ static void test_IsDomainLegalCookieDomainW(void)
|
||||
|
||||
static void test_PrivacyGetSetZonePreferenceW(void)
|
||||
{
|
||||
DWORD ret, zone, type, template, old_template;
|
||||
DWORD ret, zone, type, template, old_template, pref_size = 0;
|
||||
WCHAR pref[256];
|
||||
|
||||
zone = 3;
|
||||
type = 0;
|
||||
@@ -1079,6 +1082,14 @@ static void test_PrivacyGetSetZonePreferenceW(void)
|
||||
ret = pPrivacyGetZonePreferenceW(zone, type, &old_template, NULL, NULL);
|
||||
ok(ret == 0, "expected ret == 0, got %u\n", ret);
|
||||
|
||||
trace("template %u\n", old_template);
|
||||
|
||||
if(old_template == PRIVACY_TEMPLATE_ADVANCED) {
|
||||
pref_size = sizeof(pref)/sizeof(WCHAR);
|
||||
ret = pPrivacyGetZonePreferenceW(zone, type, &old_template, pref, &pref_size);
|
||||
ok(ret == 0, "expected ret == 0, got %u\n", ret);
|
||||
}
|
||||
|
||||
template = 5;
|
||||
ret = pPrivacySetZonePreferenceW(zone, type, template, NULL);
|
||||
ok(ret == 0, "expected ret == 0, got %u\n", ret);
|
||||
@@ -1089,7 +1100,7 @@ static void test_PrivacyGetSetZonePreferenceW(void)
|
||||
ok(template == 5, "expected template == 5, got %u\n", template);
|
||||
|
||||
template = 5;
|
||||
ret = pPrivacySetZonePreferenceW(zone, type, old_template, NULL);
|
||||
ret = pPrivacySetZonePreferenceW(zone, type, old_template, pref_size ? pref : NULL);
|
||||
ok(ret == 0, "expected ret == 0, got %u\n", ret);
|
||||
}
|
||||
|
||||
@@ -1177,6 +1188,28 @@ static void test_InternetSetOption(void)
|
||||
ok(ret == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
|
||||
}
|
||||
|
||||
static void test_end_browser_session(void)
|
||||
{
|
||||
DWORD len;
|
||||
BOOL ret;
|
||||
|
||||
ret = InternetSetCookieA("http://www.example.com/test_end", NULL, "A=B");
|
||||
ok(ret == TRUE, "InternetSetCookie failed\n");
|
||||
|
||||
len = 1024;
|
||||
ret = InternetGetCookieA("http://www.example.com/test_end", NULL, NULL, &len);
|
||||
ok(ret == TRUE,"InternetGetCookie failed\n");
|
||||
ok(len != 0, "len = 0\n");
|
||||
|
||||
ret = InternetSetOptionA(NULL, INTERNET_OPTION_END_BROWSER_SESSION, NULL, 0);
|
||||
ok(ret, "InternetSetOptio(INTERNET_OPTION_END_BROWSER_SESSION) failed: %u\n", GetLastError());
|
||||
|
||||
len = 1024;
|
||||
ret = InternetGetCookieA("http://www.example.com/test_end", NULL, NULL, &len);
|
||||
ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookie returned %x (%u)\n", ret, GetLastError());
|
||||
ok(!len, "len = %u\n", len);
|
||||
}
|
||||
|
||||
#define verifyProxyEnable(e) r_verifyProxyEnable(__LINE__, e)
|
||||
static void r_verifyProxyEnable(LONG l, DWORD exp)
|
||||
{
|
||||
@@ -1809,4 +1842,5 @@ START_TEST(internet)
|
||||
win_skip("Privacy[SG]etZonePreferenceW are not available\n");
|
||||
|
||||
test_InternetSetOption();
|
||||
test_end_browser_session();
|
||||
}
|
||||
|
||||
@@ -534,26 +534,26 @@ static void InternetCrackUrl_test(void)
|
||||
* The last two (path and extrainfo) are the same for all versions
|
||||
* of the wininet.dll.
|
||||
*/
|
||||
copy_compsA(&urlSrc, &urlComponents, 0, 1024, 1024, 1024, 2048, 1024);
|
||||
copy_compsA(&urlSrc, &urlComponents, 0, 1024, 1024, 1024, 1024, 1024);
|
||||
SetLastError(0xdeadbeef);
|
||||
firstret = InternetCrackUrlA(TEST_URL3, 0, ICU_DECODE, &urlComponents);
|
||||
firstGLE = GetLastError();
|
||||
|
||||
copy_compsA(&urlSrc, &urlComponents, 32, 0, 1024, 1024, 2048, 1024);
|
||||
copy_compsA(&urlSrc, &urlComponents, 32, 0, 1024, 1024, 1024, 1024);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = InternetCrackUrlA(TEST_URL3, 0, ICU_DECODE, &urlComponents);
|
||||
GLE = GetLastError();
|
||||
ok(ret==firstret && (GLE==firstGLE), "InternetCrackUrl returned %d with GLE=%d (expected to return %d)\n",
|
||||
ret, GLE, firstret);
|
||||
|
||||
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 0, 1024, 2048, 1024);
|
||||
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 0, 1024, 1024, 1024);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = InternetCrackUrlA(TEST_URL3, 0, ICU_DECODE, &urlComponents);
|
||||
GLE = GetLastError();
|
||||
ok(ret==firstret && (GLE==firstGLE), "InternetCrackUrl returned %d with GLE=%d (expected to return %d)\n",
|
||||
ret, GLE, firstret);
|
||||
|
||||
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 0, 2048, 1024);
|
||||
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 0, 1024, 1024);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = InternetCrackUrlA(TEST_URL3, 0, ICU_DECODE, &urlComponents);
|
||||
GLE = GetLastError();
|
||||
@@ -569,7 +569,7 @@ static void InternetCrackUrl_test(void)
|
||||
"InternetCrackUrl returned %d with GLE=%d (expected to return 0 and ERROR_INVALID_HANDLE or ERROR_INSUFFICIENT_BUFFER)\n",
|
||||
ret, GLE);
|
||||
|
||||
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 0);
|
||||
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 1024, 0);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = InternetCrackUrlA(TEST_URL3, 0, ICU_DECODE, &urlComponents);
|
||||
GLE = GetLastError();
|
||||
@@ -586,7 +586,7 @@ static void InternetCrackUrl_test(void)
|
||||
"InternetCrackUrl returned %d with GLE=%d (expected to return 0 and ERROR_INVALID_PARAMETER)\n",
|
||||
ret, GLE);
|
||||
|
||||
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
|
||||
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 1024, 1024);
|
||||
ret = InternetCrackUrlA("about://host/blank", 0,0,&urlComponents);
|
||||
ok(ret, "InternetCrackUrl failed with %d\n", GetLastError());
|
||||
ok(!strcmp(urlComponents.lpszScheme, "about"), "lpszScheme was \"%s\" instead of \"about\"\n", urlComponents.lpszScheme);
|
||||
@@ -595,7 +595,7 @@ static void InternetCrackUrl_test(void)
|
||||
|
||||
/* try a NULL lpszUrl */
|
||||
SetLastError(0xdeadbeef);
|
||||
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
|
||||
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 1024, 1024);
|
||||
ret = InternetCrackUrlA(NULL, 0, 0, &urlComponents);
|
||||
GLE = GetLastError();
|
||||
ok(ret == FALSE, "Expected InternetCrackUrl to fail\n");
|
||||
@@ -605,7 +605,7 @@ static void InternetCrackUrl_test(void)
|
||||
* we just need to fail and not return success
|
||||
*/
|
||||
SetLastError(0xdeadbeef);
|
||||
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
|
||||
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 1024, 1024);
|
||||
ret = InternetCrackUrlA("", 0, 0, &urlComponents);
|
||||
GLE = GetLastError();
|
||||
ok(ret == FALSE, "Expected InternetCrackUrl to fail\n");
|
||||
@@ -613,7 +613,7 @@ static void InternetCrackUrl_test(void)
|
||||
|
||||
/* Invalid Call: must set size of components structure (Windows only
|
||||
* enforces this on the InternetCrackUrlA version of the call) */
|
||||
copy_compsA(&urlSrc, &urlComponents, 0, 1024, 1024, 1024, 2048, 1024);
|
||||
copy_compsA(&urlSrc, &urlComponents, 0, 1024, 1024, 1024, 1024, 1024);
|
||||
SetLastError(0xdeadbeef);
|
||||
urlComponents.dwStructSize = 0;
|
||||
ret = InternetCrackUrlA(TEST_URL, 0, 0, &urlComponents);
|
||||
@@ -624,7 +624,7 @@ static void InternetCrackUrl_test(void)
|
||||
/* Invalid Call: size of dwStructSize must be one of the "standard" sizes
|
||||
* of the URL_COMPONENTS structure (Windows only enforces this on the
|
||||
* InternetCrackUrlA version of the call) */
|
||||
copy_compsA(&urlSrc, &urlComponents, 0, 1024, 1024, 1024, 2048, 1024);
|
||||
copy_compsA(&urlSrc, &urlComponents, 0, 1024, 1024, 1024, 1024, 1024);
|
||||
SetLastError(0xdeadbeef);
|
||||
urlComponents.dwStructSize = sizeof(urlComponents) + 1;
|
||||
ret = InternetCrackUrlA(TEST_URL, 0, 0, &urlComponents);
|
||||
@@ -717,11 +717,7 @@ static void InternetCrackUrlW_test(void)
|
||||
ok( comp.dwExtraInfoLength == 29, "extra length wrong\n");
|
||||
|
||||
urlpart[0]=0;
|
||||
scheme[0]=0;
|
||||
extra[0]=0;
|
||||
host[0]=0;
|
||||
user[0]=0;
|
||||
pwd[0]=0;
|
||||
memset(&comp, 0, sizeof comp);
|
||||
comp.dwStructSize = sizeof comp;
|
||||
comp.lpszHostName = host;
|
||||
@@ -739,11 +735,7 @@ static void InternetCrackUrlW_test(void)
|
||||
ok( comp.dwExtraInfoLength == 0, "extra length wrong\n");
|
||||
|
||||
urlpart[0]=0;
|
||||
scheme[0]=0;
|
||||
extra[0]=0;
|
||||
host[0]=0;
|
||||
user[0]=0;
|
||||
pwd[0]=0;
|
||||
memset(&comp, 0, sizeof comp);
|
||||
comp.dwStructSize = sizeof comp;
|
||||
comp.lpszHostName = host;
|
||||
@@ -814,6 +806,19 @@ static void InternetCrackUrlW_test(void)
|
||||
ok( r, "InternetCrackUrlW failed unexpectedly\n");
|
||||
ok( host[0] == 'x', "host should be x.org\n");
|
||||
ok( urlpart[0] == 0, "urlpart should be empty\n");
|
||||
|
||||
urlpart[0] = 0;
|
||||
host[0] = 0;
|
||||
memset(&comp, 0, sizeof(comp));
|
||||
comp.dwStructSize = sizeof(comp);
|
||||
comp.lpszHostName = host;
|
||||
comp.dwHostNameLength = sizeof(host)/sizeof(host[0]);
|
||||
comp.lpszUrlPath = urlpart;
|
||||
comp.dwUrlPathLength = sizeof(urlpart)/sizeof(urlpart[0]);
|
||||
r = InternetCrackUrlW(url3, 0, ICU_DECODE, &comp);
|
||||
ok(r, "InternetCrackUrlW failed unexpectedly\n");
|
||||
ok(!strcmp_wa(host, "x.org"), "host is %s, should be x.org\n", wine_dbgstr_w(host));
|
||||
todo_wine ok(urlpart[0] == 0, "urlpart should be empty\n");
|
||||
}
|
||||
|
||||
static void fill_url_components(URL_COMPONENTSA *lpUrlComponents)
|
||||
|
||||
Reference in New Issue
Block a user