urlmon: Return E_FAIL in Binding::Switch implementation.

This commit is contained in:
Jacek Caban 2009-05-11 22:01:05 +02:00 committed by Alexandre Julliard
parent 2e75a84e17
commit 00376b5b72
2 changed files with 26 additions and 25 deletions

View File

@ -1127,37 +1127,14 @@ static ULONG WINAPI InternetProtocolSink_Release(IInternetProtocolSink *iface)
return IBinding_Release(BINDING(This));
}
typedef struct {
task_header_t header;
PROTOCOLDATA data;
} switch_task_t;
static void switch_proc(Binding *binding, task_header_t *t)
{
switch_task_t *task = (switch_task_t*)t;
IInternetProtocol_Continue(binding->protocol, &task->data);
heap_free(task);
}
static HRESULT WINAPI InternetProtocolSink_Switch(IInternetProtocolSink *iface,
PROTOCOLDATA *pProtocolData)
{
Binding *This = PROTSINK_THIS(iface);
switch_task_t *task;
TRACE("(%p)->(%p)\n", This, pProtocolData);
WARN("(%p)->(%p)\n", This, pProtocolData);
task = heap_alloc(sizeof(switch_task_t));
task->data = *pProtocolData;
push_task(This, &task->header, switch_proc);
IBinding_AddRef(BINDING(This));
PostMessageW(This->notif_hwnd, WM_MK_CONTINUE, 0, (LPARAM)This);
return S_OK;
return E_FAIL;
}
typedef struct {

View File

@ -324,6 +324,28 @@ static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
return 1;
}
static void test_switch_fail(void)
{
IInternetProtocolSink *binding_sink;
PROTOCOLDATA protocoldata;
HRESULT hres;
static BOOL tested_switch_fail;
if(tested_switch_fail)
return;
tested_switch_fail = TRUE;
hres = IBinding_QueryInterface(current_binding, &IID_IInternetProtocolSink, (void**)&binding_sink);
ok(hres == S_OK, "Could not get IInternetProtocolSink iface: %08x\n", hres);
if(SUCCEEDED(hres)) {
hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
ok(hres == E_FAIL, "Switch failed: %08x, expected E_FAIL\n", hres);
IInternetProtocolSink_Release(binding_sink);
}
}
static DWORD WINAPI thread_proc(PVOID arg)
{
PROTOCOLDATA protocoldata;
@ -368,6 +390,8 @@ static DWORD WINAPI thread_proc(PVOID arg)
else
CHECK_CALLED(OnProgress_SENDINGREQUEST);
test_switch_fail();
SET_EXPECT(Continue);
prot_state = 1;
hres = IInternetProtocolSink_Switch(protocol_sink, &protocoldata);