From 210854edf2e841af675d541d29f2b90cd2625d02 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 31 Jan 2008 18:18:49 +0100 Subject: [PATCH] urlmon: Added more protocol tests. --- dlls/urlmon/tests/protocol.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c index fd92171e10d..e9b1ec1e21c 100644 --- a/dlls/urlmon/tests/protocol.c +++ b/dlls/urlmon/tests/protocol.c @@ -36,19 +36,18 @@ #define SET_EXPECT(func) \ expect_ ## func = TRUE -#define CHECK_EXPECT(func) \ - do { \ - ok(expect_ ##func, "unexpected call " #func "\n"); \ - expect_ ## func = FALSE; \ - called_ ## func = TRUE; \ - }while(0) - #define CHECK_EXPECT2(func) \ do { \ ok(expect_ ##func, "unexpected call " #func "\n"); \ called_ ## func = TRUE; \ }while(0) +#define CHECK_EXPECT(func) \ + do { \ + CHECK_EXPECT2(func); \ + expect_ ## func = FALSE; \ + }while(0) + #define CHECK_CALLED(func) \ do { \ ok(called_ ## func, "expected " #func "\n"); \ @@ -357,6 +356,8 @@ static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOL CHECK_CALLED(ReportProgress_SENDINGREQUEST); SET_EXPECT(OnResponse); SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE); + if(bindf & BINDF_NEEDFILE) + SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE); } SET_EXPECT(ReportData); @@ -368,6 +369,8 @@ static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOL state = 1; CHECK_CALLED(OnResponse); CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE); + if(bindf & BINDF_NEEDFILE) + CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE); } SetEvent(event_complete); @@ -423,8 +426,10 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, if(szStatusText) { if(binding_test) ok(szStatusText == expect_wsz, "unexpected szStatusText\n"); + else if(tested_protocol == FILE_TEST) + ok(!lstrcmpW(szStatusText, file_name), "szStatusText = \"%s\"\n", debugstr_w(szStatusText)); else - ok(!lstrcmpW(szStatusText, file_name), "szStatusText != file_name\n"); + ok(szStatusText != NULL, "szStatusText == NULL\n"); } break; case BINDSTATUS_FINDINGRESOURCE: @@ -1408,6 +1413,8 @@ static void test_file_protocol(void) { test_file_protocol_url(index_url); bindf = BINDF_FROMURLMON; test_file_protocol_url(index_url); + bindf = BINDF_FROMURLMON | BINDF_NEEDFILE; + test_file_protocol_url(index_url); memcpy(buf, wszFile, sizeof(wszFile)); len = sizeof(wszFile)/sizeof(WCHAR)-1; @@ -1639,11 +1646,15 @@ static void test_http_protocol(void) bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON; test_http_protocol_url(winehq_url, FALSE); + trace("Testing http protocol (to file)...\n"); + bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NEEDFILE; + test_http_protocol_url(winehq_url, FALSE); + trace("Testing http protocol (post data)...\n"); http_post_test = TRUE; /* Without this flag we get a ReportProgress_CACHEFILENAMEAVAILABLE * notification with BINDVERB_POST */ - bindf |= BINDF_NOWRITECACHE; + bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE; test_http_protocol_url(posttest_url, TRUE); http_post_test = FALSE; }