mshtml: Added IWindowForBindingUI tests.

This commit is contained in:
Jacek Caban 2012-05-30 15:49:54 +02:00 committed by Alexandre Julliard
parent 0847563dd4
commit 5665730a32
1 changed files with 58 additions and 15 deletions

View File

@ -94,7 +94,7 @@ DEFINE_GUID(SID_SContainerDispatch,0xb722be00,0x4e68,0x101b,0xa2,0xbc,0x00,0xaa,
static IOleDocumentView *view = NULL;
static HWND container_hwnd = NULL, hwnd = NULL, last_hwnd = NULL;
static HWND container_hwnd = NULL, doc_hwnd = NULL, last_hwnd = NULL;
DEFINE_EXPECT(LockContainer);
DEFINE_EXPECT(SetActiveObject);
@ -346,7 +346,7 @@ static void test_timer(DWORD flags)
if(flags & EXPECT_SETTITLE)
SET_EXPECT(Exec_SETTITLE);
while(!*b && GetMessage(&msg, hwnd, 0, 0)) {
while(!*b && GetMessage(&msg, doc_hwnd, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@ -1295,6 +1295,45 @@ static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pcb, IMoni
return E_NOTIMPL;
}
static void test_binding_ui(IUnknown *unk)
{
IWindowForBindingUI *binding_ui;
IServiceProvider *serv_prov;
HWND binding_hwnd;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IServiceProvider, (void**)&serv_prov);
ok(hres == S_OK, "Could not get IServiceProvider: %08x\n", hres);
hres = IServiceProvider_QueryService(serv_prov, &IID_IWindowForBindingUI, &IID_IWindowForBindingUI,
(void**)&binding_ui);
ok(hres == S_OK, "Could not get IWindowForBindingUI: %08x\n", hres);
hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IHttpSecurity, &binding_hwnd);
ok(hres == S_OK, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres);
if(doc_hwnd)
ok(binding_hwnd == doc_hwnd, "binding_hwnd != doc_hwnd\n");
else
todo_wine ok(binding_hwnd != NULL, "binding_hwnd == NULL\n");
hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IAuthenticate, &binding_hwnd);
ok(hres == S_OK, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres);
if(doc_hwnd)
ok(binding_hwnd == doc_hwnd, "binding_hwnd != doc_hwnd\n");
else
todo_wine ok(binding_hwnd != NULL, "binding_hwnd == NULL\n");
hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IWindowForBindingUI, &binding_hwnd);
ok(hres == S_OK, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres);
if(doc_hwnd)
ok(binding_hwnd == doc_hwnd, "binding_hwnd != doc_hwnd\n");
else
todo_wine ok(binding_hwnd != NULL, "binding_hwnd == NULL\n");
IWindowForBindingUI_Release(binding_ui);
IServiceProvider_Release(serv_prov);
}
static void continue_binding(IBindStatusCallback *callback)
{
FORMATETC formatetc = {0xc02d, NULL, 1, -1, TYMED_ISTREAM};
@ -1303,6 +1342,8 @@ static void continue_binding(IBindStatusCallback *callback)
static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
test_binding_ui((IUnknown*)callback);
if(report_mime) {
hres = IBindStatusCallback_OnProgress(callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE,
wszTextHtml);
@ -2162,6 +2203,7 @@ static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocum
ok(hres == S_OK, "Could not get IOleInPlaceActiveObject: %08x\n", hres);
if(activeobj) {
HWND hwnd = (void*)0xdeadbeef;
hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
ok(hwnd == NULL, "hwnd=%p, expected NULL\n", hwnd);
@ -2201,11 +2243,11 @@ static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocum
CHECK_CALLED(ShowUI);
if(activeobj) {
hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
hres = IOleInPlaceActiveObject_GetWindow(activeobj, &doc_hwnd);
ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
ok(hwnd != NULL, "hwnd == NULL\n");
ok(doc_hwnd != NULL, "hwnd == NULL\n");
if(last_hwnd)
ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
ok(doc_hwnd == last_hwnd, "hwnd != last_hwnd\n");
}
hres = IOleDocumentView_UIActivate(view, TRUE);
@ -2214,7 +2256,7 @@ static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocum
if(activeobj) {
hres = IOleInPlaceActiveObject_GetWindow(activeobj, &tmp_hwnd);
ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
ok(tmp_hwnd == doc_hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, doc_hwnd);
}
}
@ -2253,11 +2295,11 @@ static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocum
CHECK_CALLED(Exec_SETPROGRESSPOS);
if(activeobj) {
hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
hres = IOleInPlaceActiveObject_GetWindow(activeobj, &doc_hwnd);
ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
ok(hwnd != NULL, "hwnd == NULL\n");
ok(doc_hwnd != NULL, "doc_hwnd == NULL\n");
if(last_hwnd)
ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
ok(doc_hwnd == last_hwnd, "doc_hwnd != last_hwnd\n");
}
}
@ -6154,7 +6196,7 @@ static void test_Activate(IHTMLDocument2 *doc, DWORD flags)
GUID guid;
HRESULT hres;
last_hwnd = hwnd;
last_hwnd = doc_hwnd;
if(view)
IOleDocumentView_Release(view);
@ -6219,10 +6261,10 @@ static void test_Window(IHTMLDocument2 *doc, BOOL expect_success)
if(expect_success) {
ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
ok(tmp_hwnd == doc_hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, doc_hwnd);
}else {
ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
ok(IsWindow(hwnd), "hwnd is destroyed\n");
ok(IsWindow(doc_hwnd), "hwnd is destroyed\n");
}
IOleInPlaceActiveObject_Release(activeobject);
@ -6574,7 +6616,7 @@ static void test_QueryInterface(IHTMLDocument2 *doc)
static void init_test(enum load_state_t ls) {
doc_unk = NULL;
hwnd = last_hwnd = NULL;
doc_hwnd = last_hwnd = NULL;
set_clientsite = FALSE;
load_from_stream = FALSE;
call_UIActivate = CallUIActivate_None;
@ -6686,9 +6728,9 @@ static void test_HTMLDocument(BOOL do_load, BOOL mime)
IOleDocumentView_Release(view);
view = NULL;
ok(IsWindow(hwnd), "hwnd is destroyed\n");
ok(IsWindow(doc_hwnd), "hwnd is destroyed\n");
release_document(doc);
ok(!IsWindow(hwnd), "hwnd is not destroyed\n");
ok(!IsWindow(doc_hwnd), "hwnd is not destroyed\n");
}
static void test_HTMLDocument_hlink(DWORD status)
@ -6820,6 +6862,7 @@ static void test_HTMLDocument_http(BOOL with_wbapp)
test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
test_GetCurMoniker((IUnknown*)doc, http_mon, NULL);
test_travellog(doc);
test_binding_ui((IUnknown*)doc);
nav_url = nav_serv_url = "http://www.winehq.org/"; /* for valid prev nav_url */
if(support_wbapp) {