urlmon: Added Abort support to BindProtocol.
diff --git a/dlls/urlmon/bindprot.c b/dlls/urlmon/bindprot.c index 01443e3..3e1fb58 100644 --- a/dlls/urlmon/bindprot.c +++ b/dlls/urlmon/bindprot.c
@@ -423,8 +423,10 @@ DWORD dwOptions) { 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) @@ -653,8 +655,13 @@ DWORD dwOptions) { 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)
diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c index a116cf3..15c3bc4 100644 --- a/dlls/urlmon/tests/protocol.c +++ b/dlls/urlmon/tests/protocol.c
@@ -108,6 +108,7 @@ DEFINE_EXPECT(SetPriority); DEFINE_EXPECT(LockRequest); DEFINE_EXPECT(UnlockRequest); +DEFINE_EXPECT(Abort); DEFINE_EXPECT(MimeFilter_CreateInstance); DEFINE_EXPECT(MimeFilter_Start); DEFINE_EXPECT(MimeFilter_ReportProgress); @@ -1159,8 +1160,16 @@ static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason, DWORD dwOptions) { - ok(0, "unexpected call\n"); - return E_NOTIMPL; + HRESULT hres; + + 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) @@ -1262,6 +1271,11 @@ else CHECK_CALLED(Switch); + if(test_abort) { + SetEvent(event_complete); + return 0; + } + prot_state = 2; if(mimefilter_test) SET_EXPECT(MimeFilter_Switch); @@ -2999,6 +3013,18 @@ IInternetBindInfo_Release(prot_bind_info); 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); ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres); @@ -3064,6 +3090,17 @@ IInternetProtocol_Continue(protocol, pdata); 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); } if(direct_read) @@ -3179,6 +3216,8 @@ test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_FILTER); trace("Testing http binding (mime verification, emulate prot, direct read)...\n"); 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_complete2);