Commit 00376b5b authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

urlmon: Return E_FAIL in Binding::Switch implementation.

parent 2e75a84e
......@@ -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);
task = heap_alloc(sizeof(switch_task_t));
task->data = *pProtocolData;
WARN("(%p)->(%p)\n", This, 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 {
......
......@@ -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);
......
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