Commit 8bee20d8 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

urlmon: Properly handle BINDSTATUS_BEGINDOWNLOADDATA.

parent 4499b451
...@@ -962,7 +962,6 @@ static void report_progress(BindProtocol *This, ULONG status_code, LPCWSTR statu ...@@ -962,7 +962,6 @@ static void report_progress(BindProtocol *This, ULONG status_code, LPCWSTR statu
case BINDSTATUS_FINDINGRESOURCE: case BINDSTATUS_FINDINGRESOURCE:
case BINDSTATUS_CONNECTING: case BINDSTATUS_CONNECTING:
case BINDSTATUS_REDIRECTING: case BINDSTATUS_REDIRECTING:
case BINDSTATUS_BEGINDOWNLOADDATA:
case BINDSTATUS_SENDINGREQUEST: case BINDSTATUS_SENDINGREQUEST:
case BINDSTATUS_CACHEFILENAMEAVAILABLE: case BINDSTATUS_CACHEFILENAMEAVAILABLE:
case BINDSTATUS_DIRECTBIND: case BINDSTATUS_DIRECTBIND:
...@@ -971,6 +970,11 @@ static void report_progress(BindProtocol *This, ULONG status_code, LPCWSTR statu ...@@ -971,6 +970,11 @@ static void report_progress(BindProtocol *This, ULONG status_code, LPCWSTR statu
IInternetProtocolSink_ReportProgress(This->protocol_sink, status_code, status_text); IInternetProtocolSink_ReportProgress(This->protocol_sink, status_code, status_text);
break; break;
case BINDSTATUS_BEGINDOWNLOADDATA:
if(This->protocol_sink)
IInternetProtocolSink_ReportData(This->protocol_sink, This->bscf, This->progress, This->progress_max);
break;
case BINDSTATUS_MIMETYPEAVAILABLE: case BINDSTATUS_MIMETYPEAVAILABLE:
mime_available(This, status_text, FALSE); mime_available(This, status_text, FALSE);
break; break;
...@@ -1026,6 +1030,10 @@ static HRESULT WINAPI BPInternetProtocolSink_ReportProgress(IInternetProtocolSin ...@@ -1026,6 +1030,10 @@ static HRESULT WINAPI BPInternetProtocolSink_ReportProgress(IInternetProtocolSin
static HRESULT report_data(BindProtocol *This, DWORD bscf, ULONG progress, ULONG progress_max) static HRESULT report_data(BindProtocol *This, DWORD bscf, ULONG progress, ULONG progress_max)
{ {
This->bscf = bscf;
This->progress = progress;
This->progress_max = progress_max;
if(!This->protocol_sink) if(!This->protocol_sink)
return S_OK; return S_OK;
......
/* /*
* Copyright 2005-2009 Jacek Caban for CodeWeavers * Copyright 2005-2011 Jacek Caban for CodeWeavers
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -166,6 +166,7 @@ static enum { ...@@ -166,6 +166,7 @@ static enum {
HTTPS_TEST, HTTPS_TEST,
FTP_TEST, FTP_TEST,
MK_TEST, MK_TEST,
ITS_TEST,
BIND_TEST BIND_TEST
} tested_protocol; } tested_protocol;
...@@ -175,6 +176,7 @@ static const WCHAR protocol_names[][10] = { ...@@ -175,6 +176,7 @@ static const WCHAR protocol_names[][10] = {
{'h','t','t','p','s',0}, {'h','t','t','p','s',0},
{'f','t','p',0}, {'f','t','p',0},
{'m','k',0}, {'m','k',0},
{'i','t','s',0},
{'t','e','s','t',0} {'t','e','s','t',0}
}; };
...@@ -188,6 +190,7 @@ static const WCHAR binding_urls[][130] = { ...@@ -188,6 +190,7 @@ static const WCHAR binding_urls[][130] = {
'/','p','u','b','/','o','t','h','e','r', '/','p','u','b','/','o','t','h','e','r',
'/','w','i','n','e','l','o','g','o','.','x','c','f','.','t','a','r','.','b','z','2',0}, '/','w','i','n','e','l','o','g','o','.','x','c','f','.','t','a','r','.','b','z','2',0},
{'m','k',':','t','e','s','t',0}, {'m','k',':','t','e','s','t',0},
{'i','t','s',':','t','e','s','t','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l',0},
{'t','e','s','t',':','/','/','f','i','l','e','.','h','t','m','l',0} {'t','e','s','t',':','/','/','f','i','l','e','.','h','t','m','l',0}
}; };
...@@ -725,7 +728,7 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, ...@@ -725,7 +728,7 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
switch(ulStatusCode) { switch(ulStatusCode) {
case BINDSTATUS_MIMETYPEAVAILABLE: case BINDSTATUS_MIMETYPEAVAILABLE:
CHECK_EXPECT(ReportProgress_MIMETYPEAVAILABLE); CHECK_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
if(tested_protocol != FILE_TEST && !mimefilter_test && (pi & PI_MIMEVERIFICATION)) { if(tested_protocol != FILE_TEST && tested_protocol != ITS_TEST && !mimefilter_test && (pi & PI_MIMEVERIFICATION)) {
if(!short_read || !direct_read) if(!short_read || !direct_read)
CHECK_CALLED(Read); /* set in Continue */ CHECK_CALLED(Read); /* set in Continue */
else if(short_read) else if(short_read)
...@@ -779,7 +782,7 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, ...@@ -779,7 +782,7 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
break; break;
case BINDSTATUS_SENDINGREQUEST: case BINDSTATUS_SENDINGREQUEST:
CHECK_EXPECT2(ReportProgress_SENDINGREQUEST); CHECK_EXPECT2(ReportProgress_SENDINGREQUEST);
if(tested_protocol == FILE_TEST) { if(tested_protocol == FILE_TEST || tested_protocol == ITS_TEST) {
ok(szStatusText != NULL, "szStatusText == NULL\n"); ok(szStatusText != NULL, "szStatusText == NULL\n");
if(szStatusText) if(szStatusText)
ok(!*szStatusText, "wrong szStatusText\n"); ok(!*szStatusText, "wrong szStatusText\n");
...@@ -843,16 +846,19 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR ...@@ -843,16 +846,19 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR
static int rec_depth; static int rec_depth;
rec_depth++; rec_depth++;
if(!mimefilter_test && tested_protocol == FILE_TEST) { if(!mimefilter_test && (tested_protocol == FILE_TEST || tested_protocol == ITS_TEST)) {
CHECK_EXPECT2(ReportData); CHECK_EXPECT2(ReportData);
ok(ulProgress == ulProgressMax, "ulProgress (%d) != ulProgressMax (%d)\n", ok(ulProgress == ulProgressMax, "ulProgress (%d) != ulProgressMax (%d)\n",
ulProgress, ulProgressMax); ulProgress, ulProgressMax);
ok(ulProgressMax == 13, "ulProgressMax=%d, expected 13\n", ulProgressMax); ok(ulProgressMax == 13, "ulProgressMax=%d, expected 13\n", ulProgressMax);
/* BSCF_SKIPDRAINDATAFORFILEURLS added in IE8 */ /* BSCF_SKIPDRAINDATAFORFILEURLS added in IE8 */
ok((grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION)) || if(tested_protocol == FILE_TEST)
(grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION | BSCF_SKIPDRAINDATAFORFILEURLS)), ok((grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION)) ||
"grcfBSCF = %08x\n", grfBSCF); (grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION | BSCF_SKIPDRAINDATAFORFILEURLS)),
"grcfBSCF = %08x\n", grfBSCF);
else
ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE), "grcfBSCF = %08x\n", grfBSCF);
}else if(direct_read) { }else if(direct_read) {
BYTE buf[14096]; BYTE buf[14096];
ULONG read; ULONG read;
...@@ -1634,13 +1640,21 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo ...@@ -1634,13 +1640,21 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo
else else
SET_EXPECT(ReportData); SET_EXPECT(ReportData);
hres = IInternetProtocolSink_ReportData(pOIProtSink, hres = IInternetProtocolSink_ReportData(pOIProtSink,
BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION, 13, 13); BSCF_FIRSTDATANOTIFICATION | (tested_protocol == ITS_TEST ? BSCF_DATAFULLYAVAILABLE : BSCF_LASTDATANOTIFICATION),
13, 13);
ok(hres == S_OK, "ReportData failed: %08x\n", hres); ok(hres == S_OK, "ReportData failed: %08x\n", hres);
if(mimefilter_test) if(mimefilter_test)
CHECK_CALLED(MimeFilter_ReportData); CHECK_CALLED(MimeFilter_ReportData);
else else
CHECK_CALLED(ReportData); CHECK_CALLED(ReportData);
if(tested_protocol == ITS_TEST) {
SET_EXPECT(ReportData);
hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_BEGINDOWNLOADDATA, NULL);
ok(hres == S_OK, "ReportProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
CHECK_CALLED(ReportData);
}
if(tested_protocol == BIND_TEST) { if(tested_protocol == BIND_TEST) {
hres = IInternetProtocol_Terminate(binding_protocol, 0); hres = IInternetProtocol_Terminate(binding_protocol, 0);
ok(hres == E_FAIL, "Termiante failed: %08x\n", hres); ok(hres == E_FAIL, "Termiante failed: %08x\n", hres);
...@@ -3503,6 +3517,8 @@ START_TEST(protocol) ...@@ -3503,6 +3517,8 @@ START_TEST(protocol)
test_binding(FILE_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT); test_binding(FILE_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT);
trace("Testing http binding (mime verification, emulate prot)...\n"); trace("Testing http binding (mime verification, emulate prot)...\n");
test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT); test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT);
trace("Testing its binding (mime verification, emulate prot)...\n");
test_binding(ITS_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT);
trace("Testing http binding (mime verification, emulate prot, short read, direct read)...\n"); trace("Testing http binding (mime verification, emulate prot, short read, direct read)...\n");
test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_SHORT_READ|TEST_DIRECT_READ); test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_SHORT_READ|TEST_DIRECT_READ);
trace("Testing file binding (mime verification, emulate prot, mime filter)...\n"); trace("Testing file binding (mime verification, emulate prot, mime filter)...\n");
......
...@@ -191,6 +191,10 @@ typedef struct { ...@@ -191,6 +191,10 @@ typedef struct {
BOOL from_urlmon; BOOL from_urlmon;
DWORD pi; DWORD pi;
DWORD bscf;
ULONG progress;
ULONG progress_max;
DWORD apartment_thread; DWORD apartment_thread;
HWND notif_hwnd; HWND notif_hwnd;
DWORD continue_call; DWORD continue_call;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment