Commit 0d27b740 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

urlmon: Added Abort support to BindProtocol.

parent 2e59b5ac
...@@ -423,8 +423,10 @@ static HRESULT WINAPI BindProtocol_Abort(IInternetProtocol *iface, HRESULT hrRea ...@@ -423,8 +423,10 @@ static HRESULT WINAPI BindProtocol_Abort(IInternetProtocol *iface, HRESULT hrRea
DWORD dwOptions) DWORD dwOptions)
{ {
BindProtocol *This = PROTOCOL_THIS(iface); BindProtocol *This = PROTOCOL_THIS(iface);
FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
return E_NOTIMPL; TRACE("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
return IInternetProtocol_Abort(This->protocol_handler, hrReason, dwOptions);
} }
static HRESULT WINAPI BindProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions) static HRESULT WINAPI BindProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
...@@ -653,8 +655,13 @@ static HRESULT WINAPI ProtocolHandler_Abort(IInternetProtocol *iface, HRESULT hr ...@@ -653,8 +655,13 @@ static HRESULT WINAPI ProtocolHandler_Abort(IInternetProtocol *iface, HRESULT hr
DWORD dwOptions) DWORD dwOptions)
{ {
BindProtocol *This = PROTOCOLHANDLER_THIS(iface); BindProtocol *This = PROTOCOLHANDLER_THIS(iface);
FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
return E_NOTIMPL; TRACE("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
if(This->protocol && !This->reported_result)
return IInternetProtocol_Abort(This->protocol, hrReason, dwOptions);
return S_OK;
} }
static HRESULT WINAPI ProtocolHandler_Terminate(IInternetProtocol *iface, DWORD dwOptions) static HRESULT WINAPI ProtocolHandler_Terminate(IInternetProtocol *iface, DWORD dwOptions)
......
...@@ -108,6 +108,7 @@ DEFINE_EXPECT(Read2); ...@@ -108,6 +108,7 @@ DEFINE_EXPECT(Read2);
DEFINE_EXPECT(SetPriority); DEFINE_EXPECT(SetPriority);
DEFINE_EXPECT(LockRequest); DEFINE_EXPECT(LockRequest);
DEFINE_EXPECT(UnlockRequest); DEFINE_EXPECT(UnlockRequest);
DEFINE_EXPECT(Abort);
DEFINE_EXPECT(MimeFilter_CreateInstance); DEFINE_EXPECT(MimeFilter_CreateInstance);
DEFINE_EXPECT(MimeFilter_Start); DEFINE_EXPECT(MimeFilter_Start);
DEFINE_EXPECT(MimeFilter_ReportProgress); DEFINE_EXPECT(MimeFilter_ReportProgress);
...@@ -1159,8 +1160,16 @@ static ULONG WINAPI Protocol_Release(IInternetProtocol *iface) ...@@ -1159,8 +1160,16 @@ static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason, static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
DWORD dwOptions) DWORD dwOptions)
{ {
ok(0, "unexpected call\n"); HRESULT hres;
return E_NOTIMPL;
CHECK_EXPECT(Abort);
SET_EXPECT(ReportResult);
hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL);
ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
CHECK_CALLED(ReportResult);
return S_OK;
} }
static HRESULT WINAPI Protocol_Suspend(IInternetProtocol *iface) static HRESULT WINAPI Protocol_Suspend(IInternetProtocol *iface)
...@@ -1262,6 +1271,11 @@ static DWORD WINAPI thread_proc(PVOID arg) ...@@ -1262,6 +1271,11 @@ static DWORD WINAPI thread_proc(PVOID arg)
else else
CHECK_CALLED(Switch); CHECK_CALLED(Switch);
if(test_abort) {
SetEvent(event_complete);
return 0;
}
prot_state = 2; prot_state = 2;
if(mimefilter_test) if(mimefilter_test)
SET_EXPECT(MimeFilter_Switch); SET_EXPECT(MimeFilter_Switch);
...@@ -2999,6 +3013,18 @@ static void test_CreateBinding(void) ...@@ -2999,6 +3013,18 @@ static void test_CreateBinding(void)
IInternetBindInfo_Release(prot_bind_info); IInternetBindInfo_Release(prot_bind_info);
IInternetProtocol_Release(protocol); IInternetProtocol_Release(protocol);
hres = IInternetSession_CreateBinding(session, NULL, test_url, NULL, NULL, &protocol, 0);
ok(hres == S_OK, "CreateBinding failed: %08x\n", hres);
ok(protocol != NULL, "protocol == NULL\n");
hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
ok(hres == S_OK, "Abort failed: %08x\n", hres);
hres = IInternetProtocol_Abort(protocol, E_FAIL, 0);
ok(hres == S_OK, "Abort failed: %08x\n", hres);
IInternetProtocol_Release(protocol);
hres = IInternetSession_UnregisterNameSpace(session, &ClassFactory, wsz_test); hres = IInternetSession_UnregisterNameSpace(session, &ClassFactory, wsz_test);
ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres); ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
...@@ -3064,6 +3090,17 @@ static void test_binding(int prot, DWORD grf_pi, DWORD test_flags) ...@@ -3064,6 +3090,17 @@ static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
IInternetProtocol_Continue(protocol, pdata); IInternetProtocol_Continue(protocol, pdata);
CHECK_CALLED(Continue); CHECK_CALLED(Continue);
} }
if(test_abort && prot_state == 2) {
SET_EXPECT(Abort);
hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
ok(hres == S_OK, "Abort failed: %08x\n", hres);
CHECK_CALLED(Abort);
hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
ok(hres == S_OK, "Abort failed: %08x\n", hres);
SetEvent(event_complete2);
break;
}
SetEvent(event_complete2); SetEvent(event_complete2);
} }
if(direct_read) if(direct_read)
...@@ -3179,6 +3216,8 @@ START_TEST(protocol) ...@@ -3179,6 +3216,8 @@ START_TEST(protocol)
test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_FILTER); test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_FILTER);
trace("Testing http binding (mime verification, emulate prot, direct read)...\n"); trace("Testing http binding (mime verification, emulate prot, direct read)...\n");
test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_DIRECT_READ); test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_DIRECT_READ);
trace("Testing http binding (mime verification, emulate prot, abort)...\n");
test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_ABORT);
CloseHandle(event_complete); CloseHandle(event_complete);
CloseHandle(event_complete2); CloseHandle(event_complete2);
......
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