Author: akhaldi Date: Fri Aug 19 09:46:10 2016 New Revision: 72357
URL: http://svn.reactos.org/svn/reactos?rev=72357&view=rev Log: [WININET_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866
Modified: trunk/rostests/winetests/wininet/http.c trunk/rostests/winetests/wininet/internet.c trunk/rostests/winetests/wininet/url.c
Modified: trunk/rostests/winetests/wininet/http.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wininet/http.c?r... ============================================================================== --- trunk/rostests/winetests/wininet/http.c [iso-8859-1] (original) +++ trunk/rostests/winetests/wininet/http.c [iso-8859-1] Fri Aug 19 09:46:10 2016 @@ -116,6 +116,7 @@
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 @@ 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 @@ 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 @@
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); @@ -5006,6 +5053,9 @@ test_request_t req; 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; @@ -5849,10 +5899,8 @@ * 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 @@ 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");
@@ -6512,6 +6563,11 @@ pInternetSetStatusCallbackA = (void*)GetProcAddress(hdll, "InternetSetStatusCallbackA"); 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();
Modified: trunk/rostests/winetests/wininet/internet.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wininet/internet... ============================================================================== --- trunk/rostests/winetests/wininet/internet.c [iso-8859-1] (original) +++ trunk/rostests/winetests/wininet/internet.c [iso-8859-1] Fri Aug 19 09:46:10 2016 @@ -361,11 +361,13 @@ 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 @@ /* Technically illegal! domain should require 2 dots, but native wininet accepts it */ ret = InternetSetCookieA("http://www.example.com%22,NULL,%22E=F; domain=example.com"); ok(ret == TRUE,"InternetSetCookie failed\n"); - ret = InternetSetCookieA("http://www.example.com%22,NULL,%22G=H; domain=.example.com; path=/foo"); + ret = InternetSetCookieA("http://www.example.com%22,NULL,%22G=H; domain=.example.com; invalid=attr; path=/foo"); ok(ret == TRUE,"InternetSetCookie failed\n"); ret = InternetSetCookieA("http://www.example.com/bar.html%22,NULL,%22I=J; domain=.example.com"); ok(ret == TRUE,"InternetSetCookie failed\n"); @@ -1068,7 +1070,8 @@
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 @@ 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 @@ 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); }
@@ -1175,6 +1186,28 @@ ok(ret == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError()); ret = InternetCloseHandle(ses); 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) @@ -1809,4 +1842,5 @@ win_skip("Privacy[SG]etZonePreferenceW are not available\n");
test_InternetSetOption(); -} + test_end_browser_session(); +}
Modified: trunk/rostests/winetests/wininet/url.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wininet/url.c?re... ============================================================================== --- trunk/rostests/winetests/wininet/url.c [iso-8859-1] (original) +++ trunk/rostests/winetests/wininet/url.c [iso-8859-1] Fri Aug 19 09:46:10 2016 @@ -534,26 +534,26 @@ * 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 @@ "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 @@ "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 @@
/* 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 @@ * 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 @@
/* 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 @@ /* 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 @@ 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 @@ 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 @@ 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)