Jacek Caban : urlmon: Added more protocol tests.
Alexandre Julliard
julliard at winehq.org
Mon Feb 4 08:43:11 CST 2008
Module: wine
Branch: master
Commit: 210854edf2e841af675d541d29f2b90cd2625d02
URL: http://source.winehq.org/git/wine.git/?a=commit;h=210854edf2e841af675d541d29f2b90cd2625d02
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Jan 31 18:18:49 2008 +0100
urlmon: Added more protocol tests.
---
dlls/urlmon/tests/protocol.c | 27 +++++++++++++++++++--------
1 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c
index fd92171..e9b1ec1 100644
--- a/dlls/urlmon/tests/protocol.c
+++ b/dlls/urlmon/tests/protocol.c
@@ -36,17 +36,16 @@
#define SET_EXPECT(func) \
expect_ ## func = TRUE
-#define CHECK_EXPECT(func) \
+#define CHECK_EXPECT2(func) \
do { \
- ok(expect_ ##func, "unexpected call " #func "\n"); \
- expect_ ## func = FALSE; \
+ ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \
}while(0)
-#define CHECK_EXPECT2(func) \
+#define CHECK_EXPECT(func) \
do { \
- ok(expect_ ##func, "unexpected call " #func "\n"); \
- called_ ## func = TRUE; \
+ CHECK_EXPECT2(func); \
+ expect_ ## func = FALSE; \
}while(0)
#define CHECK_CALLED(func) \
@@ -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;
}
More information about the wine-cvs
mailing list