Author: cwittich Date: Mon Dec 29 02:42:01 2008 New Revision: 38443
URL: http://svn.reactos.org/svn/reactos?rev=38443&view=rev Log: sync urlmon winetest to wine 1.1.11
Modified: trunk/rostests/winetests/urlmon/protocol.c trunk/rostests/winetests/urlmon/testlist.c trunk/rostests/winetests/urlmon/url.c
Modified: trunk/rostests/winetests/urlmon/protocol.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/urlmon/protocol.... ============================================================================== --- trunk/rostests/winetests/urlmon/protocol.c [iso-8859-1] (original) +++ trunk/rostests/winetests/urlmon/protocol.c [iso-8859-1] Mon Dec 29 02:42:01 2008 @@ -350,7 +350,8 @@ CHECK_CALLED(ReportProgress_CONNECTING); } else todo_wine { CHECK_NOT_CALLED(ReportProgress_FINDINGRESOURCE); - CHECK_NOT_CALLED(ReportProgress_CONNECTING); + /* IE7 does call this */ + CLEAR_CALLED(ReportProgress_CONNECTING); } CHECK_CALLED(ReportProgress_SENDINGREQUEST); SET_EXPECT(OnResponse); @@ -754,6 +755,12 @@ return S_OK; }
+ if(IsEqualGUID(&IID_IInternetProtocolEx, riid)) { + trace("IID_IInternetProtocolEx not supported\n"); + *ppv = NULL; + return E_NOINTERFACE; + } + if(IsEqualGUID(&IID_IInternetPriority, riid)) { *ppv = &InternetPriority; return S_OK; @@ -871,6 +878,7 @@ LPWSTR additional_headers = NULL; BYTE sec_id[100]; DWORD fetched = 0, size = 100; + DWORD tid;
SET_EXPECT(GetBindString_USER_AGENT); hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_USER_AGENT, @@ -927,7 +935,7 @@
IServiceProvider_Release(service_provider);
- CreateThread(NULL, 0, thread_proc, NULL, 0, NULL); + CreateThread(NULL, 0, thread_proc, NULL, 0, &tid);
return S_OK; } @@ -1192,7 +1200,7 @@ IInternetPriority_Release(priority); }
-static void file_protocol_start(IInternetProtocol *protocol, LPCWSTR url, BOOL is_first) +static BOOL file_protocol_start(IInternetProtocol *protocol, LPCWSTR url, BOOL is_first) { HRESULT hres;
@@ -1214,6 +1222,10 @@ expect_hrResult = S_OK;
hres = IInternetProtocol_Start(protocol, url, &protocol_sink, &bind_info, 0, 0); + if(hres == INET_E_RESOURCE_NOT_FOUND) { + win_skip("Start failed\n"); + return FALSE; + } ok(hres == S_OK, "Start failed: %08x\n", hres);
CHECK_CALLED(GetBindInfo); @@ -1230,6 +1242,8 @@ CHECK_CALLED(ReportData); if(is_first) CHECK_CALLED(ReportResult); + + return TRUE; }
static void test_file_protocol_url(LPCWSTR url) @@ -1242,7 +1256,7 @@ hres = CoGetClassObject(&CLSID_FileProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk); ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres); - if(!SUCCEEDED(hres)) + if(FAILED(hres)) return;
hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info); @@ -1259,25 +1273,27 @@ ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
if(SUCCEEDED(hres)) { - file_protocol_start(protocol, url, TRUE); - hres = IInternetProtocol_Read(protocol, buf, 2, &cb); - ok(hres == S_OK, "Read failed: %08x\n", hres); - ok(cb == 2, "cb=%u expected 2\n", cb); - hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb); - ok(hres == S_FALSE, "Read failed: %08x\n", hres); - hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb); - ok(hres == S_FALSE, "Read failed: %08x expected S_FALSE\n", hres); - ok(cb == 0, "cb=%u expected 0\n", cb); - hres = IInternetProtocol_UnlockRequest(protocol); - ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres); - - file_protocol_start(protocol, url, FALSE); - hres = IInternetProtocol_Read(protocol, buf, 2, &cb); - ok(hres == S_FALSE, "Read failed: %08x\n", hres); - hres = IInternetProtocol_LockRequest(protocol, 0); - ok(hres == S_OK, "LockRequest failed: %08x\n", hres); - hres = IInternetProtocol_UnlockRequest(protocol); - ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres); + if(file_protocol_start(protocol, url, TRUE)) { + hres = IInternetProtocol_Read(protocol, buf, 2, &cb); + ok(hres == S_OK, "Read failed: %08x\n", hres); + ok(cb == 2, "cb=%u expected 2\n", cb); + hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb); + ok(hres == S_FALSE, "Read failed: %08x\n", hres); + hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb); + ok(hres == S_FALSE, "Read failed: %08x expected S_FALSE\n", hres); + ok(cb == 0, "cb=%u expected 0\n", cb); + hres = IInternetProtocol_UnlockRequest(protocol); + ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres); + } + + if(file_protocol_start(protocol, url, FALSE)) { + hres = IInternetProtocol_Read(protocol, buf, 2, &cb); + ok(hres == S_FALSE, "Read failed: %08x\n", hres); + hres = IInternetProtocol_LockRequest(protocol, 0); + ok(hres == S_OK, "LockRequest failed: %08x\n", hres); + hres = IInternetProtocol_UnlockRequest(protocol); + ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres); + }
IInternetProtocol_Release(protocol); } @@ -1286,19 +1302,20 @@ ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
if(SUCCEEDED(hres)) { - file_protocol_start(protocol, url, TRUE); - hres = IInternetProtocol_LockRequest(protocol, 0); - ok(hres == S_OK, "LockRequest failed: %08x\n", hres); - hres = IInternetProtocol_Terminate(protocol, 0); - ok(hres == S_OK, "Terminate failed: %08x\n", hres); - hres = IInternetProtocol_Read(protocol, buf, 2, &cb); - ok(hres == S_OK, "Read failed: %08x\n\n", hres); - hres = IInternetProtocol_UnlockRequest(protocol); - ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres); - hres = IInternetProtocol_Read(protocol, buf, 2, &cb); - ok(hres == S_OK, "Read failed: %08x\n", hres); - hres = IInternetProtocol_Terminate(protocol, 0); - ok(hres == S_OK, "Terminate failed: %08x\n", hres); + if(file_protocol_start(protocol, url, TRUE)) { + hres = IInternetProtocol_LockRequest(protocol, 0); + ok(hres == S_OK, "LockRequest failed: %08x\n", hres); + hres = IInternetProtocol_Terminate(protocol, 0); + ok(hres == S_OK, "Terminate failed: %08x\n", hres); + hres = IInternetProtocol_Read(protocol, buf, 2, &cb); + ok(hres == S_OK, "Read failed: %08x\n\n", hres); + hres = IInternetProtocol_UnlockRequest(protocol); + ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres); + hres = IInternetProtocol_Read(protocol, buf, 2, &cb); + ok(hres == S_OK, "Read failed: %08x\n", hres); + hres = IInternetProtocol_Terminate(protocol, 0); + ok(hres == S_OK, "Terminate failed: %08x\n", hres); + }
IInternetProtocol_Release(protocol); } @@ -1307,12 +1324,13 @@ ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
if(SUCCEEDED(hres)) { - file_protocol_start(protocol, url, TRUE); - hres = IInternetProtocol_Terminate(protocol, 0); - ok(hres == S_OK, "Terminate failed: %08x\n", hres); - hres = IInternetProtocol_Read(protocol, buf, 2, &cb); - ok(hres == S_OK, "Read failed: %08x\n", hres); - ok(cb == 2, "cb=%u expected 2\n", cb); + if(file_protocol_start(protocol, url, TRUE)) { + hres = IInternetProtocol_Terminate(protocol, 0); + ok(hres == S_OK, "Terminate failed: %08x\n", hres); + hres = IInternetProtocol_Read(protocol, buf, 2, &cb); + ok(hres == S_OK, "Read failed: %08x\n", hres); + ok(cb == 2, "cb=%u expected 2\n", cb); + }
IInternetProtocol_Release(protocol); } @@ -1411,8 +1429,14 @@ trace("Testing file protocol...\n"); tested_protocol = FILE_TEST;
+ SetLastError(0xdeadbeef); file = CreateFileW(wszIndexHtml, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if(!file && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + { + win_skip("Detected Win9x or WinMe\n"); + return; + } ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n"); if(file == INVALID_HANDLE_VALUE) return; @@ -1535,7 +1559,7 @@
hres = CoGetClassObject(&CLSID_HttpProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk); ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres); - if(!SUCCEEDED(hres)) + if(FAILED(hres)) return;
hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info); @@ -1555,7 +1579,6 @@ if(SUCCEEDED(hres)) { BYTE buf[3600]; DWORD cb; - int *called = (bindf & BINDF_FROMURLMON) ? &called_Switch : &called_ReportData;
test_priority(http_protocol);
@@ -1577,8 +1600,8 @@ expect_hrResult = S_OK;
hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb); - ok((!*called && hres == E_PENDING && cb==0) || - (*called && hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb); + ok((hres == E_PENDING && cb==0) || + (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
WaitForSingleObject(event_complete, INFINITE); if(bindf & BINDF_FROMURLMON) @@ -1594,8 +1617,8 @@ hres = IInternetProtocol_Read(http_protocol, buf, sizeof(buf), &cb); if(hres == E_PENDING) { hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb); - ok((!*called && hres == E_PENDING && cb==0) || - (*called && hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb); + ok((hres == E_PENDING && cb==0) || + (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb); WaitForSingleObject(event_complete, INFINITE); if(bindf & BINDF_FROMURLMON) CHECK_CALLED(Switch);
Modified: trunk/rostests/winetests/urlmon/testlist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/urlmon/testlist.... ============================================================================== --- trunk/rostests/winetests/urlmon/testlist.c [iso-8859-1] (original) +++ trunk/rostests/winetests/urlmon/testlist.c [iso-8859-1] Mon Dec 29 02:42:01 2008 @@ -6,8 +6,18 @@ #define STANDALONE #include "wine/test.h"
+extern void func_generated(void); +extern void func_misc(void); +extern void func_protocol(void); +extern void func_stream(void); +extern void func_url(void);
const struct test winetest_testlist[] = { + { "generated", func_generated }, + { "misc", func_misc }, + { "protocol", func_protocol }, + { "stream", func_stream }, + { "url", func_url }, { 0, 0 } };
Modified: trunk/rostests/winetests/urlmon/url.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/urlmon/url.c?rev... ============================================================================== --- trunk/rostests/winetests/urlmon/url.c [iso-8859-1] (original) +++ trunk/rostests/winetests/urlmon/url.c [iso-8859-1] Mon Dec 29 02:42:01 2008 @@ -147,8 +147,10 @@ {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0}; static const WCHAR wszWineHQIP[] = {'2','0','9','.','3','2','.','1','4','1','.','3',0}; +static const CHAR wszIndexHtmlA[] = "index.html"; static const WCHAR wszIndexHtml[] = {'i','n','d','e','x','.','h','t','m','l',0}; static const WCHAR cache_fileW[] = {'c',':','\','c','a','c','h','e','.','h','t','m',0}; +static const CHAR dwl_htmlA[] = "dwl.html"; static const WCHAR dwl_htmlW[] = {'d','w','l','.','h','t','m','l',0}; static const WCHAR emptyW[] = {0};
@@ -159,6 +161,7 @@ static IInternetProtocolSink *protocol_sink = NULL; static HANDLE complete_event, complete_event2; static HRESULT binding_hres; +static BOOL have_IHttpNegotiate2;
static LPCWSTR urls[] = { WINE_ABOUT_URL, @@ -1824,6 +1827,7 @@
hres = IBindStatusCallback_QueryInterface(holder, &IID_IHttpNegotiate2, (void**)&http_negotiate2); if(SUCCEEDED(hres)) { + have_IHttpNegotiate2 = TRUE; hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, (void*)0xdeadbeef, (void*)0xdeadbeef, 0); ok(hres == E_FAIL, "GetRootSecurityId failed: %08x\n", hres);
@@ -2113,16 +2117,18 @@ CLEAR_CALLED(QueryService_IInternetBindInfo); CHECK_CALLED(QueryInterface_IHttpNegotiate); CHECK_CALLED(BeginningTransaction); - /* QueryInterface_IHttpNegotiate2 and GetRootSecurityId - * called on WinXP but not on Win98 */ - CLEAR_CALLED(QueryInterface_IHttpNegotiate2); - CLEAR_CALLED(GetRootSecurityId); + if (have_IHttpNegotiate2) + { + CHECK_CALLED(QueryInterface_IHttpNegotiate2); + CHECK_CALLED(GetRootSecurityId); + } if(http_is_first) { CHECK_CALLED(OnProgress_FINDINGRESOURCE); CHECK_CALLED(OnProgress_CONNECTING); }else todo_wine { CHECK_NOT_CALLED(OnProgress_FINDINGRESOURCE); - CHECK_NOT_CALLED(OnProgress_CONNECTING); + /* IE7 does call this */ + CLEAR_CALLED(OnProgress_CONNECTING); } } if(test_protocol == HTTP_TEST || test_protocol == FILE_TEST) @@ -2272,16 +2278,18 @@ if(test_protocol == HTTP_TEST) { CHECK_CALLED(QueryInterface_IHttpNegotiate); CHECK_CALLED(BeginningTransaction); - /* QueryInterface_IHttpNegotiate2 and GetRootSecurityId - * called on WinXP but not on Win98 */ - CLEAR_CALLED(QueryInterface_IHttpNegotiate2); - CLEAR_CALLED(GetRootSecurityId); + if (have_IHttpNegotiate2) + { + CHECK_CALLED(QueryInterface_IHttpNegotiate2); + CHECK_CALLED(GetRootSecurityId); + } if(http_is_first) { CHECK_CALLED(Obj_OnProgress_FINDINGRESOURCE); CHECK_CALLED(Obj_OnProgress_CONNECTING); }else todo_wine { CHECK_NOT_CALLED(Obj_OnProgress_FINDINGRESOURCE); - CHECK_NOT_CALLED(Obj_OnProgress_CONNECTING); + /* IE7 does call this */ + CLEAR_CALLED(Obj_OnProgress_CONNECTING); } } if(test_protocol == HTTP_TEST || test_protocol == FILE_TEST) { @@ -2313,7 +2321,7 @@ todo_wine ok(IMoniker_Release(mon) == 0, "mon should be destroyed here\n");
if(bindf & BINDF_ASYNCHRONOUS) - ok(IBindCtx_Release(bctx) != 0, "bctx should not be destroyed here\n"); + IBindCtx_Release(bctx); else todo_wine ok(IBindCtx_Release(bctx) == 0, "bctx should be destroyed here\n"); } @@ -2380,11 +2388,16 @@ if(test_protocol == HTTP_TEST) { CHECK_CALLED(QueryInterface_IHttpNegotiate); CHECK_CALLED(BeginningTransaction); - CHECK_CALLED(QueryInterface_IHttpNegotiate2); - CHECK_CALLED(GetRootSecurityId); + if (have_IHttpNegotiate2) + { + CHECK_CALLED(QueryInterface_IHttpNegotiate2); + CHECK_CALLED(GetRootSecurityId); + } } - if(test_protocol == HTTP_TEST || test_protocol == FILE_TEST) + if(test_protocol == FILE_TEST) CHECK_CALLED(OnProgress_SENDINGREQUEST); + else if(test_protocol == HTTP_TEST) + CLEAR_CALLED(OnProgress_SENDINGREQUEST); /* not called by IE7 */ if(test_protocol == HTTP_TEST) CHECK_CALLED(OnResponse); CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE); @@ -2397,7 +2410,7 @@ CHECK_CALLED(OnStopBinding); }
- res = DeleteFileW(dwl_htmlW); + res = DeleteFileA(dwl_htmlA); ok(res, "DeleteFile failed: %u\n", GetLastError());
if(prot != FILE_TEST || emul) @@ -2406,35 +2419,33 @@ hres = URLDownloadToFileW(NULL, urls[test_protocol], dwl_htmlW, 0, NULL); ok(hres == S_OK, "URLDownloadToFile failed: %08x\n", hres);
- res = DeleteFileW(dwl_htmlW); + res = DeleteFileA(dwl_htmlA); ok(res, "DeleteFile failed: %u\n", GetLastError()); }
-static void set_file_url(void) -{ - int len; - - static const WCHAR wszFile[] = {'f','i','l','e',':','/','/'}; - - memcpy(file_url, wszFile, sizeof(wszFile)); - len = sizeof(wszFile)/sizeof(WCHAR); - file_url[len++] = '/'; - len += GetCurrentDirectoryW(sizeof(file_url)/sizeof(WCHAR)-len, file_url+len); - file_url[len++] = '\'; - memcpy(file_url+len, wszIndexHtml, sizeof(wszIndexHtml)); - - memcpy(INDEX_HTML, wszFile, sizeof(wszIndexHtml)); - memmove(INDEX_HTML+7, file_url+8, (lstrlenW(file_url+8)+1)*sizeof(WCHAR)); +static void set_file_url(char *path) +{ + CHAR file_urlA[INTERNET_MAX_URL_LENGTH]; + CHAR INDEX_HTMLA[MAX_PATH]; + + lstrcpyA(file_urlA, "file:///"); + lstrcatA(file_urlA, path); + MultiByteToWideChar(CP_ACP, 0, file_urlA, -1, file_url, INTERNET_MAX_URL_LENGTH); + + lstrcpyA(INDEX_HTMLA, "file://"); + lstrcatA(INDEX_HTMLA, path); + MultiByteToWideChar(CP_ACP, 0, INDEX_HTMLA, -1, INDEX_HTML, MAX_PATH); }
static void create_file(void) { HANDLE file; DWORD size; + CHAR path[MAX_PATH];
static const char html_doc[] = "<HTML></HTML>";
- file = CreateFileW(wszIndexHtml, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + file = CreateFileA(wszIndexHtmlA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n"); if(file == INVALID_HANDLE_VALUE) @@ -2443,7 +2454,10 @@ WriteFile(file, html_doc, sizeof(html_doc)-1, &size, NULL); CloseHandle(file);
- set_file_url(); + GetCurrentDirectoryA(MAX_PATH, path); + lstrcatA(path, "\"); + lstrcatA(path, wszIndexHtmlA); + set_file_url(path); }
static void test_ReportResult(HRESULT exhres) @@ -2661,7 +2675,7 @@ trace("test failures...\n"); test_BindToStorage_fail();
- DeleteFileW(wszIndexHtml); + DeleteFileA(wszIndexHtmlA); CloseHandle(complete_event); CloseHandle(complete_event2); CoUninitialize();